6 #include <alpaka/alpaka.hpp> 37 : size_(
config.getParameter<uint32_t>(
"size")) {}
41 desc.add<uint32_t>(
"size", 1024 * 1024);
58 <<
" is not available or disabled, the test will be skipped.\n";
63 std::random_device rd{};
64 std::default_random_engine rand{rd()};
65 std::normal_distribution<float> dist{0., 1.};
71 std::vector<float> in1_h(
size_);
72 std::vector<float> in2_h(
size_);
73 std::vector<float> out_h(
size_);
76 for (uint32_t
i = 0;
i <
size_; ++
i) {
77 in1_h[
i] = dist(rand);
78 in2_h[
i] = dist(rand);
83 for (
auto const& device : cms::alpakatools::devices<Platform>()) {
87 auto in1_d = cms::alpakatools::make_device_buffer<float[]>(
queue,
size_);
88 auto in2_d = cms::alpakatools::make_device_buffer<float[]>(
queue,
size_);
89 auto out_d = cms::alpakatools::make_device_buffer<float[]>(
queue,
size_);
98 alpaka::memset(
queue, out_d, 0);
102 queue, in1_d.data(), in2_d.data(), out_d.data(),
size_);
105 alpaka::memcpy(
queue, out_h, out_d);
111 for (uint32_t
i = 0;
i <
size_; ++
i) {
112 float sum = in1_h[
i] + in2_h[
i];
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ALPAKA_ACCELERATOR_NAMESPACE::Queue Queue
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
void analyze(edm::StreamID, edm::Event const &event, edm::EventSetup const &setup) const override
~AlpakaTestDeviceAdditionModule() override=default
AlpakaTestDeviceAdditionModule(edm::ParameterSet const &config)
#define DEFINE_FWK_ALPAKA_MODULE(name)
void wrapper_add_vectors_f(Queue &queue, const float *__restrict__ in1, const float *__restrict__ in2, float *__restrict__ out, uint32_t size)