#include "gromacs/hardware/detecthardware.h"
#include "gromacs/hardware/hardwaretopology.h"
#include "gromacs/hardware/hw_info.h"
-#include "gromacs/listed_forces/gpubonded.h"
+#include "gromacs/listed_forces/listed_forces_gpu.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdlib/update_constrain_gpu.h"
#include "gromacs/mdtypes/commrec.h"
{
//! Helper variable to localise the text of an often repeated message.
-const char* g_specifyEverythingFormatString =
+const char* const g_specifyEverythingFormatString =
"When you use mdrun -gputasks, %s must be set to non-default "
"values, so that the device IDs can be interpreted correctly."
#if GMX_GPU
// OpenCL standard, but the only current relevant case for GROMACS
// is AMD OpenCL, which offers this variable.
"GPU_DEVICE_ORDINAL"
-# elif GMX_GPU_SYCL
- // As with OpenCL, there are no portable way to do it.
- // Intel reference: https://github.com/intel/llvm/blob/sycl/sycl/doc/EnvironmentVariables.md
- // While SYCL_DEVICE_FILTER is a better option, as of 2021.1-beta10 it is not yet supported.
- "SYCL_DEVICE_ALLOWLIST"
+# elif GMX_GPU_SYCL && GMX_SYCL_DPCPP
+ // https://github.com/intel/llvm/blob/sycl/sycl/doc/EnvironmentVariables.md
+ "SYCL_DEVICE_FILTER"
+# elif GMX_GPU_SYCL && GMX_SYCL_HIPSYCL
+ // Not true if we use hipSYCL over CUDA or IntelLLVM, but in that case the user probably
+ // knows what they are doing.
+ // https://rocmdocs.amd.com/en/latest/Other_Solutions/Other-Solutions.html#hip-environment-variables
+ "HIP_VISIBLE_DEVICES"
# else
# error "Unreachable branch"
# endif
} // namespace
bool decideWhetherToUseGpusForNonbondedWithThreadMpi(const TaskTarget nonbondedTarget,
- const int numDevicesToUse,
+ const bool haveAvailableDevices,
const std::vector<int>& userGpuTaskAssignment,
const EmulateGpuNonbonded emulateGpuNonbonded,
const bool buildSupportsNonbondedOnGpu,
// all potential ranks can use, and can use that in a global
// decision that will later be consistent.
// If we get here, then the user permitted or required GPUs.
- return (numDevicesToUse > 0);
+ return haveAvailableDevices;
}
bool decideWhetherToUseGpusForPmeWithThreadMpi(const bool useGpuForNonbonded,
std::string errorMessage;
- if (!buildSupportsGpuBondeds(&errorMessage))
+ if (!buildSupportsListedForcesGpu(&errorMessage))
{
if (bondedTarget == TaskTarget::Gpu)
{
return false;
}
- if (!inputSupportsGpuBondeds(inputrec, mtop, &errorMessage))
+ if (!inputSupportsListedForcesGpu(inputrec, mtop, &errorMessage))
{
if (bondedTarget == TaskTarget::Gpu)
{
// is busy, for which we currently only check PME or Ewald.
// (It would be better to dynamically assign bondeds based on timings)
// Note that here we assume that the auto setting of PME ranks will not
- // choose seperate PME ranks when nonBonded are assigned to the GPU.
+ // choose separate PME ranks when nonBonded are assigned to the GPU.
bool usingOurCpuForPmeOrEwald =
(EVDW_PME(inputrec.vdwtype)
|| (EEL_PME_EWALD(inputrec.coulombtype) && !useGpuForPme && numPmeRanksPerSimulation <= 0));
const gmx_mtop_t& mtop,
const bool useEssentialDynamics,
const bool doOrientationRestraints,
- const bool useReplicaExchange,
const bool haveFrozenAtoms,
const bool doRerun,
const DevelopmentFeatureFlags& devFlags,
errorMessage += "Multiple time stepping is not supported.\n";
}
- if (inputrec.eConstrAlg == econtSHAKE && hasAnyConstraints && gmx_mtop_ftype_count(mtop, F_CONSTR) > 0)
+ if (inputrec.eConstrAlg == ConstraintAlgorithm::Shake && hasAnyConstraints
+ && gmx_mtop_ftype_count(mtop, F_CONSTR) > 0)
{
errorMessage += "SHAKE constraints are not supported.\n";
}
errorMessage +=
"Either PME or short-ranged non-bonded interaction tasks must run on the GPU.\n";
}
-
if (!gpusWereDetected)
{
errorMessage += "Compatible GPUs must have been found.\n";
{
errorMessage += "Only a CUDA build is supported.\n";
}
- if (inputrec.eI != eiMD)
+ if (inputrec.eI != IntegrationAlgorithm::MD)
{
errorMessage += "Only the md integrator is supported.\n";
}
- if (inputrec.etc == etcNOSEHOOVER)
+ if (inputrec.etc == TemperatureCoupling::NoseHoover)
{
errorMessage += "Nose-Hoover temperature coupling is not supported.\n";
}
- if (!(inputrec.epc == epcNO || inputrec.epc == epcPARRINELLORAHMAN
- || inputrec.epc == epcBERENDSEN || inputrec.epc == epcCRESCALE))
+ if (!(inputrec.epc == PressureCoupling::No || inputrec.epc == PressureCoupling::ParrinelloRahman
+ || inputrec.epc == PressureCoupling::Berendsen || inputrec.epc == PressureCoupling::CRescale))
{
errorMessage +=
"Only Parrinello-Rahman, Berendsen, and C-rescale pressure coupling are "
// The graph is needed, but not supported
errorMessage += "Orientation restraints are not supported.\n";
}
- if (inputrec.efep != efepNO && (haveFepPerturbedMasses(mtop) || havePerturbedConstraints(mtop)))
+ if (inputrec.efep != FreeEnergyPerturbationType::No
+ && (haveFepPerturbedMasses(mtop) || havePerturbedConstraints(mtop)))
{
errorMessage += "Free energy perturbation for mass and constraints are not supported.\n";
}
const auto particleTypes = gmx_mtop_particletype_count(mtop);
- if (particleTypes[eptShell] > 0)
+ if (particleTypes[ParticleType::Shell] > 0)
{
errorMessage += "Shells are not supported.\n";
}
- if (useReplicaExchange)
- {
- errorMessage += "Replica exchange simulations are not supported.\n";
- }
- if (inputrec.eSwapCoords != eswapNO)
+ if (inputrec.eSwapCoords != SwapType::No)
{
errorMessage += "Swapping the coordinates is not supported.\n";
}
"The number of coupled constraints is higher than supported in the GPU LINCS "
"code.\n";
}
+ if (hasAnyConstraints && !UpdateConstrainGpu::areConstraintsSupported())
+ {
+ errorMessage += "Chosen GPU implementation does not support constraints.\n";
+ }
if (haveFrozenAtoms)
{
// There is a known bug with frozen atoms and GPU update, see Issue #3920.