Stop nbnxm/grid.h depending on SIMD module
authorMark Abraham <mark.j.abraham@gmail.com>
Thu, 15 Aug 2019 12:49:30 +0000 (14:49 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 16 Aug 2019 09:29:30 +0000 (11:29 +0200)
Only part of the NBNXM module has a SIMD dependence, and this reduces
the size of it.

Change-Id: I1376e9f1b30b436453582bdabc65efd185a66b33

docs/doxygen/suppressions.txt
src/gromacs/nbnxm/boundingboxes.h [new file with mode: 0644]
src/gromacs/nbnxm/grid.cpp
src/gromacs/nbnxm/grid.h
src/gromacs/nbnxm/pairlist.cpp
src/gromacs/nbnxm/pairlistwork.h

index b055948a41f382363e204c2ddd1e61e118cca82c..ed336d10c8b1203e273e4caf029ee07330eb03db 100644 (file)
@@ -19,7 +19,7 @@ src/gromacs/ewald/pme_simd4.h: warning: should include "pme_simd.h"
 src/gromacs/ewald/pme_spline_work.cpp: warning: includes "simd.h" unnecessarily
 src/gromacs/ewald/pme_spline_work.h: warning: includes "simd.h" unnecessarily
 src/gromacs/ewald/pme_spread.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/nbnxm/grid.h: warning: includes "simd.h" unnecessarily
+src/gromacs/nbnxm/boundingboxes.h: warning: includes "simd.h" unnecessarily
 src/gromacs/nbnxm/kernels_simd_2xmm/kernel_inner.h: warning: should include "simd.h"
 src/gromacs/nbnxm/kernels_simd_2xmm/kernel_outer.h: warning: should include "simd.h"
 src/gromacs/nbnxm/kernels_simd_4xm/kernel_inner.h: warning: should include "simd.h"
diff --git a/src/gromacs/nbnxm/boundingboxes.h b/src/gromacs/nbnxm/boundingboxes.h
new file mode 100644 (file)
index 0000000..6ebba22
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 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.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+
+/*! \internal \file
+ *
+ * \brief Declares constants and helper functions used when handling
+ * bounding boxes for clusters of particles.
+ *
+ * \author Berk Hess <hess@kth.se>
+ * \ingroup module_nbnxm
+ */
+
+#ifndef GMX_NBNXM_BOUNDINGBOXES_H
+#define GMX_NBNXM_BOUNDINGBOXES_H
+
+#include "gromacs/simd/simd.h"
+
+namespace Nbnxm
+{
+
+/*! \brief The number of bounds along one dimension of a bounding box */
+static constexpr int c_numBoundingBoxBounds1D = 2;
+
+} // namespace Nbnxm
+
+#ifndef DOXYGEN
+
+/* Bounding box calculations are (currently) always in single precision, so
+ * we only need to check for single precision support here.
+ * This uses less (cache-)memory and SIMD is faster, at least on x86.
+ */
+#if GMX_SIMD4_HAVE_FLOAT
+#    define NBNXN_SEARCH_BB_SIMD4      1
+#else
+#    define NBNXN_SEARCH_BB_SIMD4      0
+#endif
+
+
+#if NBNXN_SEARCH_BB_SIMD4
+/* Always use 4-wide SIMD for bounding box calculations */
+
+#    if !GMX_DOUBLE
+/* Single precision BBs + coordinates, we can also load coordinates with SIMD */
+#        define NBNXN_SEARCH_SIMD4_FLOAT_X_BB  1
+#    else
+#        define NBNXN_SEARCH_SIMD4_FLOAT_X_BB  0
+#    endif
+
+/* Store bounding boxes corners as quadruplets: xxxxyyyyzzzz
+ *
+ * The packed bounding box coordinate stride is always set to 4.
+ * With AVX we could use 8, but that turns out not to be faster.
+ */
+#    define NBNXN_BBXXXX  1
+
+//! The number of bounding boxes in a pack, also the size of a pack along one dimension
+static constexpr int c_packedBoundingBoxesDimSize = GMX_SIMD4_WIDTH;
+
+//! Total number of corners (floats) in a pack of bounding boxes
+static constexpr int c_packedBoundingBoxesSize    =
+    c_packedBoundingBoxesDimSize*DIM*Nbnxm::c_numBoundingBoxBounds1D;
+
+//! Returns the starting index of the bounding box pack that contains the given cluster
+static constexpr inline int packedBoundingBoxesIndex(int clusterIndex)
+{
+    return (clusterIndex/c_packedBoundingBoxesDimSize)*c_packedBoundingBoxesSize;
+}
+
+#else  /* NBNXN_SEARCH_BB_SIMD4 */
+
+#    define NBNXN_SEARCH_SIMD4_FLOAT_X_BB  0
+#    define NBNXN_BBXXXX                   0
+
+#endif /* NBNXN_SEARCH_BB_SIMD4 */
+
+#endif // !DOXYGEN
+
+#endif
index c69a9e8ac46128fe391ca196fb6ab67cc15af9f7..a20cf1249ee008f539c8ed473c74d0323331f69c 100644 (file)
@@ -61,6 +61,7 @@
 #include "gromacs/simd/simd.h"
 #include "gromacs/simd/vector_operations.h"
 
+#include "boundingboxes.h"
 #include "gridsetdata.h"
 #include "pairlistparams.h"
 
index a57d3ad684b692448d4459a09498908a6187d52c..5387b8c271467491c95ab80691b2f321e11cf240 100644 (file)
 
 #include "gromacs/gpu_utils/hostallocator.h"
 #include "gromacs/math/vectypes.h"
-#include "gromacs/simd/simd.h"
 #include "gromacs/utility/alignedallocator.h"
 #include "gromacs/utility/arrayref.h"
 
-
 struct gmx_domdec_zones_t;
 struct nbnxn_atomdata_t;
 struct nbnxn_search;
@@ -153,63 +151,8 @@ struct BoundingBox1D
     float upper; //!< upper bound
 };
 
-/*! \brief The number of bounds along one dimension of a bounding box */
-static constexpr int c_numBoundingBoxBounds1D = 2;
-
 } // namespace Nbnxm
 
-#ifndef DOXYGEN
-
-/* Bounding box calculations are (currently) always in single precision, so
- * we only need to check for single precision support here.
- * This uses less (cache-)memory and SIMD is faster, at least on x86.
- */
-#if GMX_SIMD4_HAVE_FLOAT
-#    define NBNXN_SEARCH_BB_SIMD4      1
-#else
-#    define NBNXN_SEARCH_BB_SIMD4      0
-#endif
-
-
-#if NBNXN_SEARCH_BB_SIMD4
-/* Always use 4-wide SIMD for bounding box calculations */
-
-#    if !GMX_DOUBLE
-/* Single precision BBs + coordinates, we can also load coordinates with SIMD */
-#        define NBNXN_SEARCH_SIMD4_FLOAT_X_BB  1
-#    else
-#        define NBNXN_SEARCH_SIMD4_FLOAT_X_BB  0
-#    endif
-
-/* Store bounding boxes corners as quadruplets: xxxxyyyyzzzz
- *
- * The packed bounding box coordinate stride is always set to 4.
- * With AVX we could use 8, but that turns out not to be faster.
- */
-#    define NBNXN_BBXXXX  1
-
-//! The number of bounding boxes in a pack, also the size of a pack along one dimension
-static constexpr int c_packedBoundingBoxesDimSize = GMX_SIMD4_WIDTH;
-
-//! Total number of corners (floats) in a pack of bounding boxes
-static constexpr int c_packedBoundingBoxesSize    =
-    c_packedBoundingBoxesDimSize*DIM*Nbnxm::c_numBoundingBoxBounds1D;
-
-//! Returns the starting index of the bouding box pack that contains the given cluster
-static constexpr inline int packedBoundingBoxesIndex(int clusterIndex)
-{
-    return (clusterIndex/c_packedBoundingBoxesDimSize)*c_packedBoundingBoxesSize;
-}
-
-#else  /* NBNXN_SEARCH_BB_SIMD4 */
-
-#    define NBNXN_SEARCH_SIMD4_FLOAT_X_BB  0
-#    define NBNXN_BBXXXX                   0
-
-#endif /* NBNXN_SEARCH_BB_SIMD4 */
-
-#endif // !DOXYGEN
-
 namespace Nbnxm
 {
 
index de0a081d517062cf2acb5411699e7d8809f07456..6059f157665f39ed60ffcf0777cb3fe3ae67596d 100644 (file)
@@ -67,6 +67,7 @@
 #include "gromacs/utility/gmxomp.h"
 #include "gromacs/utility/smalloc.h"
 
+#include "boundingboxes.h"
 #include "clusterdistancekerneltype.h"
 #include "gridset.h"
 #include "pairlistset.h"
index 8716632010d19fa82321800e00cdd62dcd9a6050..77dc96e7c16e05f70b0eb8e60fab0e02e8976223 100644 (file)
@@ -51,6 +51,7 @@
 #include "gromacs/nbnxm/pairlist.h"
 #include "gromacs/simd/simd.h"
 
+#include "boundingboxes.h"
 #include "grid.h"
 
 /* Working data for the actual i-supercell during pair search */