#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# Test public interface.
#
-gmx_add_gtest_executable(
- gmxapi-test
- restraint.cpp
- status.cpp
- system.cpp
- version.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
- )
+gmx_add_gtest_executable(gmxapi-test
+ CPP_SOURCE_FILES
+ restraint.cpp
+ status.cpp
+ system.cpp
+ version.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
+ )
if(NOT GMX_USE_OPENCL)
# GPU resources may not be properly reinitialized between simulations in
# the same process.
# Test public interface with MPI.
#
-gmx_add_gtest_executable(
- gmxapi-mpi-test MPI
- restraint.cpp
- status.cpp
- system.cpp
- version.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
- )
+gmx_add_gtest_executable(gmxapi-mpi-test MPI
+ CPP_SOURCE_FILES
+ restraint.cpp
+ status.cpp
+ system.cpp
+ version.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
+ )
if(NOT GMX_USE_OPENCL)
# GPU resources may not be properly reinitialized between simulations in
# the same process.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-#
# Test private interface.
#
-gmx_add_gtest_executable(
- workflow-details-test
- workflow.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
+gmx_add_gtest_executable(workflow-details-test
+ CPP_SOURCE_FILES
+ workflow.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
)
target_link_libraries(workflow-details-test PRIVATE Gromacs::gmxapi gmxapi-detail mdrun_test_infrastructure)
# Test with MPI.
#
-gmx_add_gtest_executable(
- workflow-details-mpi-test MPI
- workflow.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
+gmx_add_gtest_executable(workflow-details-mpi-test MPI
+ CPP_SOURCE_FILES
+ workflow.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
)
target_link_libraries(workflow-details-mpi-test PRIVATE Gromacs::gmxapi gmxapi-detail mdrun_test_infrastructure)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2013,2014,2019, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2013,2014,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
mock_datamodule.cpp)
gmx_add_unit_test(AnalysisDataUnitTests analysisdata-test
- analysisdata.cpp
- arraydata.cpp
- average.cpp
- histogram.cpp
- lifetime.cpp)
+ CPP_SOURCE_FILES
+ analysisdata.cpp
+ arraydata.cpp
+ average.cpp
+ histogram.cpp
+ lifetime.cpp
+ )
target_link_libraries(analysisdata-test PRIVATE analysisdata-test-shared)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(AppliedForcesUnitTest applied_forces-test
- densityfitting.cpp
- densityfittingoptions.cpp
- densityfittingamplitudelookup.cpp
- electricfield.cpp
- )
+ CPP_SOURCE_FILES
+ densityfitting.cpp
+ densityfittingoptions.cpp
+ densityfittingamplitudelookup.cpp
+ electricfield.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2017, by the GROMACS development team, led by
+# Copyright (c) 2017,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(AwhTest awh-test
- bias.cpp biasstate.cpp grid.cpp)
+ CPP_SOURCE_FILES
+ bias.cpp
+ biasstate.cpp
+ grid.cpp
+ )
endif()
gmx_add_unit_test(CommandLineUnitTests commandline-test
- cmdlinehelpmodule.cpp
- cmdlinehelpwriter.cpp
- cmdlinemodulemanager.cpp
- cmdlinemodulemanagertest.cpp
- cmdlineparser.cpp
- cmdlineprogramcontext.cpp
- filenm.cpp
- pargs.cpp)
+ CPP_SOURCE_FILES
+ cmdlinehelpmodule.cpp
+ cmdlinehelpwriter.cpp
+ cmdlinemodulemanager.cpp
+ cmdlinemodulemanagertest.cpp
+ cmdlineparser.cpp
+ cmdlineprogramcontext.cpp
+ filenm.cpp
+ pargs.cpp
+ )
target_link_libraries(commandline-test PRIVATE onlinehelp-test-shared)
if (GMX_BUILD_UNITTESTS)
gmx_add_unit_test(CompatibilityHelpersTests compat-test
- optional.cpp
- pointers.cpp
- string_view.cpp
- )
+ CPP_SOURCE_FILES
+ optional.cpp
+ pointers.cpp
+ string_view.cpp
+ )
check_cxx_compiler_flag("-Wno-unused-member-function" HAS_NO_UNUSED_MEMBER_FUNCTION)
if (HAS_NO_UNUSED_MEMBER_FUNCTION)
set_source_files_properties(optional.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-member-function)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-set(test_sources
- builder.cpp
- outputadaptercontainer.cpp
- outputadapters.cpp
- requirements.cpp
- setatoms.cpp
- setbothtime.cpp
- setstarttime.cpp
- settimestep.cpp
- testmodule.cpp
- )
-gmx_add_unit_test(CoordinateIOTests coordinateio-test ${test_sources})
+gmx_add_unit_test(CoordinateIOTests coordinateio-test
+ CPP_SOURCE_FILES
+ builder.cpp
+ outputadaptercontainer.cpp
+ outputadapters.cpp
+ requirements.cpp
+ setatoms.cpp
+ setbothtime.cpp
+ setstarttime.cpp
+ settimestep.cpp
+ testmodule.cpp
+ )
+
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(CorrelationsTest correlations-test
- autocorr.cpp
- manyautocorrelation.cpp
- correlationdataset.cpp
- expfit.cpp)
+ CPP_SOURCE_FILES
+ autocorr.cpp
+ correlationdataset.cpp
+ expfit.cpp
+ manyautocorrelation.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2018, by the GROMACS development team, led by
+# Copyright (c) 2014,2018,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(DomDecTests domdec-test
- hashedmap.cpp
- localatomsetmanager.cpp)
+ CPP_SOURCE_FILES
+ hashedmap.cpp
+ localatomsetmanager.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(EnergyAnalysisUnitTests energyanalysis-test
+ CPP_SOURCE_FILES
legacyenergy.cpp
-)
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2016,2017, by the GROMACS development team, led by
+# Copyright (c) 2016,2017,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-file(GLOB EWALD_TEST_SOURCES *.cpp)
-if (GMX_USE_CUDA)
- file(GLOB EWALD_CUDA_SOURCES ../*.cu)
-endif()
-
gmx_add_unit_test(EwaldUnitTests ewald-test HARDWARE_DETECTION
- ${EWALD_TEST_SOURCES} ${EWALD_CUDA_SOURCES})
+ CPP_SOURCE_FILES
+ pmebsplinetest.cpp
+ pmegathertest.cpp
+ pmesolvetest.cpp
+ pmesplinespreadtest.cpp
+ pmetestcommon.cpp
+ testhardwarecontexts.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(FFTUnitTests fft-test
- fft.cpp)
+ CPP_SOURCE_FILES
+ fft.cpp
+ )
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-set(test_sources
- confio.cpp
- filemd5.cpp
- mrcserializer.cpp
- mrcdensitymap.cpp
- mrcdensitymapheader.cpp
- readinp.cpp
- fileioxdrserializer.cpp
- xvgio.cpp
- )
if (GMX_USE_TNG)
- list(APPEND test_sources tngio.cpp)
+ set(tng_sources tngio.cpp)
endif()
-gmx_add_unit_test(FileIOTests fileio-test ${test_sources})
+gmx_add_unit_test(FileIOTests fileio-test
+ CPP_SOURCE_FILES
+ confio.cpp
+ filemd5.cpp
+ mrcserializer.cpp
+ mrcdensitymap.cpp
+ mrcdensitymapheader.cpp
+ readinp.cpp
+ fileioxdrserializer.cpp
+ ${tng_sources}
+ xvgio.cpp
+ )
# the research papers on the package. Check out http://www.gromacs.org.
set(exename gmxana-test)
-
-gmx_add_gtest_executable(
- ${exename}
- entropy.cpp
- gmx_traj.cpp
- gmx_mindist.cpp
- gmx_msd.cpp
- )
-gmx_register_gtest_test(GmxAnaTest ${exename} INTEGRATION_TEST)
+gmx_add_gtest_executable(${exename}
+ CPP_SOURCE_FILES
+ entropy.cpp
+ gmx_traj.cpp
+ gmx_mindist.cpp
+ gmx_msd.cpp
+ )
+gmx_register_gtest_test(GmxAnaTest ${exename} INTEGRATION_TEST)
\ No newline at end of file
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2016, by the GROMACS development team, led by
+# Copyright (c) 2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(GmxlibTests gmxlib-test
+ CPP_SOURCE_FILES
)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(GmxPreprocessTests gmxpreprocess-test
- editconf.cpp
- genconf.cpp
- genion.cpp
- gpp_atomtype.cpp
- gpp_bond_atomtype.cpp
- insert_molecules.cpp
- readir.cpp
- solvate.cpp
- topdirs.cpp
- )
+ CPP_SOURCE_FILES
+ editconf.cpp
+ genconf.cpp
+ genion.cpp
+ gpp_atomtype.cpp
+ gpp_bond_atomtype.cpp
+ insert_molecules.cpp
+ readir.cpp
+ solvate.cpp
+ topdirs.cpp
+ )
# Currently these can be slow to run in Jenkins, so they are in
# several test binaries.
set(exename pdb2gmx1-test)
gmx_add_gtest_executable(${exename}
- pdb2gmx.cpp
-)
+ CPP_SOURCE_FILES
+ pdb2gmx.cpp
+ )
target_compile_definitions(${exename} PRIVATE OPLSAA=1 GROMOS=0 AMBER=0 CHARMM=0)
gmx_register_gtest_test(Pdb2gmx1Test ${exename})
set(exename pdb2gmx2-test)
gmx_add_gtest_executable(${exename}
- pdb2gmx.cpp
- )
+ CPP_SOURCE_FILES
+ pdb2gmx.cpp
+ )
target_compile_definitions(${exename} PRIVATE OPLSAA=0 GROMOS=1 AMBER=0 CHARMM=0)
gmx_register_gtest_test(Pdb2gmx2Test ${exename})
set(exename pdb2gmx3-test)
gmx_add_gtest_executable(${exename}
- pdb2gmx.cpp
- )
+ CPP_SOURCE_FILES
+ pdb2gmx.cpp
+ )
target_compile_definitions(${exename} PRIVATE OPLSAA=0 GROMOS=0 AMBER=1 CHARMM=1)
gmx_register_gtest_test(Pdb2gmx3Test ${exename})
# different files and strategies for the different GPU implementation
# flavours.
-# Always compiled as plain C++
-file(GLOB SOURCES_FROM_CXX
- clfftinitializer.cpp
- hostallocator.cpp
- )
+gmx_add_unit_test(GpuUtilsUnitTests gpu_utils-test
+ CPP_SOURCE_FILES
+ # Infrastructure
+ gputest.cpp
+ # Tests of code
+ clfftinitializer.cpp
+ hostallocator.cpp
-if(GMX_USE_CUDA)
- # CUDA-only test
- list(APPEND SOURCES_FROM_CXX
+ CUDA_CU_SOURCE_FILES
+ devicetransfers.cu
+ typecasts_runner.cu
+
+ CUDA_CPP_SOURCE_FILES
pinnedmemorychecker.cpp
typecasts.cpp
typecasts_runner.cpp
- )
- gmx_add_libgromacs_sources(typecasts_runner.cu)
- # TODO Making a separate library is heavy handed, but nothing else
- # seems to work. Also don't use a hyphen in its name, because nvcc
- # can't cope with that.
- #
- # Perhaps FindCUDA's support for single compilation units will help?
- if (NOT GMX_CLANG_CUDA)
- # Work around FindCUDA that prevents using target_link_libraries()
- # with keywords otherwise...
- set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
- cuda_add_library(gpu_utilstest_cuda
- devicetransfers.cu
- )
- else()
- include(gmxClangCudaUtils)
- gmx_compile_cuda_file_with_clang(devicetransfers.cu)
- add_library(gpu_utilstest_cuda
- devicetransfers.cu
- )
- endif()
-
- target_link_libraries(gpu_utilstest_cuda PRIVATE ${GMX_EXTRA_LIBRARIES} libgromacs)
-
-elseif(GMX_USE_OPENCL)
- # Do normal compilation of OpenCL files
- list(APPEND SOURCES_FROM_CXX
+
+ OPENCL_CPP_SOURCE_FILES
devicetransfers_ocl.cpp
- )
-else()
- # Do normal compilation of files with null implementations
- list(APPEND SOURCES_FROM_CXX
+
+ NON_GPU_CPP_SOURCE_FILES
devicetransfers.cpp
- )
-endif()
-
-gmx_add_unit_test(GpuUtilsUnitTests gpu_utils-test
- # Infrastructure
- gputest.cpp
- # Tests of code
- ${SOURCES_FROM_CXX}
+
)
-
-if(GMX_USE_CUDA)
- target_link_libraries(gpu_utils-test PRIVATE gpu_utilstest_cuda)
-endif()
-if(GMX_USE_OPENCL)
- target_link_libraries(gpu_utils-test PRIVATE ${OpenCL_LIBRARIES})
-endif()
void convertRVecToFloat3OnHost(std::vector<gmx::RVec>& /* rVecOutput */,
const std::vector<gmx::RVec>& /* rVecInput */)
{
- FAIL() << "Can't test float3 and RVec compatibility without CUDA.");
+ FAIL() << "Can't test float3 and RVec compatibility without CUDA.";
}
void convertRVecToFloat3OnDevice(std::vector<gmx::RVec>& /* rVecOutput */,
const std::vector<gmx::RVec>& /* rVecInput*/)
{
- FAIL() << "Can't test float3 and RVec compatibility without CUDA.");
+ FAIL() << "Can't test float3 and RVec compatibility without CUDA.";
}
} // namespace test
} // namespace gmx
-#endif // GMX_GPU != GMX_GPU_CUDA
\ No newline at end of file
+#endif // GMX_GPU != GMX_GPU_CUDA
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015, by the GROMACS development team, led by
+# Copyright (c) 2015,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(HardwareUnitTests hardware-test
- cpuinfo.cpp
- hardwaretopology.cpp)
+ CPP_SOURCE_FILES
+ cpuinfo.cpp
+ hardwaretopology.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2016,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(ListedForcesTest listed_forces-test
- bonded.cpp)
+ CPP_SOURCE_FILES
+ bonded.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(MathUnitTests math-test
- arrayrefwithpadding.cpp
- coordinatetransformation.cpp
- densityfit.cpp
- dofit.cpp
- exponentialmovingaverage.cpp
- functions.cpp
- gausstransform.cpp
- densityfittingforce.cpp
- invertmatrix.cpp
- matrix.cpp
- multidimarray.cpp
- paddedvector.cpp
- vectypes.cpp
- )
+ CPP_SOURCE_FILES
+ arrayrefwithpadding.cpp
+ coordinatetransformation.cpp
+ densityfit.cpp
+ dofit.cpp
+ exponentialmovingaverage.cpp
+ functions.cpp
+ gausstransform.cpp
+ densityfittingforce.cpp
+ invertmatrix.cpp
+ matrix.cpp
+ multidimarray.cpp
+ paddedvector.cpp
+ vectypes.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2016,2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2016,2017,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(MdlibUnitTest mdlib-test
- calc_verletbuf.cpp
- constr.cpp
- constrtestdata.cpp
- constrtestrunners.cpp
- ebin.cpp
- energyoutput.cpp
- leapfrog.cpp
- leapfrogtestdata.cpp
- leapfrogtestrunners.cpp
- settle.cpp
- settletestdata.cpp
- settletestrunners.cpp
- shake.cpp
- simulationsignal.cpp
- updategroups.cpp
- updategroupscog.cpp)
-
-# TODO: Make CUDA source to compile inside the testing framework
-if(GMX_USE_CUDA)
- gmx_add_libgromacs_sources(constrtestrunners.cu
- leapfrogtestrunners.cu
- settletestrunners.cu)
-endif()
+ CPP_SOURCE_FILES
+ calc_verletbuf.cpp
+ constr.cpp
+ constrtestdata.cpp
+ constrtestrunners.cpp
+ ebin.cpp
+ energyoutput.cpp
+ leapfrog.cpp
+ leapfrogtestdata.cpp
+ leapfrogtestrunners.cpp
+ settle.cpp
+ settletestdata.cpp
+ settletestrunners.cpp
+ shake.cpp
+ simulationsignal.cpp
+ updategroups.cpp
+ updategroupscog.cpp
+ CUDA_CU_SOURCE_FILES
+ constrtestrunners.cu
+ leapfrogtestrunners.cu
+ settletestrunners.cu
+ )
invdt_ = 1.0 / timestep; // Inverse timestep
- // Communication record
- cr_.nnodes = 1;
- cr_.dd = nullptr;
-
- // Multisim data
- ms_.sim = 0;
- ms_.nsim = 1;
-
// Input record - data that usually comes from configuration file (.mdp)
ir_.efep = 0;
ir_.init_t = initialTime;
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/lincs.h"
#include "gromacs/mdlib/shake.h"
-#include "gromacs/mdrunutility/multisim.h"
-#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/pbc.h"
std::vector<real> masses_;
//! Inverse masses
std::vector<real> invmass_;
- //! Communication record
- t_commrec cr_;
//! Input record (info that usually in .mdp file)
t_inputrec ir_;
//! Local topology
std::unique_ptr<InteractionDefinitions> idef_;
//! MD atoms
t_mdatoms md_;
- //! Multisim data
- gmx_multisim_t ms_;
//! Computational time array (normally used to benchmark performance)
t_nrnb nrnb_;
#include "gromacs/mdlib/constr.h"
#include "gromacs/mdlib/lincs.h"
#include "gromacs/mdlib/shake.h"
+#include "gromacs/mdrunutility/multisim.h"
#include "gromacs/mdtypes/commrec.h"
#include "gromacs/mdtypes/inputrec.h"
#include "gromacs/mdtypes/mdatom.h"
int warncount_lincs = 0;
gmx_omp_nthreads_set(emntLINCS, 1);
+ // Communication record
+ t_commrec cr;
+ cr.nnodes = 1;
+ cr.dd = nullptr;
+
+ // Multi-sim record
+ gmx_multisim_t ms;
+
// Make blocka structure for faster LINCS setup
std::vector<ListOfLists<int>> at2con_mt;
at2con_mt.reserve(testData->mtop_.moltype.size());
// Initialize LINCS
lincsd = init_lincs(nullptr, testData->mtop_, testData->nflexcon_, at2con_mt, false,
testData->ir_.nLincsIter, testData->ir_.nProjOrder);
- set_lincs(*testData->idef_, testData->md_, EI_DYNAMICS(testData->ir_.eI), &testData->cr_, lincsd);
+ set_lincs(*testData->idef_, testData->md_, EI_DYNAMICS(testData->ir_.eI), &cr, lincsd);
// Evaluate constraints
bool success = constrain_lincs(
- false, testData->ir_, 0, lincsd, testData->md_, &testData->cr_, &testData->ms_,
+ false, testData->ir_, 0, lincsd, testData->md_, &cr, &ms,
testData->x_.arrayRefWithPadding(), testData->xPrime_.arrayRefWithPadding(),
testData->xPrime2_.arrayRefWithPadding().unpaddedArrayRef(), pbc.box, &pbc,
testData->md_.lambda, &testData->dHdLambda_, testData->invdt_,
#include "leapfrogtestrunners.h"
-#include "config.h"
-
#include <assert.h>
#include <cmath>
namespace test
{
-#if GMX_GPU == GMX_GPU_CUDA
-
void integrateLeapFrogGpu(LeapFrogTestData* testData, int numSteps)
{
int numAtoms = testData->numAtoms_;
freeDeviceBuffer(&d_f);
}
-#endif // GMX_GPU == GMX_GPU_CUDA
-
} // namespace test
} // namespace gmx
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2016,2017,2019, by the GROMACS development team, led by
+# Copyright (c) 2016,2017,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
threadaffinitytest.cpp)
gmx_add_unit_test(MdrunUtilityUnitTests mdrunutility-test
- threadaffinity.cpp)
+ CPP_SOURCE_FILES
+ threadaffinity.cpp
+ )
target_link_libraries(mdrunutility-test PRIVATE mdrunutility-test-shared)
gmx_add_mpi_unit_test(MdrunUtilityMpiUnitTests mdrunutility-mpi-test 4
- threadaffinity_mpi.cpp)
+ CPP_SOURCE_FILES
+ threadaffinity_mpi.cpp
+ )
# TODO This target does not exist in a non-MPI build. It would be preferable
# to change functions like gmx_add_mpi_unit_test to add link-time dependencies
# as well as source files.
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(MDSpanTests mdspan-test
- accessor_policy.cpp
- extents.cpp
- extensions.cpp
- layouts.cpp
- mdspan.cpp
- )
+ CPP_SOURCE_FILES
+ accessor_policy.cpp
+ extents.cpp
+ extensions.cpp
+ layouts.cpp
+ mdspan.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2014,2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2014,2015,2016,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
mock_helptopic.cpp)
gmx_add_unit_test(OnlineHelpUnitTests onlinehelp-test
- helpformat.cpp
- helpmanager.cpp
- helpwritercontext.cpp)
+ CPP_SOURCE_FILES
+ helpformat.cpp
+ helpmanager.cpp
+ helpwritercontext.cpp
+ )
target_link_libraries(onlinehelp-test PRIVATE onlinehelp-test-shared)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2011,2012,2014,2016, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2014,2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(OptionsUnitTests options-test
- abstractoptionstorage.cpp
- filenameoption.cpp
- filenameoptionmanager.cpp
- option.cpp
- optionsassigner.cpp
- repeatingsection.cpp
- timeunitmanager.cpp
- treesupport.cpp
- )
+ CPP_SOURCE_FILES
+ abstractoptionstorage.cpp
+ filenameoption.cpp
+ filenameoptionmanager.cpp
+ option.cpp
+ optionsassigner.cpp
+ repeatingsection.cpp
+ timeunitmanager.cpp
+ treesupport.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(PbcutilUnitTest pbcutil-test
- pbc.cpp
- pbcenums.cpp
- )
+ CPP_SOURCE_FILES
+ pbc.cpp
+ pbcenums.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2016, by the GROMACS development team, led by
+# Copyright (c) 2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(PullTest pull-test
- pull.cpp)
+ CPP_SOURCE_FILES
+ pull.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(RandomUnitTests random-test
- exponentialdistribution.cpp
- gammadistribution.cpp
- normaldistribution.cpp
- seed.cpp
- tabulatednormaldistribution.cpp
- threefry.cpp
- uniformintdistribution.cpp
- uniformrealdistribution.cpp
- )
+ CPP_SOURCE_FILES
+ exponentialdistribution.cpp
+ gammadistribution.cpp
+ normaldistribution.cpp
+ seed.cpp
+ tabulatednormaldistribution.cpp
+ threefry.cpp
+ uniformintdistribution.cpp
+ uniformrealdistribution.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018, by the GROMACS development team, led by
+# Copyright (c) 2018,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(RestraintTests restraintpotential-test
- manager.cpp)
+ CPP_SOURCE_FILES
+ manager.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2010,2011,2012,2013, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(SelectionUnitTests selection-test
- indexutil.cpp
- nbsearch.cpp
- poscalc.cpp
- selectioncollection.cpp
- selectionoption.cpp
- toputils.cpp)
+ CPP_SOURCE_FILES
+ indexutil.cpp
+ nbsearch.cpp
+ poscalc.cpp
+ selectioncollection.cpp
+ selectionoption.cpp
+ toputils.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016,2017,2018, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2017,2018,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(SimdUnitTests simd-test
- bootstrap_loadstore.cpp
- base.cpp
- simd.cpp
- simd_floatingpoint.cpp
- simd_floatingpoint_util.cpp
- simd_vector_operations.cpp
- simd_math.cpp
- simd_memory.cpp
- simd_integer.cpp
- simd4.cpp
- simd4_floatingpoint.cpp
- simd4_vector_operations.cpp
- simd4_math.cpp
- scalar.cpp
- scalar_util.cpp
- scalar_math.cpp)
+ CPP_SOURCE_FILES
+ base.cpp
+ bootstrap_loadstore.cpp
+ scalar.cpp
+ scalar_util.cpp
+ scalar_math.cpp
+ simd.cpp
+ simd_floatingpoint.cpp
+ simd_floatingpoint_util.cpp
+ simd_integer.cpp
+ simd_math.cpp
+ simd_memory.cpp
+ simd_vector_operations.cpp
+ simd4.cpp
+ simd4_floatingpoint.cpp
+ simd4_math.cpp
+ simd4_vector_operations.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2016, by the GROMACS development team, led by
+# Copyright (c) 2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(TableUnitTests table-test
- splinetable.cpp
- )
+ CPP_SOURCE_FILES
+ splinetable.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2017, by the GROMACS development team, led by
+# Copyright (c) 2017,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(TaskAssignmentUnitTests taskassignment-test
- usergpuids.cpp
- )
+ CPP_SOURCE_FILES
+ usergpuids.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(ToolUnitTests tool-test
- dump.cpp
- report_methods.cpp
- trjconv.cpp)
+ CPP_SOURCE_FILES
+ dump.cpp
+ report_methods.cpp
+ trjconv.cpp
+ )
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(TopologyTest topology-test
- exclusionblocks.cpp
- mtop.cpp
- symtab.cpp)
+ CPP_SOURCE_FILES
+ exclusionblocks.cpp
+ mtop.cpp
+ symtab.cpp
+ )
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(TrajectoryAnalysisUnitTests trajectoryanalysis-test
- moduletest.cpp
- clustsize.cpp
- cmdlinerunner.cpp
- angle.cpp
- convert_trj.cpp
- distance.cpp
- extract_cluster.cpp
- freevolume.cpp
- pairdist.cpp
- rdf.cpp
- sasa.cpp
- select.cpp
- surfacearea.cpp
- topologyinformation.cpp
- trajectory.cpp
- unionfind.cpp)
+ CPP_SOURCE_FILES
+ # Infrastructure
+ moduletest.cpp
+ # Tests
+ angle.cpp
+ clustsize.cpp
+ cmdlinerunner.cpp
+ convert_trj.cpp
+ distance.cpp
+ extract_cluster.cpp
+ freevolume.cpp
+ pairdist.cpp
+ rdf.cpp
+ sasa.cpp
+ select.cpp
+ surfacearea.cpp
+ topologyinformation.cpp
+ trajectory.cpp
+ unionfind.cpp
+ )
target_link_libraries(trajectoryanalysis-test PRIVATE analysisdata-test-shared)
add_executable(test_selection ${UNITTEST_TARGET_OPTIONS} test_selection.cpp)
# the research papers on the package. Check out http://www.gromacs.org.
file(GLOB UTILITY_SOURCES *.cpp)
-if (GMX_GPU AND NOT GMX_USE_OPENCL)
+if (GMX_USE_CUDA)
gmx_add_libgromacs_sources(cuda_version_information.cu)
endif()
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(UtilityUnitTests utility-test
- alignedallocator.cpp
- arrayref.cpp
- bitmask32.cpp bitmask64.cpp bitmask128.cpp
- cstringutil.cpp
- defaultinitializationallocator.cpp
- enumerationhelpers.cpp
- fixedcapacityvector.cpp
- inmemoryserializer.cpp
- keyvaluetreeserializer.cpp
- keyvaluetreetransform.cpp
- listoflists.cpp
- logger.cpp
- mdmodulenotification-impl.cpp
- mutex.cpp
- path.cpp
- physicalnodecommunicator.cpp
- stringutil.cpp
- textreader.cpp
- textwriter.cpp
- typetraits.cpp
- )
+ CPP_SOURCE_FILES
+ alignedallocator.cpp
+ arrayref.cpp
+ bitmask32.cpp bitmask64.cpp bitmask128.cpp
+ cstringutil.cpp
+ defaultinitializationallocator.cpp
+ enumerationhelpers.cpp
+ fixedcapacityvector.cpp
+ inmemoryserializer.cpp
+ keyvaluetreeserializer.cpp
+ keyvaluetreetransform.cpp
+ listoflists.cpp
+ logger.cpp
+ mdmodulenotification-impl.cpp
+ mutex.cpp
+ path.cpp
+ physicalnodecommunicator.cpp
+ stringutil.cpp
+ textreader.cpp
+ textwriter.cpp
+ typetraits.cpp
+ )
gmx_add_mpi_unit_test(UtilityMpiUnitTests utility-mpi-test 4
- physicalnodecommunicator_mpi.cpp
- )
+ CPP_SOURCE_FILES
+ physicalnodecommunicator_mpi.cpp
+ )
terminationhelper.cpp
trajectorycomparison.cpp
trajectoryreader.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
)
target_include_directories(mdrun_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
set(testname "MdrunTests")
set(exename "mdrun-test")
-gmx_add_gtest_executable(
- ${exename}
- # files with code for tests
- compressed_x_output.cpp
- densityfittingmodule.cpp
- exactcontinuation.cpp
- grompp.cpp
- helpwriting.cpp
- initialconstraints.cpp
- interactiveMD.cpp
- outputfiles.cpp
- orires.cpp
- pmetest.cpp
- simulator.cpp
- swapcoords.cpp
- tabulated_bonded_interactions.cpp
- termination.cpp
- trajectory_writing.cpp
- mimic.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
+gmx_add_gtest_executable(${exename}
+ CPP_SOURCE_FILES
+ compressed_x_output.cpp
+ densityfittingmodule.cpp
+ exactcontinuation.cpp
+ grompp.cpp
+ helpwriting.cpp
+ initialconstraints.cpp
+ interactiveMD.cpp
+ orires.cpp
+ outputfiles.cpp
+ pmetest.cpp
+ simulator.cpp
+ swapcoords.cpp
+ tabulated_bonded_interactions.cpp
+ termination.cpp
+ trajectory_writing.cpp
+ mimic.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
)
target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST)
set(testname "MdrunNonIntegratorTests")
set(exename "mdrun-non-integrator-test")
-gmx_add_gtest_executable(
- ${exename}
- # files with code for tests
- minimize.cpp
- nonbonded_bench.cpp
- normalmodes.cpp
- rerun.cpp
- simple_mdrun.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
- )
+gmx_add_gtest_executable(${exename}
+ CPP_SOURCE_FILES
+ # files with code for tests
+ minimize.cpp
+ nonbonded_bench.cpp
+ normalmodes.cpp
+ rerun.cpp
+ simple_mdrun.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
+ )
target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST)
set(testname "MdrunTpiTests")
set(exename "mdrun-tpi-test")
-gmx_add_gtest_executable(
- ${exename}
- # files with code for tests
- tpitest.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
- )
+gmx_add_gtest_executable(${exename}
+ CPP_SOURCE_FILES
+ # files with code for tests
+ tpitest.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
+ )
target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} INTEGRATION_TEST)
set(testname "MdrunMpiTests")
set(exename "mdrun-mpi-test")
-gmx_add_gtest_executable(
- ${exename} MPI
- # files with code for tests
- domain_decomposition.cpp
- minimize.cpp
- mimic.cpp
- multisim.cpp
- multisimtest.cpp
- pmetest.cpp
- replicaexchange.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
- )
+gmx_add_gtest_executable(${exename} MPI
+ CPP_SOURCE_FILES
+ # files with code for tests
+ domain_decomposition.cpp
+ minimize.cpp
+ mimic.cpp
+ multisim.cpp
+ multisimtest.cpp
+ pmetest.cpp
+ replicaexchange.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
+ )
target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
gmx_register_gtest_test(${testname} ${exename} MPI_RANKS 2 OPENMP_THREADS 2 INTEGRATION_TEST)
# Slow-running tests that target testing multiple-rank coordination behaviors
set(exename "mdrun-mpi-coordination-test")
-gmx_add_gtest_executable(
- ${exename} MPI
- # files with code for tests
- periodicactions.cpp
- # pseudo-library for code for mdrun
- $<TARGET_OBJECTS:mdrun_objlib>
- )
+gmx_add_gtest_executable(${exename} MPI
+ CPP_SOURCE_FILES
+ # files with code for tests
+ periodicactions.cpp
+ # pseudo-library for code for mdrun
+ $<TARGET_OBJECTS:mdrun_objlib>
+ )
target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
# These tests are extremely slow without optimization or OpenMP, so only run them for
# the research papers on the package. Check out http://www.gromacs.org.
include(CMakeParseArguments)
+include(gmxClangCudaUtils)
function (gmx_add_unit_test_library NAME)
if (GMX_BUILD_UNITTESTS AND BUILD_TESTING)
endif()
endfunction ()
+# This function creates a GoogleTest test executable for a module. It
+# hides all the complexity of how to treat different source files
+# under different configuration conditions. It should be extended
+# if we ever support another GPU compilation approach.
+#
+# It can be called with extra options and arguments:
+# MPI
+# To trigger the ctest runner to run this test with multiple ranks
+# HARDWARE_DETECTION
+# To trigger the test executable setup code to run hardware detection
+# CPP_SOURCE_FILES file1.cpp file2.cpp ...
+# All the normal C++ .cpp source files
+# GPU_CPP_SOURCE_FILES file1.cpp file2.cpp ...
+# All the C++ .cpp source files that are always needed, but must be
+# compiled in the way that suits GMX_GPU.
+# CUDA_CU_SOURCE_FILES file1.cu file2.cu ...
+# All the normal CUDA .cu source files
+# CUDA_CPP_SOURCE_FILES file1.cpp file2.cpp ...
+# All the other .cpp source files to be compiled as CUDA
+# OPENCL_CPP_SOURCE_FILES file1.cpp file2.cpp ...
+# All the other C++ .cpp source files needed only with OpenCL
+# NON_GPU_CPP_SOURCE_FILES file1.cpp file2.cpp ...
+# All the other C++ .cpp source files needed only with neither OpenCL nor CUDA
function (gmx_add_gtest_executable EXENAME)
if (GMX_BUILD_UNITTESTS AND BUILD_TESTING)
set(_options MPI HARDWARE_DETECTION)
- cmake_parse_arguments(ARG "${_options}" "" "" ${ARGN})
- set(_source_files ${ARG_UNPARSED_ARGUMENTS})
+ set(_multi_value_keywords
+ CPP_SOURCE_FILES
+ CUDA_CU_SOURCE_FILES
+ GPU_CPP_SOURCE_FILES
+ CUDA_CPP_SOURCE_FILES
+ OPENCL_CPP_SOURCE_FILES
+ NON_GPU_CPP_SOURCE_FILES
+ )
+ cmake_parse_arguments(ARG "${_options}" "" "${_multi_value_keywords}" ${ARGN})
file(RELATIVE_PATH _input_files_path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(_temporary_files_path "${CMAKE_CURRENT_BINARY_DIR}/Testing/Temporary")
TEST_USES_HARDWARE_DETECTION=true)
endif()
- add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
- ${_source_files} ${TESTUTILS_DIR}/unittest_main.cpp)
+ if (GMX_USE_CUDA AND NOT GMX_CLANG_CUDA)
+ # Work around FindCUDA that prevents using target_link_libraries()
+ # with keywords otherwise...
+ set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
+ cuda_add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
+ ${ARG_CPP_SOURCE_FILES}
+ ${ARG_CUDA_CU_SOURCE_FILES}
+ ${ARG_CUDA_CPP_SOURCE_FILES}
+ ${ARG_GPU_CPP_SOURCE_FILES}
+ ${TESTUTILS_DIR}/unittest_main.cpp)
+ else()
+ add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
+ ${ARG_CPP_SOURCE_FILES}
+ ${TESTUTILS_DIR}/unittest_main.cpp)
+ endif()
+
+ if (GMX_USE_CUDA)
+ if (GMX_CLANG_CUDA)
+ target_sources(${EXENAME} PRIVATE
+ ${ARG_CUDA_CU_SOURCE_FILES}
+ ${ARG_CUDA_CPP_SOURCE_FILES}
+ ${ARG_GPU_CPP_SOURCE_FILES})
+ set_source_files_properties(${ARG_CUDA_CPP_SOURCE_FILES} ${ARG_GPU_CPP_SOURCE_FILES} PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ)
+ gmx_compile_cuda_file_with_clang(${ARG_CUDA_CU_SOURCE_FILES})
+ if(ARG_CUDA_CPP_SOURCE_FILES OR ARG_CUDA_CU_SOURCE_FILES OR ARG_GPU_CPP_SOURCE_FILES)
+ target_link_libraries(${EXENAME} PRIVATE ${GMX_EXTRA_LIBRARIES})
+ endif()
+ endif()
+ elseif (GMX_USE_OPENCL)
+ target_sources(${EXENAME} PRIVATE ${ARG_OPENCL_CPP_SOURCE_FILES} ${ARG_GPU_CPP_SOURCE_FILES})
+ if(ARG_OPENCL_CPP_SOURCE_FILES OR ARG_GPU_CPP_SOURCE_FILES)
+ target_link_libraries(${EXENAME} PRIVATE ${OpenCL_LIBRARIES})
+ endif()
+ else()
+ target_sources(${EXENAME} PRIVATE ${ARG_NON_GPU_CPP_SOURCE_FILES} ${ARG_GPU_CPP_SOURCE_FILES})
+ endif()
+
gmx_target_compile_options(${EXENAME})
target_compile_definitions(${EXENAME} PRIVATE HAVE_CONFIG_H ${EXTRA_COMPILE_DEFINITIONS})
target_include_directories(${EXENAME} SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2012,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2014,2015,2016,2020, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
# the research papers on the package. Check out http://www.gromacs.org.
gmx_add_unit_test(TestUtilsUnitTests testutils-test
- interactivetest.cpp
- refdata_tests.cpp
- testasserts_tests.cpp
- xvgtest_tests.cpp)
+ CPP_SOURCE_FILES
+ interactivetest.cpp
+ refdata_tests.cpp
+ testasserts_tests.cpp
+ xvgtest_tests.cpp
+ )
gmx_add_mpi_unit_test(TestUtilsMpiUnitTests testutils-mpi-test 2
- mpitest.cpp)
+ CPP_SOURCE_FILES
+ mpitest.cpp
+ )