Skip to content

Commit

Permalink
Small fix in getGlobalBin (#75)
Browse files Browse the repository at this point in the history
* Small fix in getGlobalBin

* Update version

* Formatting
  • Loading branch information
sbaldu authored Jan 13, 2025
1 parent 4d5eee0 commit 3979d95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions include/CLUEstering/DataFormats/alpaka/TilesAlpaka.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,20 +74,23 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE_CLUE {
template <typename TAcc>
ALPAKA_FN_HOST_ACC inline constexpr int getGlobalBin(
const TAcc& acc, const VecArray<float, Ndim>& coords) const {
int globalBin{getBin(acc, coords[0], 0)};
for (int i{1}; i != Ndim; ++i) {
globalBin += n_tiles_per_dim * getBin(acc, coords[i], i);
int globalBin = 0;
for (int dim = 0; dim != Ndim - 1; ++dim) {
globalBin += alpaka::math::pow(acc, n_tiles_per_dim, Ndim - dim - 1) *
getBin(acc, coords[dim], dim);
}
globalBin += getBin(acc, coords[Ndim - 1], Ndim - 1);
return globalBin;
}

template <typename TAcc>
ALPAKA_FN_HOST_ACC inline constexpr int getGlobalBinByBin(
const TAcc&, const VecArray<uint32_t, Ndim>& Bins) const {
uint32_t globalBin{Bins[0]};
for (int i{1}; i != Ndim; ++i) {
globalBin += n_tiles_per_dim * Bins[i];
const TAcc& acc, const VecArray<uint32_t, Ndim>& Bins) const {
uint32_t globalBin = 0;
for (int dim = 0; dim != Ndim - 1; ++dim) {
globalBin += alpaka::math::pow(acc, n_tiles_per_dim, Ndim - dim - 1) * Bins[dim];
}
globalBin += Bins[Ndim - 1];
return globalBin;
}

Expand Down
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.3.2.1"
__version__ = "2.3.3"

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

0 comments on commit 3979d95

Please sign in to comment.