diff --git a/TestRKAB/src/gaussian.hxx b/TestRKAB/src/gaussian.hxx index e330a5501..7cd716149 100644 --- a/TestRKAB/src/gaussian.hxx +++ b/TestRKAB/src/gaussian.hxx @@ -1,12 +1,15 @@ #ifndef TEST_RKAB_GAUSSIAN_HXX #define TEST_RKAB_GAUSSIAN_HXX +#include + #include namespace TestRKAB::gauss { template -static inline auto phi(T W, T A, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE phi(T W, T A, T t, T x, T y, + T z) noexcept -> T { using std::sqrt, std::cosh, std::sinh; const auto r{sqrt(x * x + y * y + z * z)}; @@ -24,7 +27,8 @@ static inline auto phi(T W, T A, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Pi(T W, T A, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Pi(T W, T A, T t, T x, T y, + T z) noexcept -> T { using std::sqrt, std::cosh, std::sinh; const auto r{sqrt(x * x + y * y + z * z)}; @@ -46,7 +50,8 @@ static inline auto Pi(T W, T A, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Dx(T W, T A, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Dx(T W, T A, T t, T x, T y, + T z) noexcept -> T { using std::sqrt, std::cosh, std::sinh; const auto r{sqrt(x * x + y * y + z * z)}; @@ -71,7 +76,8 @@ static inline auto Dx(T W, T A, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Dy(T W, T A, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Dy(T W, T A, T t, T x, T y, + T z) noexcept -> T { using std::sqrt, std::cosh, std::sinh; const auto r{sqrt(x * x + y * y + z * z)}; @@ -96,7 +102,8 @@ static inline auto Dy(T W, T A, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Dz(T W, T A, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Dz(T W, T A, T t, T x, T y, + T z) noexcept -> T { using std::sqrt, std::cosh, std::sinh; const auto r{sqrt(x * x + y * y + z * z)}; diff --git a/TestRKAB/src/initial.cxx b/TestRKAB/src/initial.cxx index 30534f750..f8f8db70b 100644 --- a/TestRKAB/src/initial.cxx +++ b/TestRKAB/src/initial.cxx @@ -52,15 +52,15 @@ extern "C" void TestRKAB_Initial(CCTK_ARGUMENTS) { noise_boundary}; std::mt19937 noise_engine{noise_seed}; - grid.loop_int_device<0, 0, 0>(grid.nghostzones, - [&] CCTK_DEVICE(const Loop::PointDesc &p) - CCTK_ATTRIBUTE_ALWAYS_INLINE { - phi(p.I) = noise_distrib(noise_engine); - Pi(p.I) = noise_distrib(noise_engine); - Dx(p.I) = noise_distrib(noise_engine); - Dy(p.I) = noise_distrib(noise_engine); - Dz(p.I) = noise_distrib(noise_engine); - }); + grid.loop_int<0, 0, 0>(grid.nghostzones, + [&] CCTK_HOST(const Loop::PointDesc &p) + CCTK_ATTRIBUTE_ALWAYS_INLINE { + phi(p.I) = noise_distrib(noise_engine); + Pi(p.I) = noise_distrib(noise_engine); + Dx(p.I) = noise_distrib(noise_engine); + Dy(p.I) = noise_distrib(noise_engine); + Dz(p.I) = noise_distrib(noise_engine); + }); } else { CCTK_VERROR("Unknown initial condition \"%s\"", initial_condition); } diff --git a/TestRKAB/src/rhs.cxx b/TestRKAB/src/rhs.cxx index b3c6e04d9..8a624c48b 100644 --- a/TestRKAB/src/rhs.cxx +++ b/TestRKAB/src/rhs.cxx @@ -12,8 +12,8 @@ using namespace Arith; enum class fd_dir : std::size_t { x = 0, y = 1, z = 2 }; template -static inline auto fd_c_1_4(const Loop::PointDesc &p, - const Loop::GF3D2 &gf) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE +fd_c_1_4(const Loop::PointDesc &p, const Loop::GF3D2 &gf) noexcept -> T { constexpr auto d{static_cast(direction)}; const auto num{gf(p.I - 2 * p.DI[d]) - 8.0 * gf(p.I - 1 * p.DI[d]) + 8.0 * gf(p.I + 1 * p.DI[d]) - 1.0 * gf(p.I + 2 * p.DI[d])}; diff --git a/TestRKAB/src/standing_wave.hxx b/TestRKAB/src/standing_wave.hxx index 24bf4e19c..00667d3ff 100644 --- a/TestRKAB/src/standing_wave.hxx +++ b/TestRKAB/src/standing_wave.hxx @@ -1,13 +1,15 @@ #ifndef TEST_RKAB_STANDING_WAVE_HXX #define TEST_RKAB_STANDING_WAVE_HXX +#include + #include namespace TestRKAB::sw { template -static inline auto phi(T A, T kx, T ky, T kz, T t, T x, T y, - T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE phi(T A, T kx, T ky, T kz, T t, T x, + T y, T z) noexcept -> T { using std::sqrt, std::sin, std::cos, std::acos; const auto pi{acos(T{-1})}; const auto omega{sqrt(kx * kx + ky * ky + kz * kz)}; @@ -16,7 +18,8 @@ static inline auto phi(T A, T kx, T ky, T kz, T t, T x, T y, } template -static inline auto Pi(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Pi(T A, T kx, T ky, T kz, T t, T x, + T y, T z) noexcept -> T { using std::sqrt, std::sin, std::cos, std::acos; const auto pi{acos(T{-1})}; const auto omega{sqrt(kx * kx + ky * ky + kz * kz)}; @@ -25,7 +28,8 @@ static inline auto Pi(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Dx(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Dx(T A, T kx, T ky, T kz, T t, T x, + T y, T z) noexcept -> T { using std::sqrt, std::sin, std::cos, std::acos; const auto pi{acos(T{-1})}; const auto omega{sqrt(kx * kx + ky * ky + kz * kz)}; @@ -34,7 +38,8 @@ static inline auto Dx(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Dy(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Dy(T A, T kx, T ky, T kz, T t, T x, + T y, T z) noexcept -> T { using std::sqrt, std::sin, std::cos, std::acos; const auto pi{acos(T{-1})}; const auto omega{sqrt(kx * kx + ky * ky + kz * kz)}; @@ -43,7 +48,8 @@ static inline auto Dy(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { } template -static inline auto Dz(T A, T kx, T ky, T kz, T t, T x, T y, T z) noexcept -> T { +static inline auto CCTK_HOST CCTK_DEVICE Dz(T A, T kx, T ky, T kz, T t, T x, + T y, T z) noexcept -> T { using std::sqrt, std::sin, std::cos, std::acos; const auto pi{acos(T{-1})}; const auto omega{sqrt(kx * kx + ky * ky + kz * kz)};