diff --git a/HeterogeneousTest/AlpakaDevice/README.md b/HeterogeneousTest/AlpakaDevice/README.md index 4815e1a1f0200..53f44a6ec7305 100644 --- a/HeterogeneousTest/AlpakaDevice/README.md +++ b/HeterogeneousTest/AlpakaDevice/README.md @@ -12,15 +12,13 @@ Alpaka-based libraries, and using them from multiple plugins. The package `HeterogeneousTest/AlpakaDevice` implements a library that defines and exports Alpaka device-side functions: ```c++ -namespace cms::alpakatest { +namespace ALPAKA_ACCELERATOR_NAMESPACE::test { - template - ALPAKA_FN_ACC void add_vectors_f(TAcc const& acc, ...); + inline ALPAKA_FN_ACC void add_vectors_f(Acc1D const& acc, ...) { ... } - template - ALPAKA_FN_ACC void add_vectors_d(TAcc const& acc, ...); + inline ALPAKA_FN_ACC void add_vectors_d(Acc1D const& acc, ...) { ... } -} // namespace cms::alpakatest +} // namespace ALPAKA_ACCELERATOR_NAMESPACE::test ``` The `plugins` directory implements the `AlpakaTestDeviceAdditionModule` `EDAnalyzer` that launches diff --git a/HeterogeneousTest/AlpakaDevice/interface/alpaka/DeviceAddition.h b/HeterogeneousTest/AlpakaDevice/interface/alpaka/DeviceAddition.h index 9a38952b2c2b1..a9e6d6589a9a1 100644 --- a/HeterogeneousTest/AlpakaDevice/interface/alpaka/DeviceAddition.h +++ b/HeterogeneousTest/AlpakaDevice/interface/alpaka/DeviceAddition.h @@ -5,32 +5,31 @@ #include +#include "HeterogeneousCore/AlpakaInterface/interface/config.h" #include "HeterogeneousCore/AlpakaInterface/interface/workdivision.h" -namespace cms::alpakatest { +namespace ALPAKA_ACCELERATOR_NAMESPACE::test { - template - ALPAKA_FN_ACC void add_vectors_f(TAcc const& acc, - float const* __restrict__ in1, - float const* __restrict__ in2, - float* __restrict__ out, - uint32_t size) { + inline ALPAKA_FN_ACC void add_vectors_f(Acc1D const& acc, + float const* __restrict__ in1, + float const* __restrict__ in2, + float* __restrict__ out, + uint32_t size) { for (auto i : cms::alpakatools::uniform_elements(acc, size)) { out[i] = in1[i] + in2[i]; } } - template - ALPAKA_FN_ACC void add_vectors_d(TAcc const& acc, - double const* __restrict__ in1, - double const* __restrict__ in2, - double* __restrict__ out, - uint32_t size) { + inline ALPAKA_FN_ACC void add_vectors_d(Acc1D const& acc, + double const* __restrict__ in1, + double const* __restrict__ in2, + double* __restrict__ out, + uint32_t size) { for (auto i : cms::alpakatools::uniform_elements(acc, size)) { out[i] = in1[i] + in2[i]; } } -} // namespace cms::alpakatest +} // namespace ALPAKA_ACCELERATOR_NAMESPACE::test #endif // HeterogeneousTest_AlpakaDevice_interface_alpaka_DeviceAddition_h diff --git a/HeterogeneousTest/AlpakaDevice/plugins/alpaka/AlpakaTestDeviceAdditionAlgo.dev.cc b/HeterogeneousTest/AlpakaDevice/plugins/alpaka/AlpakaTestDeviceAdditionAlgo.dev.cc index e8e899e354ac1..b28c94b9ef271 100644 --- a/HeterogeneousTest/AlpakaDevice/plugins/alpaka/AlpakaTestDeviceAdditionAlgo.dev.cc +++ b/HeterogeneousTest/AlpakaDevice/plugins/alpaka/AlpakaTestDeviceAdditionAlgo.dev.cc @@ -11,13 +11,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::HeterogeneousTestAlpakaDevicePlugins { struct KernelAddVectorsF { - template - ALPAKA_FN_ACC void operator()(TAcc const& acc, + ALPAKA_FN_ACC void operator()(Acc1D const& acc, const float* __restrict__ in1, const float* __restrict__ in2, float* __restrict__ out, uint32_t size) const { - cms::alpakatest::add_vectors_f(acc, in1, in2, out, size); + test::add_vectors_f(acc, in1, in2, out, size); } }; diff --git a/HeterogeneousTest/AlpakaDevice/test/alpaka/testDeviceAddition.dev.cc b/HeterogeneousTest/AlpakaDevice/test/alpaka/testDeviceAddition.dev.cc index b73cd5b74279c..7e017b9ea0bc9 100644 --- a/HeterogeneousTest/AlpakaDevice/test/alpaka/testDeviceAddition.dev.cc +++ b/HeterogeneousTest/AlpakaDevice/test/alpaka/testDeviceAddition.dev.cc @@ -16,13 +16,12 @@ using namespace ALPAKA_ACCELERATOR_NAMESPACE; struct KernelAddVectorsF { - template - ALPAKA_FN_ACC void operator()(TAcc const& acc, + ALPAKA_FN_ACC void operator()(Acc1D const& acc, const float* __restrict__ in1, const float* __restrict__ in2, float* __restrict__ out, uint32_t size) const { - cms::alpakatest::add_vectors_f(acc, in1, in2, out, size); + test::add_vectors_f(acc, in1, in2, out, size); } }; diff --git a/HeterogeneousTest/AlpakaKernel/README.md b/HeterogeneousTest/AlpakaKernel/README.md index fd87ed2cf0d01..956d62498b043 100644 --- a/HeterogeneousTest/AlpakaKernel/README.md +++ b/HeterogeneousTest/AlpakaKernel/README.md @@ -12,19 +12,17 @@ Alpaka-based libraries, and using them from multiple plugins. The package `HeterogeneousTest/AlpakaKernel` implements a library that defines and exports Alpaka kernels that call the device functions defined in the `HeterogeneousTest/AlpakaDevice` library: ```c++ -namespace cms::alpakatest { +namespace ALPAKA_ACCELERATOR_NAMESPACE::test { struct KernelAddVectorsF { - template - ALPAKA_FN_ACC void operator()(TAcc const& acc, ...) const; + ALPAKA_FN_ACC void operator()(Acc1D const& acc, ...) const { ... } }; struct KernelAddVectorsD { - template - ALPAKA_FN_ACC void operator()(TAcc const& acc, ...) const; + ALPAKA_FN_ACC void operator()(Acc1D const& acc, ...) const { ... } }; -} // namespace cms::alpakatest +} // namespace ALPAKA_ACCELERATOR_NAMESPACE::test ``` The `plugins` directory implements the `AlpakaTestKernelAdditionModule` `EDAnalyzer` that launches diff --git a/HeterogeneousTest/AlpakaKernel/interface/alpaka/DeviceAdditionKernel.h b/HeterogeneousTest/AlpakaKernel/interface/alpaka/DeviceAdditionKernel.h index 43d99270e32b8..7f1907e5eb067 100644 --- a/HeterogeneousTest/AlpakaKernel/interface/alpaka/DeviceAdditionKernel.h +++ b/HeterogeneousTest/AlpakaKernel/interface/alpaka/DeviceAdditionKernel.h @@ -5,13 +5,13 @@ #include +#include "HeterogeneousCore/AlpakaInterface/interface/config.h" #include "HeterogeneousTest/AlpakaDevice/interface/alpaka/DeviceAddition.h" -namespace cms::alpakatest { +namespace ALPAKA_ACCELERATOR_NAMESPACE::test { struct KernelAddVectorsF { - template - ALPAKA_FN_ACC void operator()(TAcc const& acc, + ALPAKA_FN_ACC void operator()(Acc1D const& acc, const float* __restrict__ in1, const float* __restrict__ in2, float* __restrict__ out, @@ -21,8 +21,7 @@ namespace cms::alpakatest { }; struct KernelAddVectorsD { - template - ALPAKA_FN_ACC void operator()(TAcc const& acc, + ALPAKA_FN_ACC void operator()(Acc1D const& acc, const double* __restrict__ in1, const double* __restrict__ in2, double* __restrict__ out, @@ -31,6 +30,6 @@ namespace cms::alpakatest { } }; -} // namespace cms::alpakatest +} // namespace ALPAKA_ACCELERATOR_NAMESPACE::test #endif // HeterogeneousTest_AlpakaKernel_interface_alpaka_DeviceAdditionKernel_h diff --git a/HeterogeneousTest/AlpakaKernel/plugins/alpaka/AlpakaTestKernelAdditionAlgo.dev.cc b/HeterogeneousTest/AlpakaKernel/plugins/alpaka/AlpakaTestKernelAdditionAlgo.dev.cc index 0cf8caa3769c9..083029cf2e3a2 100644 --- a/HeterogeneousTest/AlpakaKernel/plugins/alpaka/AlpakaTestKernelAdditionAlgo.dev.cc +++ b/HeterogeneousTest/AlpakaKernel/plugins/alpaka/AlpakaTestKernelAdditionAlgo.dev.cc @@ -16,7 +16,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::HeterogeneousTestAlpakaKernelPlugins { float* __restrict__ out, uint32_t size) { alpaka::exec( - queue, cms::alpakatools::make_workdiv(32, 32), cms::alpakatest::KernelAddVectorsF{}, in1, in2, out, size); + queue, cms::alpakatools::make_workdiv(32, 32), test::KernelAddVectorsF{}, in1, in2, out, size); } } // namespace ALPAKA_ACCELERATOR_NAMESPACE::HeterogeneousTestAlpakaKernelPlugins diff --git a/HeterogeneousTest/AlpakaKernel/test/alpaka/testDeviceAdditionKernel.dev.cc b/HeterogeneousTest/AlpakaKernel/test/alpaka/testDeviceAdditionKernel.dev.cc index 14b4f7f520640..814d632b2dfba 100644 --- a/HeterogeneousTest/AlpakaKernel/test/alpaka/testDeviceAdditionKernel.dev.cc +++ b/HeterogeneousTest/AlpakaKernel/test/alpaka/testDeviceAdditionKernel.dev.cc @@ -68,7 +68,7 @@ TEST_CASE("HeterogeneousTest/AlpakaKernel test", "[alpakaTestDeviceAdditionKerne // launch the 1-dimensional kernel for vector addition alpaka::exec(queue, cms::alpakatools::make_workdiv(32, 32), - cms::alpakatest::KernelAddVectorsF{}, + test::KernelAddVectorsF{}, in1_d.data(), in2_d.data(), out_d.data(), diff --git a/HeterogeneousTest/AlpakaWrapper/src/alpaka/DeviceAdditionWrapper.dev.cc b/HeterogeneousTest/AlpakaWrapper/src/alpaka/DeviceAdditionWrapper.dev.cc index b5f662fc930c9..f4f6950ff77e0 100644 --- a/HeterogeneousTest/AlpakaWrapper/src/alpaka/DeviceAdditionWrapper.dev.cc +++ b/HeterogeneousTest/AlpakaWrapper/src/alpaka/DeviceAdditionWrapper.dev.cc @@ -14,8 +14,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::test { const float* __restrict__ in2, float* __restrict__ out, uint32_t size) { - alpaka::exec( - queue, cms::alpakatools::make_workdiv(32, 32), cms::alpakatest::KernelAddVectorsF{}, in1, in2, out, size); + alpaka::exec(queue, cms::alpakatools::make_workdiv(32, 32), KernelAddVectorsF{}, in1, in2, out, size); } void wrapper_add_vectors_d(Queue& queue, @@ -23,8 +22,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE::test { const double* __restrict__ in2, double* __restrict__ out, uint32_t size) { - alpaka::exec( - queue, cms::alpakatools::make_workdiv(32, 32), cms::alpakatest::KernelAddVectorsD{}, in1, in2, out, size); + alpaka::exec(queue, cms::alpakatools::make_workdiv(32, 32), KernelAddVectorsD{}, in1, in2, out, size); } } // namespace ALPAKA_ACCELERATOR_NAMESPACE::test