12 #ifndef MFEM_BACKENDS_HPP
13 #define MFEM_BACKENDS_HPP
15 #include "../config/config.hpp"
19 #include <library_types.h>
20 #include <cuda_runtime.h>
26 #include <hip/hip_runtime.h>
35 #include "RAJA/RAJA.hpp"
36 #if defined(RAJA_ENABLE_CUDA) && !defined(MFEM_USE_CUDA)
37 #error When RAJA is built with CUDA, MFEM_USE_CUDA=YES is required
41 #if !(defined(MFEM_USE_CUDA) || defined(MFEM_USE_HIP))
44 #define MFEM_HOST_DEVICE
46 #define MFEM_DEVICE_SYNC
48 #define MFEM_STREAM_SYNC
51 #if !((defined(MFEM_USE_CUDA) && defined(__CUDA_ARCH__)) || \
52 (defined(MFEM_USE_HIP) && defined(__HIP_DEVICE_COMPILE__)))
54 #define MFEM_SYNC_THREAD
55 #define MFEM_BLOCK_ID(k) 0
56 #define MFEM_THREAD_ID(k) 0
57 #define MFEM_THREAD_SIZE(k) 1
58 #define MFEM_FOREACH_THREAD(i,k,N) for(int i=0; i<N; i++)
64 #if ((defined(MFEM_USE_CUDA) && defined(__CUDA_ARCH__)) || \
65 (defined(MFEM_USE_HIP) && defined(__HIP_DEVICE_COMPILE__)))
66 return atomicAdd(&add,val);
74 #endif // MFEM_BACKENDS_HPP
MFEM_HOST_DEVICE T AtomicAdd(T &add, const T val)
void add(const Vector &v1, const Vector &v2, Vector &v)