2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 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.
36 /*! \libinternal \file
38 * This file declares functions for setting up kernel benchmarks
40 * \author Berk Hess <hess@kth.se>
43 * \ingroup module_nbnxm
46 #ifndef GMX_NBNXN_BENCH_SETUP_H
47 #define GMX_NBNXN_BENCH_SETUP_H
49 #include "gromacs/utility/real.h"
54 //! Enum for selecting the SIMD kernel type for benchmarks
55 enum class BenchMarkKernels : int
64 //! Enum for selecting the combination rule for kernel benchmarks
65 enum class BenchMarkCombRule : int
73 //! Enum for selecting coulomb type for kernel benchmarks
74 enum class BenchMarkCoulomb : int
82 * The options for the kernel benchmarks
84 struct KernelBenchOptions
86 //! Whether to use a GPU, currently GPUs are not supported
88 //! The number of OpenMP threads to use
90 //! The SIMD type for the kernel
91 BenchMarkKernels nbnxmSimd = BenchMarkKernels::SimdAuto;
92 //! The LJ combination rule
93 BenchMarkCombRule ljCombinationRule = BenchMarkCombRule::RuleGeom;
94 //! Use i-cluster half-LJ optimization for clusters with <= half LJ
95 bool useHalfLJOptimization = false;
96 //! The pairlist and interaction cut-off
97 real pairlistCutoff = 1.0;
98 //! The Coulomb Ewald coefficient
99 real ewaldcoeff_q = 0;
100 //! Whether to compute energies (shift forces for virial are always computed on CPU)
101 bool computeVirialAndEnergy = false;
102 //! The Coulomb interaction function
103 BenchMarkCoulomb coulombType = BenchMarkCoulomb::Pme;
104 //! Whether to use tabulated PME grid correction instead of analytical, not applicable with simd=no
105 bool useTabulatedEwaldCorr = false;
106 //! Whether to run all combinations of Coulomb type, combination rule and SIMD
108 //! Number of iterations to run before running each kernel benchmark, currently always 1
109 int numPreIterations = 1;
110 //! The number of iterations for each kernel
111 int numIterations = 100;
112 //! The number of (untimed) iterations to run at startup to warm up the CPU
113 int numWarmupIterations = 0;
114 //! Print cycles/pair instead of pairs/cycle
115 bool cyclesPerPair = false;
119 * Sets up and runs one or more Nbnxm kernel benchmarks
121 * The simulated system is a box of 1000 SPC/E water molecules scaled
122 * by the factor \p sizeFactor, which has to be a power of 2.
123 * One or more benchmarks are run, as specified by \p options.
124 * Benchmark settings and timings are printed to stdout.
126 * \param[in] sizeFactor How much should the system size be increased.
127 * \param[in] options How the benchmark will be run.
129 void bench(int sizeFactor, const KernelBenchOptions& options);