Documentation a537f1bdf2
Loading...
Searching...
No Matches
GPUComms.cuh
Go to the documentation of this file.
1/*!
2\file GPUComms.cuh
3* \brief Header file containing universal functions that provide basic and essential utilities for other GPU processes
4* \author A. Raj
5* \version 8.5.0 "Harrier"
6*
7* SU2 Project Website: https://su2code.github.io
8*
9* The SU2 Project is maintained by the SU2 Foundation
10* (http://su2foundation.org)
11*
12* Copyright 2012-2026, SU2 Contributors (cf. AUTHORS.md)
13*
14* SU2 is free software; you can redistribute it and/or
15* modify it under the terms of the GNU Lesser General Public
16* License as published by the Free Software Foundation; either
17* version 2.1 of the License, or (at your option) any later version.
18*
19* SU2 is distributed in the hope that it will be useful,
20* but WITHOUT ANY WARRANTY; without even the implied warranty of
21* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22* Lesser General Public License for more details.
23*
24* You should have received a copy of the GNU Lesser General Public
25* License along with SU2. If not, see <http://www.gnu.org/licenses/>.
26*/
27
28#pragma once
29
30#ifndef SU2_COMMON_LINEAR_ALGEBRA_GPUCOMMS_CUH
31#define SU2_COMMON_LINEAR_ALGEBRA_GPUCOMMS_CUH
32
33#include<cuda_runtime.h>
34#include<iostream>
35
37
38inline constexpr int round_up_division(const int multiple, int x) { return ((x + multiple - 1) / multiple); }
39
40static constexpr int MVP_BLOCK_SIZE = 1024;
41static constexpr int MVP_WARP_SIZE = 32;
42}
43/*!
44* \brief assert style function that reads return codes after intercepting CUDA API calls.
45* It returns the result code and its location if the call is unsuccessful.
46* \param[in] code - result code of CUDA function
47* \param[in] file - name of file holding the function
48* \param[in] line - line containing the function
49*/
50
51inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true){
52 if (code != cudaSuccess){
53 fprintf(stderr,"GPUassert: %s %s %d\n", cudaGetErrorString(code), file, line);
54 if (abort) exit(code);
55 }
56}
57
58#define gpuErrChk(ans) { gpuAssert((ans), __FILE__, __LINE__); }
59
60#endif // SU2_COMMON_LINEAR_ALGEBRA_GPUCOMMS_CUH
void gpuAssert(cudaError_t code, const char *file, int line, bool abort=true)
assert style function that reads return codes after intercepting CUDA API calls. It returns the resul...
Definition GPUComms.cuh:51
Definition GPUComms.cuh:36
constexpr int round_up_division(const int multiple, int x)
Definition GPUComms.cuh:38