opm-simulators
Toggle main menu visibility
Loading...
Searching...
No Matches
cuda_check_last_error.hpp
1
/*
2
Copyright 2022-2023 SINTEF AS
3
4
This file is part of the Open Porous Media project (OPM).
5
6
OPM is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
OPM is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with OPM. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
#ifndef OPM_CUDA_CHECK_LAST_ERROR_HPP
20
#define OPM_CUDA_CHECK_LAST_ERROR_HPP
21
#include <cuda_runtime.h>
22
#include <fmt/core.h>
23
#include <opm/simulators/linalg/gpuistl/detail/gpu_safe_call.hpp>
24
41
#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE OPM_GPU_SAFE_CALL(cudaDeviceSynchronize())
42
43
#ifdef NDEBUG
44
#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG
45
#else
46
62
#define OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE_IF_DEBUG OPM_CUDA_CHECK_DEVICE_SYNCHRONIZE
63
#endif
64
65
81
#define OPM_CUDA_CHECK_LAST_ERROR OPM_GPU_SAFE_CALL(cudaGetLastError())
82
83
#ifdef NDEBUG
84
#define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG
85
#else
86
102
#define OPM_CUDA_CHECK_LAST_ERROR_IF_DEBUG OPM_CUDA_CHECK_LAST_ERROR
103
#endif
104
105
#endif
opm
simulators
linalg
gpuistl
detail
cuda_check_last_error.hpp
Generated by
1.17.0