Block-Structured AMR Software Framework
AMReX_GpuPrint.H
Go to the documentation of this file.
1 #ifndef AMREX_GPU_PRINT_H_
2 #define AMREX_GPU_PRINT_H_
3 #include <AMReX_Config.H>
4 
5 #include <cstdio>
6 
7 #ifdef AMREX_USE_SYCL
8 # include <sycl/sycl.hpp>
9 #endif
10 
11 #if defined(AMREX_USE_SYCL)
12 #if defined(__SYCL_DEVICE_ONLY__)
13 # define AMREX_DEVICE_PRINTF(format,...) { \
14  static const __attribute__((opencl_constant)) char amrex_i_format[] = format ; \
15  sycl::ext::oneapi::experimental::printf(amrex_i_format, __VA_ARGS__); }
16 #else
17 # define AMREX_DEVICE_PRINTF(format,...) { \
18  std::printf(format, __VA_ARGS__); }
19 #endif
20 #elif defined(AMREX_USE_CUDA)
21 # define AMREX_DEVICE_PRINTF(...) std::printf(__VA_ARGS__);
22 #elif defined(AMREX_USE_HIP)
23 # define AMREX_DEVICE_PRINTF(...) ::printf(__VA_ARGS__);
24 #else
25 # define AMREX_DEVICE_PRINTF(format,...) { \
26  std::printf(format, __VA_ARGS__); }
27 #endif
28 
29 #endif // AMREX_GPU_PRINT_H_