16 #ifndef OPM_SIMULATORS_LINALG_GPUISTL_GPU_RESOURCES_HPP 17 #define OPM_SIMULATORS_LINALG_GPUISTL_GPU_RESOURCES_HPP 19 #include <cuda_runtime.h> 20 #include <opm/simulators/linalg/gpuistl/detail/gpu_safe_call.hpp> 21 #include <type_traits> 44 #define OPM_CREATE_GPU_RESOURCE(name, type, create, destroy, ...) \ 48 using resource_type = type; \ 52 OPM_GPU_SAFE_CALL(create(&resource_, ##__VA_ARGS__)); \ 54 name(const name&) = delete; \ 55 name& operator=(const name&) = delete; \ 59 OPM_GPU_WARN_IF_ERROR(destroy(resource_)); \ 62 const resource_type& get() const \ 66 resource_type& get() \ 72 resource_type resource_ = nullptr; \ 92 #define OPM_CREATE_GPU_RESOURCE_NO_CREATE(name, type, destroy) \ 96 using resource_type = type; \ 102 OPM_GPU_WARN_IF_ERROR(destroy(resource_)); \ 104 name(const name&) = delete; \ 105 name& operator=(const name&) = delete; \ 107 const resource_type& get() const \ 111 resource_type& get() \ 117 resource_type resource_; \ 151 GPUGraph, cudaGraph_t, cudaGraphCreate, cudaGraphDestroy, 0);
OPM_CREATE_GPU_RESOURCE(GPUStream, cudaStream_t, cudaStreamCreate, cudaStreamDestroy)
Manages a CUDA stream resource.
A small, fixed‑dimension MiniVector class backed by std::array that can be used in both host and CUD...
Definition: AmgxInterface.hpp:37
OPM_CREATE_GPU_RESOURCE_NO_CREATE(GPUGraphExec, cudaGraphExec_t, cudaGraphExecDestroy)
Manages a CUDA graph execution resource.