diff --git a/src/main/java/org/apache/sysds/runtime/instructions/ooc/OOCWatchdog.java b/src/main/java/org/apache/sysds/runtime/instructions/ooc/OOCWatchdog.java index 289ef8e6b87..19eac2c0da2 100644 --- a/src/main/java/org/apache/sysds/runtime/instructions/ooc/OOCWatchdog.java +++ b/src/main/java/org/apache/sysds/runtime/instructions/ooc/OOCWatchdog.java @@ -21,7 +21,7 @@ import org.apache.sysds.runtime.ooc.cache.BlockEntry; import org.apache.sysds.runtime.ooc.cache.OOCCacheManager; -import org.apache.sysds.runtime.ooc.cache.OOCCacheScheduler; +import org.apache.sysds.runtime.ooc.cache.legacy.OOCCacheScheduler; import java.util.ArrayList; import java.util.Collection; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/cache/BlockEntry.java b/src/main/java/org/apache/sysds/runtime/ooc/cache/BlockEntry.java index c0604d017d8..3e040ef805e 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/cache/BlockEntry.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/cache/BlockEntry.java @@ -32,7 +32,7 @@ public final class BlockEntry { private int _retainHintCount; private int _referenceCount; // The number of references from different managing instances (e.g. CachingStream) - BlockEntry(BlockKey key, long size, Object data) { + public BlockEntry(BlockKey key, long size, Object data) { this._key = key; this._size = size; this._pinCount = 0; @@ -68,11 +68,11 @@ public boolean isGrouped() { throw new IllegalStateException("Cannot get the data of an unpinned entry"); } - Object getDataUnsafe() { + public Object getDataUnsafe() { return _data; } - void setDataUnsafe(Object data) { + public void setDataUnsafe(Object data) { if(data != null && _data != null) throw new IllegalStateException("Cannot overwrite data"); _data = data; @@ -86,15 +86,15 @@ public boolean isPinned() { return _pinCount > 0; } - synchronized int addReference() { + public synchronized int addReference() { return ++_referenceCount; } - synchronized int forget() { + public synchronized int forget() { return --_referenceCount; } - synchronized void setState(BlockState state) { + public synchronized void setState(BlockState state) { _state = state; } @@ -126,7 +126,7 @@ public synchronized int getRetainHintCount() { * Tries to clear the underlying data if it is not pinned * @return the number of cleared bytes (or 0 if could not clear or data was already cleared) */ - synchronized long clear() { + public synchronized long clear() { if (_pinCount != 0 || _data == null) return 0; if (_data instanceof IndexedMatrixValue) @@ -140,7 +140,7 @@ synchronized long clear() { * Pins the underlying data in memory * @return the new number of pins (0 if pin was unsuccessful) */ - synchronized int pin() { + public synchronized int pin() { if (_data == null) return 0; _pinCount++; @@ -151,7 +151,7 @@ synchronized int pin() { * Tries to increment pin-count if already pinned. Unpinned entries are not affected * by this operation. This allows bypassing the global cache lock. */ - synchronized boolean fastPin() { + public synchronized boolean fastPin() { if(_pinCount == 0) return false; _pinCount++; @@ -162,7 +162,7 @@ synchronized boolean fastPin() { * Unpins the underlying data * @return true if the data is now unpinned */ - synchronized boolean unpin() { + public synchronized boolean unpin() { if (_pinCount <= 0) throw new IllegalStateException("Cannot unpin data if it was not pinned"); _pinCount--; @@ -173,7 +173,7 @@ synchronized boolean unpin() { * Tries to unpin but guarantees that it will not * remove the last pin. This allows bypassing the global cache lock. */ - synchronized boolean fastUnpin() { + public synchronized boolean fastUnpin() { if(_pinCount <= 1) return false; _pinCount--; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheManager.java b/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheManager.java index 9f0f8c15b49..f1bb0cbf7f4 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheManager.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheManager.java @@ -26,6 +26,8 @@ import org.apache.sysds.runtime.instructions.ooc.TeeOOCInstruction; import org.apache.sysds.runtime.instructions.spark.data.IndexedMatrixValue; import org.apache.sysds.runtime.matrix.data.MatrixBlock; +import org.apache.sysds.runtime.ooc.cache.legacy.OOCCacheScheduler; +import org.apache.sysds.runtime.ooc.cache.legacy.OOCLRUCacheScheduler; import org.apache.sysds.runtime.ooc.memory.InMemoryQueueCallback; import org.apache.sysds.runtime.ooc.stats.OOCEventLog; import org.apache.sysds.utils.Statistics; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/cache/DeferredReadQueue.java b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/DeferredReadQueue.java similarity index 96% rename from src/main/java/org/apache/sysds/runtime/ooc/cache/DeferredReadQueue.java rename to src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/DeferredReadQueue.java index b5564430fe2..fb56a50c1b9 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/cache/DeferredReadQueue.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/DeferredReadQueue.java @@ -17,7 +17,10 @@ * under the License. */ -package org.apache.sysds.runtime.ooc.cache; +package org.apache.sysds.runtime.ooc.cache.legacy; + +import org.apache.sysds.runtime.ooc.cache.BlockEntry; +import org.apache.sysds.runtime.ooc.cache.BlockKey; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/cache/DeferredReadRequest.java b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/DeferredReadRequest.java similarity index 96% rename from src/main/java/org/apache/sysds/runtime/ooc/cache/DeferredReadRequest.java rename to src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/DeferredReadRequest.java index 0ca6cbd2eab..6e4f225c48c 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/cache/DeferredReadRequest.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/DeferredReadRequest.java @@ -17,7 +17,9 @@ * under the License. */ -package org.apache.sysds.runtime.ooc.cache; +package org.apache.sysds.runtime.ooc.cache.legacy; + +import org.apache.sysds.runtime.ooc.cache.BlockEntry; import java.util.List; import java.util.concurrent.CompletableFuture; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheScheduler.java b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/OOCCacheScheduler.java similarity index 96% rename from src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheScheduler.java rename to src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/OOCCacheScheduler.java index f78327160fa..1820f15e8ae 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCCacheScheduler.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/OOCCacheScheduler.java @@ -17,10 +17,13 @@ * under the License. */ -package org.apache.sysds.runtime.ooc.cache; +package org.apache.sysds.runtime.ooc.cache.legacy; import org.apache.sysds.runtime.instructions.ooc.OOCStream; import org.apache.sysds.runtime.instructions.spark.data.IndexedMatrixValue; +import org.apache.sysds.runtime.ooc.cache.BlockEntry; +import org.apache.sysds.runtime.ooc.cache.BlockKey; +import org.apache.sysds.runtime.ooc.cache.OOCIOHandler; import org.apache.sysds.runtime.ooc.memory.InMemoryQueueCallback; import java.util.Collection; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCLRUCacheScheduler.java b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/OOCLRUCacheScheduler.java similarity index 99% rename from src/main/java/org/apache/sysds/runtime/ooc/cache/OOCLRUCacheScheduler.java rename to src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/OOCLRUCacheScheduler.java index e8af837d670..305a7419166 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/cache/OOCLRUCacheScheduler.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/cache/legacy/OOCLRUCacheScheduler.java @@ -17,7 +17,7 @@ * under the License. */ -package org.apache.sysds.runtime.ooc.cache; +package org.apache.sysds.runtime.ooc.cache.legacy; import org.apache.commons.lang3.mutable.MutableObject; import org.apache.commons.logging.Log; @@ -25,6 +25,10 @@ import org.apache.sysds.api.DMLScript; import org.apache.sysds.runtime.instructions.ooc.OOCStream; import org.apache.sysds.runtime.instructions.spark.data.IndexedMatrixValue; +import org.apache.sysds.runtime.ooc.cache.BlockEntry; +import org.apache.sysds.runtime.ooc.cache.BlockKey; +import org.apache.sysds.runtime.ooc.cache.BlockState; +import org.apache.sysds.runtime.ooc.cache.OOCIOHandler; import org.apache.sysds.runtime.ooc.memory.InMemoryQueueCallback; import org.apache.sysds.runtime.ooc.stats.OOCEventLog; import org.apache.sysds.utils.Statistics; diff --git a/src/main/java/org/apache/sysds/runtime/ooc/memory/CachedAllowance.java b/src/main/java/org/apache/sysds/runtime/ooc/memory/CachedAllowance.java index 4649e47f81e..ffba3910b26 100644 --- a/src/main/java/org/apache/sysds/runtime/ooc/memory/CachedAllowance.java +++ b/src/main/java/org/apache/sysds/runtime/ooc/memory/CachedAllowance.java @@ -25,7 +25,7 @@ import org.apache.sysds.runtime.instructions.spark.data.IndexedMatrixValue; import org.apache.sysds.runtime.ooc.cache.BlockKey; import org.apache.sysds.runtime.ooc.cache.OOCCacheManager; -import org.apache.sysds.runtime.ooc.cache.OOCCacheScheduler; +import org.apache.sysds.runtime.ooc.cache.legacy.OOCCacheScheduler; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; diff --git a/src/test/java/org/apache/sysds/test/component/ooc/cache/OOCLRUCacheSchedulerTest.java b/src/test/java/org/apache/sysds/test/component/ooc/cache/OOCLRUCacheSchedulerTest.java index 2741c10bdbb..527d89ec05f 100644 --- a/src/test/java/org/apache/sysds/test/component/ooc/cache/OOCLRUCacheSchedulerTest.java +++ b/src/test/java/org/apache/sysds/test/component/ooc/cache/OOCLRUCacheSchedulerTest.java @@ -25,7 +25,7 @@ import org.apache.sysds.runtime.ooc.cache.BlockKey; import org.apache.sysds.runtime.ooc.cache.BlockState; import org.apache.sysds.runtime.ooc.cache.OOCIOHandler; -import org.apache.sysds.runtime.ooc.cache.OOCLRUCacheScheduler; +import org.apache.sysds.runtime.ooc.cache.legacy.OOCLRUCacheScheduler; import org.junit.After; import org.junit.Assert; import org.junit.Before; diff --git a/src/test/java/org/apache/sysds/test/component/ooc/cache/SourceBackedCacheSchedulerTest.java b/src/test/java/org/apache/sysds/test/component/ooc/cache/SourceBackedCacheSchedulerTest.java index 83c2fd59669..4d345601982 100644 --- a/src/test/java/org/apache/sysds/test/component/ooc/cache/SourceBackedCacheSchedulerTest.java +++ b/src/test/java/org/apache/sysds/test/component/ooc/cache/SourceBackedCacheSchedulerTest.java @@ -29,7 +29,7 @@ import org.apache.sysds.runtime.ooc.cache.BlockKey; import org.apache.sysds.runtime.ooc.cache.BlockState; import org.apache.sysds.runtime.ooc.cache.OOCIOHandler; -import org.apache.sysds.runtime.ooc.cache.OOCLRUCacheScheduler; +import org.apache.sysds.runtime.ooc.cache.legacy.OOCLRUCacheScheduler; import org.apache.sysds.runtime.ooc.cache.OOCMatrixIOHandler; import org.apache.sysds.test.AutomatedTestBase; import org.apache.sysds.test.TestConfiguration; diff --git a/src/test/java/org/apache/sysds/test/functions/ooc/LmCGTest.java b/src/test/java/org/apache/sysds/test/functions/ooc/LmCGTest.java index f4c4d364e83..7e92d824985 100644 --- a/src/test/java/org/apache/sysds/test/functions/ooc/LmCGTest.java +++ b/src/test/java/org/apache/sysds/test/functions/ooc/LmCGTest.java @@ -37,7 +37,7 @@ public class LmCGTest extends AutomatedTestBase { private final static String TEST_NAME1 = "lmCG"; private final static String TEST_DIR = "functions/ooc/"; private final static String TEST_CLASS_DIR = TEST_DIR + LmCGTest.class.getSimpleName() + "/"; - private final static double eps = 1e-8; + private final static double eps = 1e-7; private static final String INPUT_NAME_1 = "X"; private static final String INPUT_NAME_2 = "y"; private static final String OUTPUT_NAME = "res";