From a5896383e793b60bd6d1b0174b00722cb3d2a2eb Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 2 Sep 2024 10:48:03 -0700 Subject: [PATCH] `AMREX_DEVICE_PRINTF`: Host (#4116) In AMReX, device means host if compiled for CPUs. Add support for printf debugging on CPUs for `AMREX_DEVICE_PRINTF`. Currently, the macro was undefined, unless for the special case of SYCL compilation for host code paths where it worked. --- Src/Base/AMReX_GpuPrint.H | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Src/Base/AMReX_GpuPrint.H b/Src/Base/AMReX_GpuPrint.H index 9e029ea8835..37f74f30bfc 100644 --- a/Src/Base/AMReX_GpuPrint.H +++ b/Src/Base/AMReX_GpuPrint.H @@ -2,8 +2,6 @@ #define AMREX_GPU_PRINT_H_ #include -#if !defined(__APPLE__) - #include #ifdef AMREX_USE_SYCL @@ -23,7 +21,9 @@ # define AMREX_DEVICE_PRINTF(...) std::printf(__VA_ARGS__); #elif defined(AMREX_USE_HIP) # define AMREX_DEVICE_PRINTF(...) ::printf(__VA_ARGS__); +#else +# define AMREX_DEVICE_PRINTF(format,...) { \ + std::printf(format, __VA_ARGS__); } #endif -#endif // !defined(__APPLE__) #endif // AMREX_GPU_PRINT_H_