mirror of
https://github.com/smyalygames/FiniteVolumeGPU.git
synced 2025-11-27 23:29:49 +01:00
20 lines
669 B
Python
20 lines
669 B
Python
from hip import hip, hiprtc, hipblas
|
|
|
|
|
|
def hip_check(call_request):
|
|
"""
|
|
Function that checks if the HIP function executed successfully.
|
|
"""
|
|
|
|
err = call_request[0]
|
|
result = call_request[1:]
|
|
if len(result) == 1:
|
|
result = result[0]
|
|
if isinstance(err, hip.hipError_t) and err != hip.hipError_t.hipSuccess:
|
|
raise RuntimeError(str(err))
|
|
elif isinstance(err, hiprtc.hiprtcResult) and err != hiprtc.hiprtcResult.HIPRTC_SUCCESS:
|
|
raise RuntimeError(str(err))
|
|
elif isinstance(err, hipblas.hipblasStatus_t) and err != hipblas.hipblasStatus_t.HIPBLAS_STATUS_SUCCESS:
|
|
raise RuntimeError(str(err))
|
|
return result
|