OpenFPM  5.2.0
Project that contain the implementation of distributed structures
cuda_util.hpp
1 /*
2  * cuda_util.hpp
3  *
4  * Created on: Jun 13, 2018
5  * Author: i-bird
6  */
7 
8 #ifndef OPENFPM_DATA_SRC_UTIL_CUDA_UTIL_HPP_
9 #define OPENFPM_DATA_SRC_UTIL_CUDA_UTIL_HPP_
10 
11 #include "config.h"
12 #include "cuda_kernel_error_checker.hpp"
13 
14 #if defined(CUDIFY_USE_ALPAKA)
15 #define CUDA_ON_CPU
16 #elif defined(CUDIFY_USE_OPENMP)
17 #define CUDA_ON_CPU
18 #elif defined(CUDIFY_USE_SEQUENTIAL)
19 #define CUDA_ON_CPU
20 #endif
21 
22 // CUDA_GPU: CUDA, HIP, SEQUENTIAL, OPENMP, ALPAKA
23 #ifdef CUDA_GPU
24  #ifndef __NVCC__
25  #ifndef __host__
26  #define __host__
27  #define __device__
28  #define __forceinline__
29  #define __shared__ static thread_local
30  #define __global__ inline
31  #endif
32  #endif
33 
34  #ifdef CUDA_ON_CPU
35  #ifndef __host__
36  #define __host__
37  #define __device__
38  #define __forceinline__
39  #define __global__ inline
40  #endif
41 
42  #ifdef __shared__
43  #undef __shared__
44  #endif
45  #define __shared__ static thread_local
46  #endif
47 #else
48  #ifndef __host__
49  #define __host__
50  #define __forceinline__
51  #define __device__
52  #define __shared__ static thread_local
53  #define __global__ inline
54  #endif
55 #endif
56 
57 #define CUDA_BACKEND_NONE 0
58 #define CUDA_BACKEND_CUDA 1
59 #define CUDA_BACKEND_SEQUENTIAL 2
60 #define CUDA_BACKEND_ALPAKA 3
61 #define CUDA_BACKEND_OPENMP 4
62 #define CUDA_BACKEND_HIP 5
63 
64 
65 
66 #if defined(CUDIFY_USE_CUDA)
67 #include "cudify/cuda/cudify_cuda.hpp"
68 #elif defined(CUDIFY_USE_ALPAKA)
69 #include "cudify/alpaka/cudify_alpaka.hpp"
70 #elif defined(CUDIFY_USE_OPENMP)
71 #include "cudify/openmp/cudify_openmp.hpp"
72 #elif defined(CUDIFY_USE_HIP)
73 #include "cudify/hip/cudify_hip.hpp"
74 #elif defined(CUDIFY_USE_SEQUENTIAL)
75 #include "cudify/sequential/cudify_sequential.hpp"
76 #else
77 #define CUDA_ON_BACKEND CUDA_BACKEND_NONE
78 
79 constexpr int default_kernel_wg_threads_ = 1024;
80 
81 static void init_wrappers() {}
82 
83 
84 #endif
85 
86 #endif /* OPENFPM_DATA_SRC_UTIL_CUDA_UTIL_HPP_ */