Skip to content

Commit

Permalink
Check status after calls to cudaGetErrorName/String
Browse files Browse the repository at this point in the history
  • Loading branch information
shwina committed Jan 13, 2022
1 parent 84994cb commit 8be6c0b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions python/rmm/_cuda/gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@
class CUDARuntimeError(RuntimeError):
def __init__(self, status: cudart.cudaError_t):
self.status = status
_, name = cudart.cudaGetErrorName(status)
_, msg = cudart.cudaGetErrorString(status)

err, name = cudart.cudaGetErrorName(status)
if err != cudart.cudaError_t.cudaSuccess:
raise CUDARuntimeError(err.value)

err, msg = cudart.cudaGetErrorString(status)
if err != cudart.cudaError_t.cudaSuccess:
raise CUDARuntimeError(err.value)

super(CUDARuntimeError, self).__init__(
"%s: %s" % (name.decode(), msg.decode())
)
Expand Down

0 comments on commit 8be6c0b

Please sign in to comment.