2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2019,2020, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
38 * \brief Declares working data structures for the CPU and GPU pairlists
40 * \author Berk Hess <hess@kth.se>
42 * \ingroup module_nbnxm
45 #ifndef GMX_NBNXM_PAIRLISTWORK_H
46 #define GMX_NBNXM_PAIRLISTWORK_H
51 #include "gromacs/simd/simd.h"
53 #include "boundingboxes.h"
57 //! Working data for the actual i-supercell during pair search \internal
58 struct NbnxnPairlistCpuWork
60 //! Struct for storing coordinats and bounding box for an i-entry during search \internal
65 x(c_nbnxnCpuIClusterSize * DIM),
66 xSimd(c_nbnxnCpuIClusterSize * DIM * GMX_REAL_MAX_SIMD_WIDTH)
70 //! The bounding boxes, pbc shifted, for each cluster
71 AlignedVector<Nbnxm::BoundingBox> bb;
72 //! The coordinates, pbc shifted, for each atom
74 //! Aligned list for storing 4*DIM*GMX_SIMD_REAL_WIDTH reals
75 AlignedVector<real> xSimd;
78 //! Protect data from cache pollution between threads
79 gmx_cache_protect_t cp0;
81 //! Work data for generating an IEntry in the pairlist
82 IClusterData iClusterData;
83 //! The current cj_ind index for the current list
85 //! Temporary j-cluster list, used for sorting on exclusions
86 std::vector<nbnxn_cj_t> cj;
88 //! Nr. of cluster pairs without Coulomb for flop counting
90 //! Nr. of cluster pairs with 1/2 LJ for flop count
93 //! Protect data from cache pollution between threads
94 gmx_cache_protect_t cp1;
97 /* Working data for the actual i-supercell during pair search */
98 struct NbnxnPairlistGpuWork
100 struct ISuperClusterData
102 ISuperClusterData() :
103 bb(c_gpuNumClusterPerCell),
104 #if NBNXN_SEARCH_BB_SIMD4
105 bbPacked(c_gpuNumClusterPerCell / c_packedBoundingBoxesDimSize * c_packedBoundingBoxesSize),
107 x(c_gpuNumClusterPerCell * c_nbnxnGpuClusterSize * DIM),
108 xSimd(c_gpuNumClusterPerCell * c_nbnxnGpuClusterSize * DIM)
112 //! The bounding boxes, pbc shifted, for each cluster
113 AlignedVector<Nbnxm::BoundingBox> bb;
114 //! As bb, but in packed xxxx format
115 AlignedVector<float> bbPacked;
116 //! The coordinates, pbc shifted, for each atom
117 AlignedVector<real> x;
118 //! Aligned coordinate list used for 4*DIM*GMX_SIMD_REAL_WIDTH floats
119 AlignedVector<real> xSimd;
122 NbnxnPairlistGpuWork() :
123 distanceBuffer(c_gpuNumClusterPerCell),
124 sci_sort({}, { gmx::PinningPolicy::PinnedIfSupported })
128 //! Protect data from cache pollution between threads
129 gmx_cache_protect_t cp0;
131 //! Work data for generating an i-entry in the pairlist
132 ISuperClusterData iSuperClusterData;
133 //! The current j-cluster index for the current list
135 //! Bounding box distance work array
136 AlignedVector<float> distanceBuffer;
138 //! Buffer for sorting list entries
139 std::vector<int> sortBuffer;
141 //! Second sci array, for sorting
142 gmx::HostVector<nbnxn_sci_t> sci_sort;
144 //! Protect data from cache pollution between threads
145 gmx_cache_protect_t cp1;