Skip to content

Commit adfa1f9

Browse files
author
Niketan Pansare
committed
[SYSTEMML-1325] Fixed GPU cleanup bug when invoked with JMLC.
Closes apache#854.
1 parent b4ef84b commit adfa1f9

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/main/java/org/apache/sysml/runtime/controlprogram/caching/CacheableData.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,15 +624,19 @@ public synchronized void clearData()
624624
_rddHandle.setBackReference(null);
625625
if( _bcHandle != null )
626626
_bcHandle.setBackReference(null);
627+
clearGPUData();
628+
629+
// change object state EMPTY
630+
setDirty(false);
631+
setEmpty();
632+
}
633+
634+
public void clearGPUData() {
627635
if( _gpuObjects != null ) {
628636
for (GPUObject gObj : _gpuObjects.values())
629637
if (gObj != null)
630638
gObj.clearData(null, gObj.getGPUContext().EAGER_CUDA_FREE);
631639
}
632-
633-
// change object state EMPTY
634-
setDirty(false);
635-
setEmpty();
636640
}
637641

638642
public synchronized void exportData() {

src/main/java/org/apache/sysml/runtime/controlprogram/context/ExecutionContext.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,8 +648,12 @@ public void cleanupCacheableData(CacheableData<?> mo) {
648648
Statistics.removeCPMemObject(System.identityHashCode(mo));
649649
//early abort w/o scan of symbol table if no cleanup required
650650
boolean fileExists = (mo.isHDFSFileExists() && mo.getFileName() != null);
651-
if( !CacheableData.isCachingActive() && !fileExists )
651+
if( !CacheableData.isCachingActive() && !fileExists ) {
652+
if ( mo.isCleanupEnabled() && !getVariables().hasReferences(mo) )
653+
mo.clearGPUData();
652654
return;
655+
}
656+
653657

654658
try {
655659
//compute ref count only if matrix cleanup actually necessary

0 commit comments

Comments
 (0)