You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@systemds.apache.org by ma...@apache.org on 2021/03/25 19:37:26 UTC

[systemds] branch master updated: [SYSTEMDS-2915] Fixing GPU memory leak due to untracked GPUObjects that were used after removal.

This is an automated email from the ASF dual-hosted git repository.

markd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/master by this push:
     new 9e60173  [SYSTEMDS-2915] Fixing GPU memory leak due to untracked GPUObjects that were used after removal.
9e60173 is described below

commit 9e6017351abb2090219b1a9c7394ad199965cfdc
Author: Mark Dokter <ma...@dokter.cc>
AuthorDate: Thu Mar 25 19:58:51 2021 +0100

    [SYSTEMDS-2915] Fixing GPU memory leak due to untracked GPUObjects that were used after removal.
---
 .../apache/sysds/runtime/controlprogram/caching/CacheableData.java    | 4 ++++
 .../sysds/runtime/instructions/gpu/context/GPUMemoryManager.java      | 1 +
 2 files changed, 5 insertions(+)

diff --git a/src/main/java/org/apache/sysds/runtime/controlprogram/caching/CacheableData.java b/src/main/java/org/apache/sysds/runtime/controlprogram/caching/CacheableData.java
index cf6ab3f..fbe787b 100644
--- a/src/main/java/org/apache/sysds/runtime/controlprogram/caching/CacheableData.java
+++ b/src/main/java/org/apache/sysds/runtime/controlprogram/caching/CacheableData.java
@@ -437,6 +437,10 @@ public abstract class CacheableData<T extends CacheBlock> extends Data
 				throw new DMLRuntimeException("GPU : Inconsistent internal state - this CacheableData already has a GPUObject assigned to the current GPUContext (" + gCtx + ")");
 	}
 	
+	public synchronized void removeGPUObject(GPUContext gCtx) {
+		_gpuObjects.remove(gCtx);
+	}
+	
 	// *********************************************
 	// ***                                       ***
 	// ***    HIGH-LEVEL METHODS THAT SPECIFY    ***
diff --git a/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUMemoryManager.java b/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUMemoryManager.java
index 67c9a14..2510747 100644
--- a/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUMemoryManager.java
+++ b/src/main/java/org/apache/sysds/runtime/instructions/gpu/context/GPUMemoryManager.java
@@ -450,6 +450,7 @@ public class GPUMemoryManager {
 		if(LOG.isDebugEnabled())
 			LOG.debug("Removing the GPU object: " + gpuObj);
 		matrixMemoryManager.gpuObjects.remove(gpuObj);
+		gpuObj.mat.removeGPUObject(gpuObj.getGPUContext());
 	}