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

add support for wrapped coordinates #80

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AuroraPerego
Copy link
Contributor

No description provided.

@@ -37,11 +37,11 @@
}

// use a custom deleter to destroy all objects and deallocate the memory
auto deleter = [size](Allocator* ptr) {
auto deleter = [size](Allocator* pointer) {

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 13.1 rule Note

MISRA 13.1 rule
for (size_t i = size; i > 0; --i) {
(ptr + i - 1)->~Allocator();
(pointer + i - 1)->~Allocator();

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
for (size_t i = size; i > 0; --i) {
(ptr + i - 1)->~Allocator();
(pointer + i - 1)->~Allocator();

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 10.4 rule Note

MISRA 10.4 rule

ALPAKA_FN_HOST_ACC inline constexpr float normalizeCoordinate(float coord, int dim) const {
const float range = min_max.range(dim);
float remainder = coord - static_cast<int>(coord / range) * range;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 10.4 rule Note

MISRA 10.4 rule
ALPAKA_FN_HOST_ACC inline constexpr float normalizeCoordinate(float coord, int dim) const {
const float range = min_max.range(dim);
float remainder = coord - static_cast<int>(coord / range) * range;
if (remainder >= min_max.max(dim))

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
float remainder = coord - static_cast<int>(coord / range) * range;
if (remainder >= min_max.max(dim))
remainder -= range;
else if (remainder < min_max.min(dim))

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
if (remainder >= min_max.max(dim))
remainder -= range;
else if (remainder < min_max.min(dim))
remainder += range;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.7 rule Note

MISRA 15.7 rule
@@ -117,6 +117,9 @@
calculate_tile_size(min_max, tile_size, h_points, nPerDim);

const auto device = alpaka::getDev(queue_);
alpaka::memcpy(queue_,

Check warning

Code scanning / Flawfinder (reported by Codacy)

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. Warning

Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data.
@@ -91,7 +91,7 @@
const auto dev_acc = alpaka::getDevByIdx(alpaka::Platform<Acc1D>{}, 0u);
Queue queue_(dev_acc);

PointsSoA<2> h_points(coords.data(), results.data(), PointShape<2>{n_points});
PointsSoA<2> h_points(coords.data(), results.data(), PointInfo<2>{n_points, {0, 0}});

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
@@ -19,7 +19,7 @@
const auto dev_acc = alpaka::getDevByIdx(alpaka::Platform<Acc1D>{}, 0u);
Queue queue_(dev_acc);

PointsSoA<2> h_points(coords.data(), results.data(), PointShape<2>{n_points});
PointsSoA<2> h_points(coords.data(), results.data(), PointInfo<2>{n_points, {0, 0}});

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
@@ -117,6 +117,9 @@
calculate_tile_size(min_max, tile_size, h_points, nPerDim);

const auto device = alpaka::getDev(queue_);
alpaka::memcpy(queue_,
clue::make_device_view(device, (*d_tiles)->wrapped(), Ndim),
clue::make_host_view(h_points.wrapped(), Ndim));

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note

MISRA 12.3 rule
m_view->coords = floatBuffer;
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim;
m_view->weights = floatBuffer + m_info.nPoints * Ndim;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
m_view->coords = floatBuffer;
m_view->weights = floatBuffer + m_shape.nPoints * m_shape.nDim;
m_view->weights = floatBuffer + m_info.nPoints * Ndim;

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 18.4 rule Note

MISRA 18.4 rule
dim_sb.push_back_unsafe(getBin(acc, sb_extremes[dim][1], dim));
auto infBin = getBin(acc, sb_extremes[dim][0], dim);
auto supBin = getBin(acc, sb_extremes[dim][1], dim);
if (m_wrapped[dim] and infBin > supBin)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.1 rule Note

MISRA 12.1 rule
dim_sb.push_back_unsafe(getBin(acc, sb_extremes[dim][1], dim));
auto infBin = getBin(acc, sb_extremes[dim][0], dim);
auto supBin = getBin(acc, sb_extremes[dim][1], dim);
if (m_wrapped[dim] and infBin > supBin)

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
ALPAKA_FN_ACC inline float distance(const float* coord_i, const float* coord_j) {
float dist_sq = 0.f;
for (int dim = 0; dim != Ndim; ++dim) {
if (m_wrapped[dim])

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 14.4 rule Note

MISRA 14.4 rule
ALPAKA_FN_ACC inline float distance(const float* coord_i, const float* coord_j) {
float dist_sq = 0.f;
for (int dim = 0; dim != Ndim; ++dim) {
if (m_wrapped[dim])

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 15.6 rule Note

MISRA 15.6 rule
@@ -12,7 +12,7 @@
const auto ndim = 2;
std::vector<float> floatBuffer(3 * n);
std::vector<int> intBuffer(2 * n);
PointsSoA<2> points(floatBuffer.data(), intBuffer.data(), PointShape<2>{n});
PointsSoA<2> points(floatBuffer.data(), intBuffer.data(), PointInfo<2>{n, {0, 0}});

Check notice

Code scanning / Cppcheck (reported by Codacy)

MISRA 12.3 rule Note test

MISRA 12.3 rule
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant