-
Notifications
You must be signed in to change notification settings - Fork 12
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
base: main
Are you sure you want to change the base?
Conversation
@@ -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
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
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
|
||
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
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
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
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
4b4e84f
to
25924f2
Compare
@@ -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
@@ -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
@@ -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
@@ -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
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
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
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
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
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
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
@@ -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
0d5d8f9
to
f6859f2
Compare
f6859f2
to
b87767f
Compare
No description provided.