add hip_check() routine

This commit is contained in:
Hicham Agueny 2024-02-27 16:04:03 +01:00
parent b312923ce6
commit 163eb02a0b

View File

@ -34,6 +34,20 @@ class SHMEMSimulator(Simulator.BaseSimulator):
Class which handles communication and synchronization between simulators in different Class which handles communication and synchronization between simulators in different
contexts (presumably on different GPUs) contexts (presumably on different GPUs)
""" """
def hip_check(call_result):
err = call_result[0]
result = call_result[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))
return result
def __init__(self, sims, grid): def __init__(self, sims, grid):
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)