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

Small refactorings in n-body benchmarks #769

Merged
merged 1 commit into from
Nov 23, 2023
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
4 changes: 2 additions & 2 deletions examples/alpaka/nbody/nbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ constexpr auto runUpate = true; // run update step. Useful to disable for benchm
constexpr auto elementsPerThread = xsimd::batch<float>::size;
constexpr auto threadsPerBlock = 1;
constexpr auto sharedElementsPerBlock = 1;
constexpr auto aosoaLanes = xsimd::batch<float>::size; // vectors
constexpr auto aosoaLanes = elementsPerThread;
#elif ANY_GPU_ENABLED
constexpr auto threadsPerBlock = 256;
constexpr auto sharedElementsPerBlock = 512;
Expand Down Expand Up @@ -144,7 +144,7 @@ LLAMA_FN_HOST_ACC_INLINE void pPInteraction(const Acc& acc, ParticleRefI& pis, P
const auto distSqr = +eps2 + dist(tag::X{}) + dist(tag::Y{}) + dist(tag::Z{});
const auto distSixth = distSqr * distSqr * distSqr;
const auto invDistCube
= allowRsqrt ? alpaka::math::rsqrt(acc, distSixth) : (1.0f / alpaka::math::sqrt(acc, distSixth));
= allowRsqrt ? alpaka::math::rsqrt(acc, distSixth) : (FP{1} / alpaka::math::sqrt(acc, distSixth));
const auto sts = (pj(tag::Mass{}) * timestep) * invDistCube;
pis(tag::Vel{}) += dist * sts;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/cuda/nbody/nbody.cu
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ __device__ void pPInteraction(ParticleRefI& pi, ParticleRefJ pj)
dist *= dist;
const FP distSqr = eps2 + dist(tag::X{}) + dist(tag::Y{}) + dist(tag::Z{});
const FP distSixth = distSqr * distSqr * distSqr;
const FP invDistCube = allowRsqrt ? rsqrt(distSixth) : (1.0f / sqrt(distSixth));
const FP invDistCube = allowRsqrt ? rsqrt(distSixth) : (FP{1} / sqrt(distSixth));
const FP sts = pj(tag::Mass{}) * invDistCube * +timestep;
pi(tag::Vel{}) += dist * sts;
}
Expand Down
Loading