2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2018, 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.
37 * \brief Top-level file for generating PME OpenCL kernels.
38 * This file includes all the PME OpenCL kernel files multiple times, with additional defines.
39 * Plenty of common constants/macros are also expected to be already defined by the compiler
40 * (such as "order" which is PME interpolation order).
41 * For details, please see how pme-program.cl is compiled in pme-gpu-program-impl-ocl.cpp.
43 * This file specifically expects the following work size definitions:
45 * - c_spreadWorkGroupSize is a spline/spread kernels work group size.
46 * - c_solveMaxWorkGroupSize is a solve kernels maximum work group size.
47 * - c_gatherWorkGroupSize is a gather kernels work group size.
49 * \author Aleksei Iupinov <a.yupinov@gmail.com>
52 // Assert placeholders, to not rip them out from OpenCL implementation - hopefully they come in handy some day with OpenCL 2
53 #define static_assert(a, b)
56 #define PmeOpenCLKernelParams PmeGpuKernelParamsBase
60 #define atomsPerBlock (c_spreadWorkGroupSize / threadsPerAtom)
62 // spline/spread fused
63 #define computeSplines 1
64 #define spreadCharges 1
65 #define CUSTOMIZED_KERNEL_NAME(x) pmeSplineAndSpreadKernel
66 #include "pme-spread.clh"
69 #undef CUSTOMIZED_KERNEL_NAME
72 #define computeSplines 1
73 #define spreadCharges 0
74 #define CUSTOMIZED_KERNEL_NAME(x) pmeSplineKernel
75 #include "pme-spread.clh"
78 #undef CUSTOMIZED_KERNEL_NAME
81 #define computeSplines 0
82 #define spreadCharges 1
83 #define CUSTOMIZED_KERNEL_NAME(x) pmeSpreadKernel
84 #include "pme-spread.clh"
87 #undef CUSTOMIZED_KERNEL_NAME
95 #define atomsPerBlock (c_gatherWorkGroupSize / threadsPerAtom)
98 #define overwriteForces 1
99 #define CUSTOMIZED_KERNEL_NAME(x) pmeGatherKernel
100 #include "pme-gather.clh"
101 #undef overwriteForces
102 #undef CUSTOMIZED_KERNEL_NAME
104 // gather with reduction
105 #define overwriteForces 0
106 #define CUSTOMIZED_KERNEL_NAME(x) pmeGatherReduceWithInputKernel
107 #include "pme-gather.clh"
108 #undef overwriteForces
109 #undef CUSTOMIZED_KERNEL_NAME
116 // GridOrdering enum replacement
120 // solve, YZX dimension order
121 #define gridOrdering YZX
122 #define computeEnergyAndVirial 0
123 #define CUSTOMIZED_KERNEL_NAME(x) pmeSolveYZXKernel
124 #include "pme-solve.clh"
126 #undef computeEnergyAndVirial
127 #undef CUSTOMIZED_KERNEL_NAME
129 // solve with reduction, YZX dimension order
130 #define gridOrdering YZX
131 #define computeEnergyAndVirial 1
132 #define CUSTOMIZED_KERNEL_NAME(x) pmeSolveYZXEnergyKernel
133 #include "pme-solve.clh"
135 #undef computeEnergyAndVirial
136 #undef CUSTOMIZED_KERNEL_NAME
138 // solve, XYZ dimension order
139 #define gridOrdering XYZ
140 #define computeEnergyAndVirial 0
141 #define CUSTOMIZED_KERNEL_NAME(x) pmeSolveXYZKernel
142 #include "pme-solve.clh"
144 #undef computeEnergyAndVirial
145 #undef CUSTOMIZED_KERNEL_NAME
147 // solve with reduction, XYZ dimension order
148 #define gridOrdering XYZ
149 #define computeEnergyAndVirial 1
150 #define CUSTOMIZED_KERNEL_NAME(x) pmeSolveXYZEnergyKernel
151 #include "pme-solve.clh"
153 #undef computeEnergyAndVirial
154 #undef CUSTOMIZED_KERNEL_NAME