check_error

paddle.cuda. check_error ( res: int ) None [source]

Check the return code of a CUDA runtime API call.

This function validates whether the given result code from a CUDA runtime call indicates success. If the result code is not base.libpaddle._cudart.cudaError.success, it raises a CudaError.

Parameters

res (int) – The CUDA runtime return code.

Examples

>>> 
>>> from paddle.cuda import check_error
>>> check_error(0) # check for cuda success code # will not raise Error
>>> # check_error(1) # check for cuda error code 1(invalid argument), will raise Error
>>> # check_error(2) # check for cuda error code 2(out of memory), will raise Error