Initialize rollingPruningNumParts in init_plist
authorAndrey Alekseenko <al42and@gmail.com>
Wed, 3 Feb 2021 17:15:31 +0000 (17:15 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Wed, 3 Feb 2021 17:15:31 +0000 (17:15 +0000)
Previously, rollingPruningNumParts and rollingPruningPart were not
initialized, which, in the case of an empty domain, caused access
to uninitialized memory. No particular harm was being done, but it
could trigger an assertion in gpu_launch_kernel_pruneonly during
some of the regression tests.

The whole code in the preamble of gpu_launch_kernel_pruneonly is
probably due for refactoring, but since we initialize all other
plist's fields in init_plist, we better initialize these two as well.

cmake/gmxTestCompilerProblems.cmake
src/gromacs/nbnxm/gpu_types_common.h
src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp

index cf9c9fce2299aa26e629ee86739ad729c99f9fbb..9dc093e3930c8a2c6726be89197cae699cdab631 100644 (file)
@@ -2,7 +2,7 @@
 # This file is part of the GROMACS molecular simulation package.
 #
 # Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
-# Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2017,2018,2019,2020,2021, 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.
index 9166a3e50a2497cfedbbee4c4a09ef4de12034e5..f3c4bd385bde7140ac08150e045e1e40ef04a466 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020,2021, 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.
@@ -211,11 +211,11 @@ struct gpu_plist
     int excl_nalloc;
 
     /* parameter+variables for normal and rolling pruning */
-    //! true after search, indictes that initial pruning with outer prunning is needed
+    //! true after search, indicates that initial pruning with outer pruning is needed
     bool haveFreshList;
-    //! the number of parts/steps over which one cyle of roling pruning takes places
+    //! the number of parts/steps over which one cycle of rolling pruning takes places
     int rollingPruningNumParts;
-    //! the next part to which the roling pruning needs to be applied
+    //! the next part to which the rolling pruning needs to be applied
     int rollingPruningPart;
 };
 
index 0af6e94e6189a623768d0eb334890e2c52834b67..8c8fd338a19cf14ed8100680d1789c3713439860 100644 (file)
@@ -222,16 +222,18 @@ void init_plist(gpu_plist* pl)
     pl->excl  = nullptr;
 
     /* size -1 indicates that the respective array hasn't been initialized yet */
-    pl->na_c          = -1;
-    pl->nsci          = -1;
-    pl->sci_nalloc    = -1;
-    pl->ncj4          = -1;
-    pl->cj4_nalloc    = -1;
-    pl->nimask        = -1;
-    pl->imask_nalloc  = -1;
-    pl->nexcl         = -1;
-    pl->excl_nalloc   = -1;
-    pl->haveFreshList = false;
+    pl->na_c                   = -1;
+    pl->nsci                   = -1;
+    pl->sci_nalloc             = -1;
+    pl->ncj4                   = -1;
+    pl->cj4_nalloc             = -1;
+    pl->nimask                 = -1;
+    pl->imask_nalloc           = -1;
+    pl->nexcl                  = -1;
+    pl->excl_nalloc            = -1;
+    pl->haveFreshList          = false;
+    pl->rollingPruningNumParts = 0;
+    pl->rollingPruningPart     = 0;
 }
 
 void init_timings(gmx_wallclock_gpu_nbnxn_t* t)