[arrayfire] 202/284: Fixing issue where garbageCollect was only called on current device

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit 1520dc3bea5185d5ac000b18d93f8a51cd1d6e39
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date:   Mon Jan 11 16:36:18 2016 -0500

    Fixing issue where garbageCollect was only called on current device
---
 src/backend/cpu/memory.cpp    |  5 ++++-
 src/backend/cuda/memory.cpp   | 10 ++++++++--
 src/backend/opencl/memory.cpp | 10 +++++++---
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/src/backend/cpu/memory.cpp b/src/backend/cpu/memory.cpp
index 4af3486..c387b68 100644
--- a/src/backend/cpu/memory.cpp
+++ b/src/backend/cpu/memory.cpp
@@ -36,7 +36,10 @@ public:
     ~MemoryManager()
     {
         common::lock_guard_t lock(this->memory_mutex);
-        this->garbageCollect();
+        for (int n = 0; n < getDeviceCount(); n++) {
+            cpu::setDevice(n);
+            this->garbageCollect();
+        }
     }
 };
 
diff --git a/src/backend/cuda/memory.cpp b/src/backend/cuda/memory.cpp
index a3e995f..0e3fb5a 100644
--- a/src/backend/cuda/memory.cpp
+++ b/src/backend/cuda/memory.cpp
@@ -44,7 +44,10 @@ public:
     ~MemoryManager()
     {
         common::lock_guard_t lock(this->memory_mutex);
-        this->garbageCollect();
+        for (int n = 0; n < getDeviceCount(); n++) {
+            cuda::setDevice(n);
+            this->garbageCollect();
+        }
     }
 };
 
@@ -58,7 +61,10 @@ public:
     ~MemoryManagerPinned()
     {
         common::lock_guard_t lock(this->memory_mutex);
-        this->garbageCollect();
+        for (int n = 0; n < getDeviceCount(); n++) {
+            cuda::setDevice(n);
+            this->garbageCollect();
+        }
     }
 };
 
diff --git a/src/backend/opencl/memory.cpp b/src/backend/opencl/memory.cpp
index 9e1344d..8a48a48 100644
--- a/src/backend/opencl/memory.cpp
+++ b/src/backend/opencl/memory.cpp
@@ -39,7 +39,10 @@ public:
     ~MemoryManager()
     {
         common::lock_guard_t lock(this->memory_mutex);
-        this->garbageCollect();
+        for (int n = 0; n < getDeviceCount(); n++) {
+            opencl::setDevice(n);
+            this->garbageCollect();
+        }
     }
 };
 
@@ -60,8 +63,9 @@ public:
     ~MemoryManagerPinned()
     {
         common::lock_guard_t lock(this->memory_mutex);
-        this->garbageCollect();
-        for (int n = 0; n < (int)pinned_maps.size(); n++) {
+        for (int n = 0; n < getDeviceCount(); n++) {
+            opencl::setDevice(n);
+            this->garbageCollect();
             auto pinned_curr_iter = pinned_maps[n].begin();
             auto pinned_end_iter  = pinned_maps[n].end();
             while (pinned_curr_iter != pinned_end_iter) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git



More information about the debian-science-commits mailing list