Skip to content

Commit

Permalink
Merge pull request #40809 from fwyzard/Alpaka_updates_13.0.x
Browse files Browse the repository at this point in the history
Minor improvements to Alpaka tests [13.0.x]
  • Loading branch information
cmsbuild authored Feb 19, 2023
2 parents 983f424 + 150d6d1 commit b9e392b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
16 changes: 8 additions & 8 deletions HeterogeneousCore/AlpakaInterface/test/alpaka/testKernel.dev.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ TEST_CASE("Standard checks of " ALPAKA_TYPE_ALIAS_NAME(alpakaTestKernel), s_tag)
// buffer size
constexpr size_t size = 1024 * 1024;

// allocate input and output host buffers
auto in1_h = cms::alpakatools::make_host_buffer<float[]>(size);
auto in2_h = cms::alpakatools::make_host_buffer<float[]>(size);
auto out_h = cms::alpakatools::make_host_buffer<float[]>(size);
// allocate input and output host buffers in pinned memory accessible by the Platform devices
auto in1_h = cms::alpakatools::make_host_buffer<float[], Platform>(size);
auto in2_h = cms::alpakatools::make_host_buffer<float[], Platform>(size);
auto out_h = cms::alpakatools::make_host_buffer<float[], Platform>(size);

// fill the input buffers with random data, and the output buffer with zeros
for (size_t i = 0; i < size; ++i) {
Expand Down Expand Up @@ -158,10 +158,10 @@ TEST_CASE("Standard checks of " ALPAKA_TYPE_ALIAS_NAME(alpakaTestKernel3D), s_ta
constexpr Vec3D ndsize = {50, 125, 16};
constexpr size_t size = ndsize.prod();

// allocate input and output host buffers
auto in1_h = cms::alpakatools::make_host_buffer<float[]>(size);
auto in2_h = cms::alpakatools::make_host_buffer<float[]>(size);
auto out_h = cms::alpakatools::make_host_buffer<float[]>(size);
// allocate input and output host buffers in pinned memory accessible by the Platform devices
auto in1_h = cms::alpakatools::make_host_buffer<float[], Platform>(size);
auto in2_h = cms::alpakatools::make_host_buffer<float[], Platform>(size);
auto out_h = cms::alpakatools::make_host_buffer<float[], Platform>(size);

// fill the input buffers with random data, and the output buffer with zeros
for (size_t i = 0; i < size; ++i) {
Expand Down
2 changes: 1 addition & 1 deletion HeterogeneousCore/AlpakaTest/interface/AlpakaESTestData.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace cms::alpakatools {
// of that activity (which has nothing to do with the memory here).
auto dstBuffer = cms::alpakatools::make_device_buffer<int[]>(queue, srcData.size());
alpaka::memcpy(queue, dstBuffer, srcData.buffer());
return cms::alpakatest::AlpakaESTestDataB<typename alpaka::trait::DevType<TQueue>::type>(std::move(dstBuffer));
return cms::alpakatest::AlpakaESTestDataB<alpaka::Dev<TQueue>>(std::move(dstBuffer));
}
};
} // namespace cms::alpakatools
Expand Down
6 changes: 3 additions & 3 deletions HeterogeneousCore/AlpakaTest/plugins/TestAlpakaAnalyzer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDAnalyzer.h"
#include "FWCore/Framework/interface/global/EDAnalyzer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
Expand Down Expand Up @@ -73,14 +73,14 @@ namespace {

} // namespace

class TestAlpakaAnalyzer : public edm::stream::EDAnalyzer<> {
class TestAlpakaAnalyzer : public edm::global::EDAnalyzer<> {
public:
TestAlpakaAnalyzer(edm::ParameterSet const& config)
: source_{config.getParameter<edm::InputTag>("source")},
token_{consumes(source_)},
expectSize_(config.getParameter<int>("expectSize")) {}

void analyze(edm::Event const& event, edm::EventSetup const&) override {
void analyze(edm::StreamID sid, edm::Event const& event, edm::EventSetup const&) const override {
portabletest::TestHostCollection const& product = event.get(token_);
auto const& view = product.const_view();
auto& mview = product.view();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
#include "FWCore/Utilities/interface/StreamID.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/Event.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/EventSetup.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/stream/EDProducer.h"
#include "HeterogeneousCore/AlpakaCore/interface/alpaka/global/EDProducer.h"
#include "HeterogeneousCore/AlpakaInterface/interface/config.h"

#include "TestAlgo.h"

namespace ALPAKA_ACCELERATOR_NAMESPACE {

class TestAlpakaProducer : public stream::EDProducer<> {
class TestAlpakaProducer : public global::EDProducer<> {
public:
TestAlpakaProducer(edm::ParameterSet const& config)
: deviceToken_{produces()}, size_{config.getParameter<int32_t>("size")} {}

void produce(device::Event& event, device::EventSetup const&) override {
void produce(edm::StreamID sid, device::Event& event, device::EventSetup const&) const override {
// run the algorithm, potentially asynchronously
portabletest::TestDeviceCollection deviceProduct{size_, event.queue()};
algo_.fill(event.queue(), deviceProduct);
Expand Down
1 change: 0 additions & 1 deletion HeterogeneousCore/AlpakaTest/test/writer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import FWCore.ParameterSet.Config as cms
from HeterogeneousCore.CUDACore.SwitchProducerCUDA import SwitchProducerCUDA

process = cms.Process('Writer')

Expand Down

0 comments on commit b9e392b

Please sign in to comment.