From bf04b4bd1b606f98d5ea936a653d59c7e0f0e8ae Mon Sep 17 00:00:00 2001 From: Hicham Agueny <95568317+HichamAgueny@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:36:33 +0100 Subject: [PATCH] add hip_check --- GPUSimulators/KP07.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/GPUSimulators/KP07.py b/GPUSimulators/KP07.py index 5ad5d8c..a37d25d 100644 --- a/GPUSimulators/KP07.py +++ b/GPUSimulators/KP07.py @@ -51,6 +51,20 @@ class KP07 (Simulator.BaseSimulator): dt: Size of each timestep (90 s) g: Gravitational accelleration (9.81 m/s^2) """ + 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, context, h0, hu0, hv0,