From f04e7000e71473f3b56aaf52a1e90ab44f61f295 Mon Sep 17 00:00:00 2001 From: Artem Zhmurov Date: Sun, 25 Aug 2019 20:53:38 +0200 Subject: [PATCH] Make use of recent changes to prepareKernelArguments(...) Recent change allows to avoid assigning pointers to intermediate variables before passing them to prepareKernelArguments(...) functions in CUDA builds. Change-Id: I3b70d7663cbd687e9f22e0422e7baa3fcdfc1bf3 --- src/gromacs/mdlib/leapfrog_cuda.cu | 13 ++++--------- src/gromacs/mdlib/lincs_cuda.cu | 10 ++-------- src/gromacs/mdlib/settle_cuda.cu | 16 +++++----------- 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/src/gromacs/mdlib/leapfrog_cuda.cu b/src/gromacs/mdlib/leapfrog_cuda.cu index bfb3afcd6f..9feab1d438 100644 --- a/src/gromacs/mdlib/leapfrog_cuda.cu +++ b/src/gromacs/mdlib/leapfrog_cuda.cu @@ -142,18 +142,13 @@ void LeapFrogCuda::integrate(const float3 *d_x, config.stream = stream_; auto kernelPtr = leapfrog_kernel; - const float3 *gm_x = d_x; - float3 *gm_xp = d_xp; - float3 *gm_v = d_v; - const float3 *gm_f = d_f; - const float *gm_inverseMasses = d_inverseMasses_; const auto kernelArgs = prepareGpuKernelArguments(kernelPtr, config, &numAtoms_, - &gm_x, &gm_xp, - &gm_v, - &gm_f, - &gm_inverseMasses, &dt); + &d_x, &d_xp, + &d_v, + &d_f, + &d_inverseMasses_, &dt); launchGpuKernel(kernelPtr, config, nullptr, "leapfrog_kernel", kernelArgs); return; diff --git a/src/gromacs/mdlib/lincs_cuda.cu b/src/gromacs/mdlib/lincs_cuda.cu index df018e9e91..8267ad9551 100644 --- a/src/gromacs/mdlib/lincs_cuda.cu +++ b/src/gromacs/mdlib/lincs_cuda.cu @@ -480,16 +480,10 @@ void LincsCuda::apply(const float3 *d_x, } config.stream = stream_; - // This is to satisfy prepareGpuKernelArguments(...) - // It there a better way? - const float3 * gm_x = d_x; - float3 * gm_xp = d_xp; - float3 * gm_v = d_v; - const auto kernelArgs = prepareGpuKernelArguments(kernelPtr, config, &kernelParams_, - &gm_x, &gm_xp, - &gm_v, &invdt); + &d_x, &d_xp, + &d_v, &invdt); launchGpuKernel(kernelPtr, config, nullptr, "lincs_kernel", kernelArgs); diff --git a/src/gromacs/mdlib/settle_cuda.cu b/src/gromacs/mdlib/settle_cuda.cu index 633ec90177..5fa583fad8 100644 --- a/src/gromacs/mdlib/settle_cuda.cu +++ b/src/gromacs/mdlib/settle_cuda.cu @@ -455,22 +455,16 @@ void SettleCuda::apply(const float3 *d_x, } config.stream = stream_; - const int3 *gm_atomIds = d_atomIds_; - const float3 *gm_x = d_x; - float3 *gm_xp = d_xp; - float3 *gm_v = d_v; - float *gm_virialScaled = d_virialScaled_; - const auto kernelArgs = prepareGpuKernelArguments(kernelPtr, config, &numSettles_, - &gm_atomIds, + &d_atomIds_, &settleParameters_, - &gm_x, - &gm_xp, + &d_x, + &d_xp, &pbcAiuc_, &invdt, - &gm_v, - &gm_virialScaled); + &d_v, + &d_virialScaled_); launchGpuKernel(kernelPtr, config, nullptr, "settle_kernel", kernelArgs); -- 2.11.4.GIT