[pyfr] 08/32: Prevent CUDACUBLASKernels.__del__ from throwing a TypeError.

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Thu Apr 21 08:21:50 UTC 2016


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

ghisvail-guest pushed a commit to branch master
in repository pyfr.

commit 68392ca7a7a3aeeeeccd18293323b40539549653
Author: Freddie Witherden <freddie at witherden.org>
Date:   Tue Feb 2 18:01:17 2016 +0000

    Prevent CUDACUBLASKernels.__del__ from throwing a TypeError.
---
 pyfr/backends/cuda/cublas.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/pyfr/backends/cuda/cublas.py b/pyfr/backends/cuda/cublas.py
index fa5cc75..8f3ee06 100644
--- a/pyfr/backends/cuda/cublas.py
+++ b/pyfr/backends/cuda/cublas.py
@@ -95,9 +95,12 @@ class CUDACUBLASKernels(object):
         # can be *before* we are garbage collected (negating the need to call
         # cublasDestroy as we're terminating anyway).  We therefore need to
         # check for a valid context before calling cublasDestroy
-        import pycuda.autoinit
-        if pycuda.autoinit.context:
-            self._wrappers.cublasDestroy(self._handle)
+        try:
+            import pycuda.autoinit
+            if pycuda.autoinit.context:
+                self._wrappers.cublasDestroy(self._handle)
+        except TypeError:
+            pass
 
     def mul(self, a, b, out, alpha=1.0, beta=0.0):
         w = self._wrappers

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



More information about the debian-science-commits mailing list