setGmxNonBondedNThreads(options.numOpenMPThreads);
}
-Nbnxm::KernelSetup NbvSetupUtil::getKernelSetup(const NBKernelOptions& options)
-{
- return createKernelSetupCPU(options);
-}
-
void NbvSetupUtil::setParticleInfoAllVdv(const size_t numParticles)
{
- particleInfoAllVdw_ = createParticleInfoAllVdv(numParticles);
+ particleInfoAllVdw_ = createParticleInfoAllVdw(numParticles);
}
void NbvSetupUtil::setNonBondedParameters(const std::vector<ParticleType>& particleTypes,
//! Marks particles to have Van der Waals interactions
void setParticleInfoAllVdv(size_t numParticles);
- //! Returns the kernel setup
- Nbnxm::KernelSetup getKernelSetup(const NBKernelOptions& options);
-
//! Set up StepWorkload data
void setupStepWorkload(const NBKernelOptions& options);
return static_cast<Nbnxm::KernelType>(kernelInt);
}
-void checkKernelSetup(const SimdKernels nbnxmSimd)
+void checkKernelSetupSimd(const SimdKernels nbnxmSimd)
{
if (nbnxmSimd >= SimdKernels::Count || nbnxmSimd == SimdKernels::SimdAuto)
{
}
}
-Nbnxm::KernelSetup createKernelSetupCPU(const NBKernelOptions& options)
+Nbnxm::KernelSetup createKernelSetupCPU(const SimdKernels nbnxmSimd, const bool useTabulatedEwaldCorr)
{
- checkKernelSetup(options.nbnxmSimd);
+ checkKernelSetupSimd(nbnxmSimd);
Nbnxm::KernelSetup kernelSetup;
// The int enum options.nbnxnSimd is set up to match Nbnxm::KernelType + 1
- kernelSetup.kernelType = translateBenchmarkEnum(options.nbnxmSimd);
+ kernelSetup.kernelType = translateBenchmarkEnum(nbnxmSimd);
// The plain-C kernel does not support analytical ewald correction
if (kernelSetup.kernelType == Nbnxm::KernelType::Cpu4x4_PlainC)
}
else
{
- kernelSetup.ewaldExclusionType = options.useTabulatedEwaldCorr
- ? Nbnxm::EwaldExclusionType::Table
- : Nbnxm::EwaldExclusionType::Analytical;
+ kernelSetup.ewaldExclusionType = useTabulatedEwaldCorr ? Nbnxm::EwaldExclusionType::Table
+ : Nbnxm::EwaldExclusionType::Analytical;
}
return kernelSetup;
}
-std::vector<int64_t> createParticleInfoAllVdv(const size_t numParticles)
-
+std::vector<int64_t> createParticleInfoAllVdw(const size_t numParticles)
{
std::vector<int64_t> particleInfoAllVdw(numParticles);
for (size_t particleI = 0; particleI < numParticles; particleI++)
// Note: the options and Nbnxm combination rule enums values should match
const int combinationRule = static_cast<int>(options.ljCombinationRule);
- Nbnxm::KernelSetup kernelSetup = createKernelSetupCPU(options);
+ Nbnxm::KernelSetup kernelSetup =
+ createKernelSetupCPU(options.nbnxmSimd, options.useTabulatedEwaldCorr);
PairlistParams pairlistParams(kernelSetup.kernelType, false, options.pairlistCutoff, false);
//! Helper to translate between the different enumeration values.
Nbnxm::KernelType translateBenchmarkEnum(const SimdKernels& kernel);
-/*! \brief Checks the kernel setup
+/*! \brief Checks the kernel SIMD setup in CPU case
*
* Throws an exception when the kernel is not available.
*/
-void checkKernelSetup(SimdKernels nbnxmSimd);
+void checkKernelSetupSimd(SimdKernels nbnxmSimd);
-//! Creates and returns the kernel setup
-Nbnxm::KernelSetup createKernelSetupCPU(const NBKernelOptions& options);
+//! Creates and returns the kernel setup for CPU
+Nbnxm::KernelSetup createKernelSetupCPU(const SimdKernels nbnxmSimd, const bool useTabulatedEwaldCorr);
//! Create Particle info array to mark those that undergo VdV interaction
-std::vector<int64_t> createParticleInfoAllVdv(size_t numParticles);
+std::vector<int64_t> createParticleInfoAllVdw(size_t numParticles);
//! Create the non-bonded parameter vector in GROMACS format
std::vector<real> createNonBondedParameters(const std::vector<ParticleType>& particleTypes,
*/
#include <cmath>
-#include "gromacs/utility/arrayref.h"
#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/interaction_const.h"
+#include "gromacs/mdtypes/simulation_workload.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/nbnxm/nbnxm_simd.h"
#include "nblib/box.h"
TEST(NbnxmSetupTest, CheckKernelSetupThrowsAuto)
{
- EXPECT_ANY_THROW(checkKernelSetup(SimdKernels::SimdAuto));
+ EXPECT_ANY_THROW(checkKernelSetupSimd(SimdKernels::SimdAuto));
}
TEST(NbnxmSetupTest, CheckKernelSetupThrowsCount)
{
- EXPECT_ANY_THROW(checkKernelSetup(SimdKernels::Count));
+ EXPECT_ANY_THROW(checkKernelSetupSimd(SimdKernels::Count));
}
TEST(NbnxmSetupTest, canCreateKernelSetupPlain)
{
NBKernelOptions nbKernelOptions;
- nbKernelOptions.nbnxmSimd = SimdKernels::SimdNo;
- Nbnxm::KernelSetup kernelSetup = createKernelSetupCPU(nbKernelOptions);
+ nbKernelOptions.nbnxmSimd = SimdKernels::SimdNo;
+ Nbnxm::KernelSetup kernelSetup =
+ createKernelSetupCPU(nbKernelOptions.nbnxmSimd, nbKernelOptions.useTabulatedEwaldCorr);
EXPECT_EQ(kernelSetup.kernelType, Nbnxm::KernelType::Cpu4x4_PlainC);
EXPECT_EQ(kernelSetup.ewaldExclusionType, Nbnxm::EwaldExclusionType::Table);
}
mask |= gmx::sc_atomInfo_HasVdw;
mask |= gmx::sc_atomInfo_HasCharge;
std::vector<int64_t> refParticles = { mask, mask };
- std::vector<int64_t> testParticles = createParticleInfoAllVdv(numParticles);
+ std::vector<int64_t> testParticles = createParticleInfoAllVdw(numParticles);
EXPECT_EQ(refParticles, testParticles);
}
#ifdef GMX_NBNXN_SIMD_2XNN
nbKernelOptions.nbnxmSimd = SimdKernels::Simd2XMM;
#endif
- EXPECT_NO_THROW(checkKernelSetup(nbKernelOptions.nbnxmSimd));
+ EXPECT_NO_THROW(checkKernelSetupSimd(nbKernelOptions.nbnxmSimd));
}
// check if the user is allowed to ask for SimdKernels::Simd2XMM when NBLIB is not compiled with it
NBKernelOptions nbKernelOptions;
nbKernelOptions.nbnxmSimd = SimdKernels::Simd2XMM;
nbKernelOptions.useTabulatedEwaldCorr = true;
- EXPECT_ANY_THROW(createKernelSetupCPU(nbKernelOptions));
+ EXPECT_ANY_THROW(createKernelSetupCPU(nbKernelOptions.nbnxmSimd, nbKernelOptions.useTabulatedEwaldCorr));
}
#endif
NBKernelOptions nbKernelOptions;
nbKernelOptions.nbnxmSimd = SimdKernels::Simd4XM;
nbKernelOptions.useTabulatedEwaldCorr = false;
- EXPECT_ANY_THROW(createKernelSetupCPU(nbKernelOptions));
+ EXPECT_ANY_THROW(createKernelSetupCPU(nbKernelOptions.nbnxmSimd, nbKernelOptions.useTabulatedEwaldCorr));
}
#endif