feat(common): add a common hip_check function

This commit is contained in:
Anthony Berg 2025-06-24 21:25:01 +02:00
parent b8836f4fb0
commit 189eb42603
2 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,4 @@
# Objects
from GPUSimulators.common.arrays.cuda.arkawa2d import ArakawaA2D
from .common import *
from GPUSimulators.common.arrays.cuda.array2d import CudaArray2D
@ -6,4 +7,7 @@ from .data_dumper import DataDumper
from .ip_engine import IPEngine
from .popen_file_buffer import PopenFileBuffer
from .progress_printer import ProgressPrinter
from .timer import Timer
from .timer import Timer
# Functions
from .hip_check import hip_check

View File

@ -0,0 +1,15 @@
from hip import hip
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))
return result