Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix seeds container for CUDA backend #66

Merged
merged 5 commits into from
Nov 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions CLUEstering/alpaka/CLUE/CLUEAlgoAlpaka.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "../DataFormats/Points.h"
#include "../DataFormats/alpaka/PointsAlpaka.h"
#include "../DataFormats/alpaka/TilesAlpaka.h"
#include "../DataFormats/alpaka/Vector.h"
#include "CLUEAlpakaKernels.h"
#include "ConvolutionalKernel.h"

Expand All @@ -35,7 +34,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
}

TilesAlpaka<Ndim>* m_tiles;
clue::Vector<int32_t>* m_seeds;
VecArray<int32_t, reserve>* m_seeds;
VecArray<int32_t, max_followers>* m_followers;

template <typename KernelType>
Expand All @@ -56,8 +55,8 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {

// Buffers
std::optional<cms::alpakatools::device_buffer<Device, TilesAlpaka<Ndim>>> d_tiles;
std::optional<cms::alpakatools::device_buffer<Device, int32_t[]>> d_seeds;
std::optional<cms::alpakatools::device_buffer<Device, clue::Vector<int32_t>>> seeds;
std::optional<cms::alpakatools::device_buffer<Device, VecArray<int32_t, reserve>>>
d_seeds;
std::optional<cms::alpakatools::device_buffer<
Device,
cms::alpakatools::VecArray<int32_t, max_followers>[]>>
Expand Down Expand Up @@ -108,17 +107,14 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
template <typename TAcc, uint8_t Ndim>
void CLUEAlgoAlpaka<TAcc, Ndim>::init_device(Queue queue_) {
d_tiles = cms::alpakatools::make_device_buffer<TilesAlpaka<Ndim>>(queue_);
d_seeds = cms::alpakatools::make_device_buffer<int32_t[]>(queue_, reserve);
d_followers = cms::alpakatools::make_device_buffer<
cms::alpakatools::VecArray<int32_t, max_followers>[]>(queue_, reserve);

seeds = cms::alpakatools::make_device_buffer<clue::Vector<int32_t>>(queue_);
// resize the seeds vector
(*seeds)->resize((*d_seeds).data(), reserve);
d_seeds = cms::alpakatools::make_device_buffer<VecArray<int32_t, reserve>>(queue_);
d_followers =
cms::alpakatools::make_device_buffer<VecArray<int32_t, max_followers>[]>(queue_,
reserve);

// Copy to the public pointers
m_tiles = (*d_tiles).data();
m_seeds = (*seeds).data();
m_seeds = (*d_seeds).data();
m_followers = (*d_followers).data();
}

Expand Down Expand Up @@ -221,7 +217,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
const Idx grid_size_seeds = cms::alpakatools::divide_up_by(reserve, block_size);
auto working_div_seeds =
cms::alpakatools::make_workdiv<Acc1D>(grid_size_seeds, block_size);

alpaka::enqueue(queue_,
alpaka::createTaskKernel<Acc1D>(working_div_seeds,
KernelAssignClusters<Ndim>{},
Expand Down
5 changes: 2 additions & 3 deletions CLUEstering/alpaka/CLUE/CLUEAlpakaKernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "../DataFormats/alpaka/PointsAlpaka.h"
#include "../DataFormats/alpaka/TilesAlpaka.h"
#include "../DataFormats/alpaka/AlpakaVecArray.h"
#include "../DataFormats/alpaka/Vector.h"
#include "ConvolutionalKernel.h"

using cms::alpakatools::VecArray;
Expand Down Expand Up @@ -278,7 +277,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
struct KernelFindClusters {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
clue::Vector<int32_t>* seeds,
VecArray<int32_t, reserve>* seeds,
VecArray<int32_t, max_followers>* followers,
PointsView<Ndim>* dev_points,
float dm,
Expand Down Expand Up @@ -313,7 +312,7 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE {
struct KernelAssignClusters {
template <typename TAcc>
ALPAKA_FN_ACC void operator()(const TAcc& acc,
clue::Vector<int32_t>* seeds,
VecArray<int32_t, reserve>* seeds,
VecArray<int, max_followers>* followers,
PointsView<Ndim>* dev_points) const {
const auto& seeds_0{*seeds};
Expand Down
85 changes: 0 additions & 85 deletions CLUEstering/alpaka/DataFormats/alpaka/Vector.h

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup
import subprocess

__version__ = "2.2.10"
__version__ = "2.2.11"

this_directory = Path(__file__).parent
long_description = (this_directory/'README.md').read_text()
Expand Down
Loading