Fix clang tidy warnings in CUDA build
authorSzilárd Páll <pall.szilard@gmail.com>
Thu, 22 Aug 2019 11:01:17 +0000 (13:01 +0200)
committerSzilárd Páll <pall.szilard@gmail.com>
Fri, 23 Aug 2019 11:31:10 +0000 (13:31 +0200)
Tested with clang 7 on a build with clang for both host and device code.

Change-Id: Ie2be427ae63f90f4eec4e79cc85da3ab13fcfe4a

src/gromacs/gpu_utils/gpu_utils.h
src/gromacs/gpu_utils/tests/pinnedmemorychecker.cpp
src/gromacs/nbnxm/nbnxm_gpu.h

index ea9241b9004aa13b3d7b1dae1dc3a5a86637d12d..b0e6d86615b4c70030c2dca98f732448e753021b 100644 (file)
@@ -194,7 +194,7 @@ gmx_device_info_t *getDeviceInfo(const gmx_gpu_info_t &GPU_FUNC_ARGUMENT(gpu_inf
  * \returns                 device ID of the GPU in use at the time of the call
  */
 CUDA_FUNC_QUALIFIER
-int get_current_cuda_gpu_device_id(void) CUDA_FUNC_TERM_WITH_RETURN(-1);
+int get_current_cuda_gpu_device_id() CUDA_FUNC_TERM_WITH_RETURN(-1);
 
 /*! \brief Formats and returns a device information string for a given GPU.
  *
@@ -240,7 +240,7 @@ bool buildSupportsNonbondedOnGpu(std::string *error);
  *  Note that this is implemented only for the CUDA API.
  */
 CUDA_FUNC_QUALIFIER
-void startGpuProfiler(void) CUDA_FUNC_TERM;
+void startGpuProfiler() CUDA_FUNC_TERM;
 
 
 /*! \brief Resets the GPU profiler if mdrun is being profiled.
@@ -254,7 +254,7 @@ void startGpuProfiler(void) CUDA_FUNC_TERM;
  * Note that this is implemented only for the CUDA API.
  */
 CUDA_FUNC_QUALIFIER
-void resetGpuProfiler(void) CUDA_FUNC_TERM;
+void resetGpuProfiler() CUDA_FUNC_TERM;
 
 
 /*! \brief Stops the CUDA profiler if mdrun is being profiled.
@@ -266,7 +266,7 @@ void resetGpuProfiler(void) CUDA_FUNC_TERM;
  *  Note that this is implemented only for the CUDA API.
  */
 CUDA_FUNC_QUALIFIER
-void stopGpuProfiler(void) CUDA_FUNC_TERM;
+void stopGpuProfiler() CUDA_FUNC_TERM;
 
 //! Tells whether the host buffer was pinned for non-blocking transfers. Only implemented for CUDA.
 CUDA_FUNC_QUALIFIER
index fb64ead7c108d39dcac412fd98839d3bcbaea6a7..16beb2b85e1bd7687f9dbaa4717349c350bd9790 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2017,2018, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -120,11 +120,11 @@ TEST_F(PinnedMemoryCheckerTest, PinnedCBufferIsRecognized)
     }
 
     real *dummy = nullptr;
-    pmalloc((void **)&dummy, 3 * sizeof(real));
+    pmalloc(reinterpret_cast<void **>(&dummy), 3 * sizeof(real));
     EXPECT_TRUE(isHostMemoryPinned(dummy));
     pfree(dummy);
 }
 
 } // namespace
-} // namespace
-} // namespace
+} // namespace test
+} // namespace gmx
index 46b1dc4c506e0b56a423a683adf24cac49193aaa..ba3b9a8f52778b067baf6fd2ce3e7cf59310beef 100644 (file)
@@ -237,7 +237,7 @@ void nbnxn_gpu_x_to_nbat_x(const Nbnxm::Grid  gmx_unused &grid,
  */
 CUDA_FUNC_QUALIFIER
 void nbnxnInsertNonlocalGpuDependency(const gmx_nbnxn_gpu_t gmx_unused    *nb,
-                                      const InteractionLocality gmx_unused interactionLocality) CUDA_FUNC_TERM;
+                                      InteractionLocality   gmx_unused interactionLocality) CUDA_FUNC_TERM;
 
 /*! \brief Set up internal flags that indicate what type of short-range work there is.
  *
@@ -277,7 +277,7 @@ void nbnxn_gpu_init_add_nbat_f_to_f(const int               gmx_unused *cell,
 
 /*! \brief F buffer operations on GPU: adds nb format force to rvec format. */
 CUDA_FUNC_QUALIFIER
-void nbnxn_gpu_add_nbat_f_to_f(const AtomLocality           gmx_unused  atomLocality,
+void nbnxn_gpu_add_nbat_f_to_f(AtomLocality                 gmx_unused  atomLocality,
                                gmx_nbnxn_gpu_t              gmx_unused *gpu_nbv,
                                void                         gmx_unused *fPmeDevicePtr,
                                GpuEventSynchronizer         gmx_unused *pmeForcesReady,
@@ -288,21 +288,21 @@ void nbnxn_gpu_add_nbat_f_to_f(const AtomLocality           gmx_unused  atomLoca
 
 /*! \brief Copy force buffer from CPU to GPU */
 CUDA_FUNC_QUALIFIER
-void nbnxn_launch_copy_f_to_gpu(const AtomLocality      gmx_unused  atomLocality,
+void nbnxn_launch_copy_f_to_gpu(AtomLocality            gmx_unused  atomLocality,
                                 const Nbnxm::GridSet    gmx_unused &gridSet,
                                 gmx_nbnxn_gpu_t         gmx_unused *nb,
                                 rvec                    gmx_unused *f) CUDA_FUNC_TERM;
 
 /*! \brief Copy force buffer from GPU to CPU */
 CUDA_FUNC_QUALIFIER
-void nbnxn_launch_copy_f_from_gpu(const AtomLocality      gmx_unused  atomLocality,
+void nbnxn_launch_copy_f_from_gpu(AtomLocality            gmx_unused  atomLocality,
                                   const Nbnxm::GridSet    gmx_unused &gridSet,
                                   gmx_nbnxn_gpu_t         gmx_unused *nb,
                                   rvec                    gmx_unused *f) CUDA_FUNC_TERM;
 
 /*! \brief Wait for GPU stream to complete */
 CUDA_FUNC_QUALIFIER
-void nbnxn_wait_for_gpu_force_reduction(const AtomLocality      gmx_unused  atomLocality,
+void nbnxn_wait_for_gpu_force_reduction(AtomLocality            gmx_unused  atomLocality,
                                         gmx_nbnxn_gpu_t         gmx_unused *nb) CUDA_FUNC_TERM;