2 # This file is part of the GROMACS molecular simulation package.
4 # Copyright (c) 2013,2014,2015,2016,2017 The GROMACS development team.
5 # Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
6 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
7 # and including many others, as listed in the AUTHORS file in the
8 # top-level source directory and at http://www.gromacs.org.
10 # GROMACS is free software; you can redistribute it and/or
11 # modify it under the terms of the GNU Lesser General Public License
12 # as published by the Free Software Foundation; either version 2.1
13 # of the License, or (at your option) any later version.
15 # GROMACS is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 # Lesser General Public License for more details.
20 # You should have received a copy of the GNU Lesser General Public
21 # License along with GROMACS; if not, see
22 # http://www.gnu.org/licenses, or write to the Free Software Foundation,
23 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 # If you want to redistribute modifications to GROMACS, please
26 # consider that scientific software is very special. Version
27 # control is crucial - bugs must be traceable. We will be happy to
28 # consider code for inclusion in the official distribution, but
29 # derived work must not be called official GROMACS. Details are found
30 # in the README & COPYING files - if they are missing, get the
31 # official version at http://www.gromacs.org.
33 # To help us fund GROMACS development, we humbly ask that you cite
34 # the research papers on the package. Check out http://www.gromacs.org.
36 # Make a static library for test infrastructure code that we re-use
37 # in multiple test executables across the repository.
38 gmx_add_unit_test_library(mdrun_test_infrastructure
42 simulatorcomparison.cpp
44 trajectorycomparison.cpp
46 # pseudo-library for code for mdrun
47 $<TARGET_OBJECTS:mdrun_objlib>
49 target_include_directories(mdrun_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
50 target_link_libraries(mdrun_test_infrastructure PUBLIC legacy_api utility)
52 # To avoid running into test timeouts, some end-to-end tests of mdrun
53 # functionality are split off. This can be rearranged in future as we
55 set(testname "MdrunOutputTests")
56 set(exename "mdrun-output-test")
58 gmx_add_gtest_executable(${exename}
60 compressed_x_output.cpp
63 trajectory_writing.cpp
64 # pseudo-library for code for mdrun
65 $<TARGET_OBJECTS:mdrun_objlib>
67 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
68 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
70 set(testname "MdrunModulesTests")
71 set(exename "mdrun-modules-test")
73 gmx_add_gtest_executable(${exename}
75 densityfittingmodule.cpp
78 # pseudo-library for code for mdrun
79 $<TARGET_OBJECTS:mdrun_objlib>
81 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
82 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
84 set(testname "MdrunIOTests")
85 set(exename "mdrun-io-test")
87 gmx_add_gtest_executable(${exename}
92 initialconstraints.cpp
94 # pseudo-library for code for mdrun
95 $<TARGET_OBJECTS:mdrun_objlib>
97 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
98 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
100 # To avoid running into test timeouts, some end-to-end tests of mdrun
101 # functionality are split off. This can be rearranged in future as we
103 set(testname "MdrunTests")
104 set(exename "mdrun-test")
106 gmx_add_gtest_executable(${exename}
109 multiple_time_stepping.cpp
112 tabulated_bonded_interactions.cpp
114 constantacceleration.cpp
115 # pseudo-library for code for mdrun
116 $<TARGET_OBJECTS:mdrun_objlib>
118 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
119 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
122 set(testname "MdrunPmeTests")
123 set(exename "mdrun-pme-test")
125 gmx_add_gtest_executable(${exename}
128 # pseudo-library for code for mdrun
129 $<TARGET_OBJECTS:mdrun_objlib>
131 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
132 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
135 set(testname "MdrunNonIntegratorTests")
136 set(exename "mdrun-non-integrator-test")
138 gmx_add_gtest_executable(${exename}
140 # files with code for tests
146 # pseudo-library for code for mdrun
147 $<TARGET_OBJECTS:mdrun_objlib>
149 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
150 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
152 # TPI does not support OpenMP, so we need a separate test binary
153 set(testname "MdrunTpiTests")
154 set(exename "mdrun-tpi-test")
156 gmx_add_gtest_executable(${exename}
158 # files with code for tests
160 # pseudo-library for code for mdrun
161 $<TARGET_OBJECTS:mdrun_objlib>
163 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
164 gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST IGNORE_LEAKS)
166 # Tests that only make sense to run with multiple ranks and/or real
167 # MPI are implemented here.
168 set(testname "MdrunMpiTests")
169 set(exename "mdrun-mpi-test")
171 gmx_add_gtest_executable(${exename} MPI
173 # files with code for tests
174 domain_decomposition.cpp
178 # pseudo-library for code for mdrun
179 $<TARGET_OBJECTS:mdrun_objlib>
181 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
182 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
184 # Multi sim only makes sense with real MPI, and ideally at least 4 ranks,
185 # to allow for multiple simulations (>= 2 sims) each using DD (>= 2 ranks per sim)
186 set(testname "MdrunMultiSimTests")
187 set(exename "mdrun-multisim-test")
189 gmx_add_gtest_executable(${exename} MPI
191 # files with code for tests
194 # pseudo-library for code for mdrun
195 $<TARGET_OBJECTS:mdrun_objlib>
197 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
198 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 4 INTEGRATION_TEST IGNORE_LEAKS)
200 set(testname "MdrunMultiSimReplexTests")
201 set(exename "mdrun-multisim-replex-test")
203 gmx_add_gtest_executable(${exename} MPI
205 # files with code for tests
208 # pseudo-library for code for mdrun
209 $<TARGET_OBJECTS:mdrun_objlib>
211 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
212 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 4 INTEGRATION_TEST IGNORE_LEAKS)
214 set(testname "MdrunMultiSimReplexEquivalenceTests")
215 set(exename "mdrun-multisim-replex-equivalence-test")
217 gmx_add_gtest_executable(${exename} MPI
219 # files with code for tests
221 replicaexchange_equivalence.cpp
222 # pseudo-library for code for mdrun
223 $<TARGET_OBJECTS:mdrun_objlib>
225 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
226 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 4 INTEGRATION_TEST IGNORE_LEAKS)
228 # Tests that only make sense to run with multiple ranks and/or real
229 # MPI are implemented here. Special case for slow PME tests
230 set(testname "MdrunMpiPmeTests")
231 set(exename "mdrun-mpi-pme-test")
233 gmx_add_gtest_executable(${exename} MPI
235 # files with code for tests
237 # pseudo-library for code for mdrun
238 $<TARGET_OBJECTS:mdrun_objlib>
240 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
241 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
243 # Slow-running tests that target testing multiple-rank coordination behaviors
244 # These tests are extremely slow without optimization or OpenMP, so only run them for
245 # build types like Release or RelWithDebInfo and if the build has been configured
246 # with OpenMP enabled
247 set(exename "mdrun-mpi-coordination-basic-test")
248 gmx_add_gtest_executable(${exename} MPI
250 # files with code for tests
252 periodicactions_basic.cpp
253 # pseudo-library for code for mdrun
254 $<TARGET_OBJECTS:mdrun_objlib>
256 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
258 if (CMAKE_BUILD_TYPE MATCHES "Rel" AND GMX_OPENMP)
259 set(testname "MdrunMpiCoordinationBasicTestsOneRank")
260 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 1 SLOW_TEST IGNORE_LEAKS)
261 set(testname "MdrunMpiCoordinationBasicTestsTwoRanks")
262 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 SLOW_TEST IGNORE_LEAKS)
265 set(exename "mdrun-mpi-coordination-coupling-test")
266 gmx_add_gtest_executable(${exename} MPI
268 # files with code for tests
270 periodicactions_coupling.cpp
271 # pseudo-library for code for mdrun
272 $<TARGET_OBJECTS:mdrun_objlib>
274 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
276 if (CMAKE_BUILD_TYPE MATCHES "Rel" AND GMX_OPENMP)
277 set(testname "MdrunMpiCoordinationCouplingTestsOneRank")
278 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 1 SLOW_TEST IGNORE_LEAKS)
279 set(testname "MdrunMpiCoordinationCouplingTestsTwoRanks")
280 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 SLOW_TEST IGNORE_LEAKS)
283 set(exename "mdrun-mpi-coordination-constraints-test")
284 gmx_add_gtest_executable(${exename} MPI
286 # files with code for tests
288 periodicactions_constraints.cpp
289 # pseudo-library for code for mdrun
290 $<TARGET_OBJECTS:mdrun_objlib>
292 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
294 if (CMAKE_BUILD_TYPE MATCHES "Rel" AND GMX_OPENMP)
295 set(testname "MdrunMpiCoordinationConstraintsTestsOneRank")
296 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 1 SLOW_TEST IGNORE_LEAKS)
297 set(testname "MdrunMpiCoordinationConstraintsTestsTwoRanks")
298 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 SLOW_TEST IGNORE_LEAKS)
301 # Keeping the FEP tests separate for now to be able to judge runtime more easily
302 # Can be included in mdrun tests later
303 set(testname "MdrunFEPTests")
304 set(exename "mdrun-fep-test")
306 gmx_add_gtest_executable(${exename}
308 # files with code for tests
310 # pseudo-library for code for mdrun
311 $<TARGET_OBJECTS:mdrun_objlib>
313 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
314 # TODO: Link specific modules: topology
316 # End-to-end test for pull functionality
317 target_link_libraries(${exename} PRIVATE legacy_modules)
318 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
319 set(testname "MdrunPullTests")
320 set(exename "mdrun-pull-test")
322 gmx_add_gtest_executable(${exename}
324 # files with code for tests
326 # pseudo-library for code for mdrun
327 $<TARGET_OBJECTS:mdrun_objlib>
329 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
330 target_link_libraries(${exename} PRIVATE legacy_modules)
331 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
333 # End-to-end tests comparing different simulator code paths
334 set(testname "MdrunSimulatorComparison")
335 set(exename "mdrun-simulator-comparison-test")
337 gmx_add_gtest_executable(${exename}
339 # files with code for tests
341 # pseudo-library for code for mdrun
342 $<TARGET_OBJECTS:mdrun_objlib>
344 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
345 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
347 # Tests checking virtual sites - we want to run them with multiple ranks
348 set(testname "MdrunVirtualSiteTests")
349 set(exename "mdrun-vsites-test")
351 gmx_add_gtest_executable(${exename} MPI
353 # files with code for tests
355 # pseudo-library for code for mdrun
356 $<TARGET_OBJECTS:mdrun_objlib>
358 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
359 gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 INTEGRATION_TEST IGNORE_LEAKS)