12 #ifndef MFEM_BACKENDS_HPP
13 #define MFEM_BACKENDS_HPP
15 #include "../config/config.hpp"
18 #include <cuda_runtime.h>
24 #include <hip/hip_runtime.h>
33 #include "RAJA/RAJA.hpp"
34 #if defined(RAJA_ENABLE_CUDA) && !defined(MFEM_USE_CUDA)
35 #error When RAJA is built with CUDA, MFEM_USE_CUDA=YES is required
39 #if !(defined(MFEM_USE_CUDA) || defined(MFEM_USE_HIP))
42 #define MFEM_HOST_DEVICE
44 #define MFEM_DEVICE_SYNC
46 #define MFEM_STREAM_SYNC
49 #if !((defined(MFEM_USE_CUDA) && defined(__CUDA_ARCH__)) || \
50 (defined(MFEM_USE_HIP) && defined(__HIP_DEVICE_COMPILE__)))
52 #define MFEM_SYNC_THREAD
53 #define MFEM_THREAD_ID(k) 0
54 #define MFEM_THREAD_SIZE(k) 1
55 #define MFEM_FOREACH_THREAD(i,k,N) for(int i=0; i<N; i++)
61 #if ((defined(MFEM_USE_CUDA) && defined(__CUDA_ARCH__)) || \
62 (defined(MFEM_USE_HIP) && defined(__HIP_DEVICE_COMPILE__)))
63 return atomicAdd(&add,val);
71 #endif // MFEM_BACKENDS_HPP
MFEM_HOST_DEVICE T AtomicAdd(T &add, const T val)
void add(const Vector &v1, const Vector &v2, Vector &v)