[arrayfire] 212/284: Add try/catch around cuda::setDevice in Pinned Memory Manager

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:34 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 cc9018e402e2370438c1558c19e7ff21447f36d7
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Tue Jan 12 10:53:37 2016 -0500

    Add try/catch around cuda::setDevice in Pinned Memory Manager
---
 src/backend/cuda/memory.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/backend/cuda/memory.cpp b/src/backend/cuda/memory.cpp
index 20e2547..69eb8f8 100644
--- a/src/backend/cuda/memory.cpp
+++ b/src/backend/cuda/memory.cpp
@@ -70,8 +70,16 @@ public:
     {
         common::lock_guard_t lock(this->memory_mutex);
         for (int n = 0; n < getDeviceCount(); n++) {
-            cuda::setDevice(n);
-            this->garbageCollect();
+            try {
+                cuda::setDevice(n);
+                this->garbageCollect();
+            } catch(AfError err) {
+                if(err.getError() == AF_ERR_DRIVER) { // Can happen from cudaErrorDevicesUnavailable
+                    continue;
+                } else {
+                    throw err;
+                }
+            }
         }
     }
 };

-- 
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