2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2018,2019, 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.
35 /*! \libinternal \file
36 * \brief Declares step, domain-lifetime, and run workload managers.
38 * \author Mark Abraham <mark.j.abraham@gmail.com>
39 * \author Szilárd Páll <pall.szilard@gmail.com>
40 * \ingroup module_mdlib
43 #ifndef GMX_MDTYPES_SIMULATION_WORKLOAD_H
44 #define GMX_MDTYPES_SIMULATION_WORKLOAD_H
50 * \brief Describes work done on this domain that may change per-step.
52 * This work description is based on the SimulationWorkload in the context of the
53 * current particle interactions assigned to this domain as well as other
54 * factors that may change during the lifetime of a domain.
56 * Note that the contents of an object of this type is valid for
57 * a single step and it is expected to be set at the beginning each step.
59 * The initial set of flags map the legacy force flags to boolean flags;
60 * these have the role of directing per-step compute tasks undertaken by a PP rank.
66 //! Whether the state has changed, always set unless TPI is used.
67 bool stateChanged
= false;
68 //! Whether the box might have changed
69 bool haveDynamicBox
= false;
70 //! Whether neighbor searching needs to be done this step
71 bool doNeighborSearch
= false;
72 //! Whether virial needs to be computed this step
73 bool computeVirial
= false;
74 //! Whether energies need to be computed this step this step
75 bool computeEnergy
= false;
76 //! Whether (any) forces need to be computed this step, not only energies
77 bool computeForces
= false;
78 //! Whether nonbonded forces need to be computed this step
79 bool computeNonbondedForces
= false;
80 //! Whether listed forces need to be computed this step
81 bool computeListedForces
= false;
82 //! Whether this step DHDL needs to be computed
83 bool computeDhdl
= false;
84 /*! \brief Whether coordinate buffer ops are done on the GPU this step
85 * \note This technically belongs to DomainLifetimeWorkload but due
86 * to needing the flag before DomainLifetimeWorkload is built we keep
89 bool useGpuXBufferOps
= false;
90 //! Whether force buffer ops are done on the GPU this step
91 bool useGpuFBufferOps
= false;
92 //! Whether PME forces are reduced with other contributions on the GPU this step
93 bool useGpuPmeFReduction
= false; // TODO: add this flag to the internal PME GPU data structures too
97 * \brief Describes work done on this domain on every step of its lifetime,
98 * but which might change after the next domain paritioning.
100 * This work description is based on the SimulationWorkload in the context of the
101 * current particle interactions assigned to this domain. The latter might change
102 * after the next domain partitioning.
104 * An object of this type is updated every domain decomposition / neighbour search step
105 * and reflects what work is required during the lifetime of a domain;
106 * e.g. whether there are bonded interactions in this PP task.
109 class DomainLifetimeWorkload
112 //! Whether the current nstlist step-range has bonded work to run on a GPU.
113 bool haveGpuBondedWork
= false;
114 //! Whether the current nstlist step-range has bonded work to run on he CPU.
115 bool haveCpuBondedWork
= false;
116 //! Whether the current nstlist step-range has restraints work to run on he CPU.
117 bool haveRestraintsWork
= false;
118 //! Whether the current nstlist step-range has listed forces work to run on he CPU.
119 // Note: currently this is haveCpuBondedWork | haveRestraintsWork
120 bool haveCpuListedForceWork
= false;
121 //! Whether the current nstlist step-range has special forces on the CPU.
122 bool haveSpecialForces
= false;
123 //! Whether there are currently any local forces to be computed on the CPU
124 bool haveCpuLocalForceWork
= false;
126 //! Whether the current nstlist step-range Free energy work on the CPU.
127 bool haveFreeEnergyWork
= false;
131 * \brief Manage what computation is required during the simulation.
133 * Holds information on the type of workload constant for the entire
136 * An object of this type is constructed at the beginning of the
137 * simulation and is expected to not change.
139 class SimulationWorkload
142 //! If we have calculation of short range nonbondeds on CPU
143 bool useCpuNonbonded
= false;
144 //! If we have calculation of short range nonbondeds on GPU
145 bool useGpuNonbonded
= false;
146 //! If we have calculation of long range PME in GPU
147 bool useCpuPme
= false;
148 //! If we have calculation of long range PME in GPU
149 bool useGpuPme
= false;
150 //! If PME FFT solving is done on GPU.
151 bool useGpuPmeFft
= false;
152 //! If bonded interactions are calculated on GPU.
153 bool useGpuBonded
= false;
154 //! If update and constraint solving is performed on GPU.
155 bool useGpuUpdate
= false;
156 //! If buffer operations are performed on GPU.
157 bool useGpuBufferOps
= false;
158 //! If domain decomposition halo exchange is performed on GPU.
159 bool useGpuHaloExchange
= false;
160 //! If direct PP-PME communication between GPU is used.
161 bool useGpuPmePpCommunication
= false;
162 //! If direct GPU-GPU communication is enabled.
163 bool useGpuDirectCommunication
= false;
164 //! If there is an Ewald surface (dipole) term to compute
165 bool haveEwaldSurfaceContribution
= false;
168 class MdrunScheduleWorkload
171 //! Workload descriptor for information constant for an entire run
172 SimulationWorkload simulationWork
;
174 //! Workload descriptor for information constant for an nstlist range of steps
175 DomainLifetimeWorkload domainWork
;
177 //! Workload descriptor for information that may change per-step
178 StepWorkload stepWork
;
183 #endif // GMX_MDTYPES_SIMULATION_WORKLOAD_H