X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=blobdiff_plain;f=api%2Fnblib%2Ftests%2Fnbnxmsetup.cpp;h=369173467e5338b0037a43741eb187d40489477b;hb=61c5c9ec702c3e6c1f00260c3891a0466f3e19eb;hp=a7bff00fdf72a013374580a90cdd89b8cc24c95c;hpb=af245721dfa12586d0fefa74115585214c8dea83;p=alexxy%2Fgromacs.git diff --git a/api/nblib/tests/nbnxmsetup.cpp b/api/nblib/tests/nbnxmsetup.cpp index a7bff00fdf..369173467e 100644 --- a/api/nblib/tests/nbnxmsetup.cpp +++ b/api/nblib/tests/nbnxmsetup.cpp @@ -43,6 +43,7 @@ */ #include +#include "gromacs/hardware/device_management.h" #include "gromacs/mdtypes/forcerec.h" #include "gromacs/mdtypes/interaction_const.h" #include "gromacs/mdtypes/simulation_workload.h" @@ -52,6 +53,7 @@ #include "nblib/nbnxmsetuphelpers.h" #include "testutils/testasserts.h" +#include "testutils/test_hardware_environment.h" namespace nblib { @@ -191,6 +193,48 @@ TEST(NbnxmSetupTest, CanCreateNbnxmCPU) EXPECT_NO_THROW(createNbnxmCPU(numParticles, nbKernelOptions, numEnergyGroups, nonbondedParameters)); } +#if GMX_GPU_CUDA +TEST(NbnxmSetupTest, canCreateKernelSetupGPU) +{ + NBKernelOptions nbKernelOptions; + Nbnxm::KernelSetup kernelSetup = createKernelSetupGPU(nbKernelOptions.useTabulatedEwaldCorr); + EXPECT_EQ(kernelSetup.kernelType, Nbnxm::KernelType::Gpu8x8x8); + EXPECT_EQ(kernelSetup.ewaldExclusionType, Nbnxm::EwaldExclusionType::Analytical); +} + +TEST(NbnxmSetupTest, CanCreateDeviceStreamManager) +{ + const auto& testDeviceList = gmx::test::getTestHardwareEnvironment()->getTestDeviceList(); + for (const auto& testDevice : testDeviceList) + { + const DeviceInformation& deviceInfo = testDevice->deviceInfo(); + setActiveDevice(deviceInfo); + gmx::SimulationWorkload simulationWork = createSimulationWorkloadGpu(); + EXPECT_NO_THROW(createDeviceStreamManager(deviceInfo, simulationWork)); + } +} + +TEST(NbnxmSetupTest, CanCreateNbnxmGPU) +{ + const auto& testDeviceList = gmx::test::getTestHardwareEnvironment()->getTestDeviceList(); + for (const auto& testDevice : testDeviceList) + { + const DeviceInformation& deviceInfo = testDevice->deviceInfo(); + setActiveDevice(deviceInfo); + size_t numParticles = 1; + NBKernelOptions nbKernelOptions; + std::vector nonbondedParameters = { 1, 1 }; + gmx::SimulationWorkload simulationWork = createSimulationWorkloadGpu(); + interaction_const_t interactionConst = createInteractionConst(nbKernelOptions); + // set DeviceInformation and create the DeviceStreamManager + auto deviceStreamManager = createDeviceStreamManager(deviceInfo, simulationWork); + EXPECT_NO_THROW(createNbnxmGPU( + numParticles, nbKernelOptions, nonbondedParameters, interactionConst, *deviceStreamManager)); + } +} + +#endif + } // namespace } // namespace test } // namespace nblib