Fix GIL bug in cublas
@@ -140,18 +140,21 @@ cpdef inline check_status(int status):
cpdef size_t create() except *:
cdef Handle handle
+ with nogil:
status = cublasCreate(&handle)
check_status(status)
return <size_t>handle
cpdef void destroy(size_t handle) except *:
+ with nogil:
status = cublasDestroy(<Handle>handle)
check_status(status)
cpdef int getVersion(size_t handle) except *:
cdef int version
+ with nogil:
status = cublasGetVersion(<Handle>handle, &version)
check_status(status)
return version
@@ -159,12 +162,14 @@ cpdef int getVersion(size_t handle) except *:
cpdef int getPointerMode(size_t handle) except *:
cdef PointerMode mode
+ with nogil:
status = cublasGetPointerMode(<Handle>handle, &mode)
check_status(status)
return mode
cpdef setPointerMode(size_t handle, int mode):
+ with nogil:
status = cublasSetPointerMode(<Handle>handle, <PointerMode>mode)
check_status(status)
@@ -174,12 +179,14 @@ cpdef setPointerMode(size_t handle, int mode):
###############################################################################
cpdef setStream(size_t handle, size_t stream):
+ with nogil:
status = cublasSetStream(<Handle>handle, <driver.Stream>stream)
check_status(status)
cpdef size_t getStream(size_t handle) except *:
cdef driver.Stream stream
+ with nogil:
status = cublasGetStream(<Handle>handle, &stream)
check_status(status)
return <size_t>stream
