7 #include <hip/hip_runtime.h> 34 : size_(
config.getParameter<uint32_t>(
"size")) {}
38 desc.add<uint32_t>(
"size", 1024 * 1024);
47 if (not rocm
or not rocm->enabled()) {
48 std::cout <<
"The ROCmService is not available or disabled, the test will be skipped.\n";
53 std::random_device rd{};
54 std::default_random_engine rand{rd()};
55 std::normal_distribution<float> dist{0., 1.};
58 constexpr
float epsilon = 0.000001;
61 std::vector<float> in1_h(
size_);
62 std::vector<float> in2_h(
size_);
63 std::vector<float> out_h(
size_);
67 in1_h[
i] = dist(rand);
68 in2_h[
i] = dist(rand);
81 hipCheck(hipMemcpy(in1_d, in1_h.data(),
size_ *
sizeof(
float), hipMemcpyHostToDevice));
82 hipCheck(hipMemcpy(in2_d, in2_h.data(),
size_ *
sizeof(
float), hipMemcpyHostToDevice));
91 hipCheck(hipMemcpy(out_h.data(), out_d,
size_ *
sizeof(
float), hipMemcpyDeviceToHost));
98 float sum = in1_h[
i] + in2_h[
i];
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void analyze(edm::StreamID, edm::Event const &event, edm::EventSetup const &setup) const override
~ROCmTestWrapperAdditionModule() override=default
void wrapper_add_vectors_f(const float *__restrict__ in1, const float *__restrict__ in2, float *__restrict__ out, size_t size)
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
#define DEFINE_FWK_MODULE(type)
#define hipCheck(ARG,...)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
ROCmTestWrapperAdditionModule(edm::ParameterSet const &config)