#include "gromacs/utility/real.h"
struct DeviceInformation;
+class FreeEnergyDispatch;
struct gmx_domdec_zones_t;
struct gmx_enerdata_t;
struct gmx_hw_info_t;
class PairlistSets;
struct t_commrec;
struct t_lambda;
-struct t_mdatoms;
struct t_nrnb;
struct t_forcerec;
struct t_inputrec;
+struct gmx_grppairener_t;
class GpuEventSynchronizer;
namespace gmx
{
+template<typename>
+class ArrayRefWithPadding;
class DeviceStreamManager;
class ForceWithShiftForces;
-class GpuBonded;
+class ListedForcesGpu;
template<typename>
class ListOfLists;
class MDLogger;
t_nrnb* nrnb) const;
//! Updates all the atom properties in Nbnxm
- void setAtomProperties(gmx::ArrayRef<const int> atomTypes,
- gmx::ArrayRef<const real> atomCharges,
- gmx::ArrayRef<const int> atomInfo) const;
+ void setAtomProperties(gmx::ArrayRef<const int> atomTypes,
+ gmx::ArrayRef<const real> atomCharges,
+ gmx::ArrayRef<const int64_t> atomInfo) const;
/*!\brief Convert the coordinates to NBNXM format for the given locality.
*
* The API function for the transformation of the coordinates from one layout to another.
*
* \param[in] locality Whether coordinates for local or non-local atoms should be
- * transformed. \param[in] fillLocal If the coordinates for filler particles should be
- * zeroed. \param[in] coordinates Coordinates in plain rvec format to be transformed.
+ * transformed.
+ * \param[in] coordinates Coordinates in plain rvec format to be transformed.
*/
- void convertCoordinates(gmx::AtomLocality locality, bool fillLocal, gmx::ArrayRef<const gmx::RVec> coordinates);
+ void convertCoordinates(gmx::AtomLocality locality, gmx::ArrayRef<const gmx::RVec> coordinates);
/*!\brief Convert the coordinates to NBNXM format on the GPU for the given locality
*
* The API function for the transformation of the coordinates from one layout to another in the GPU memory.
*
* \param[in] locality Whether coordinates for local or non-local atoms should be transformed.
- * \param[in] fillLocal If the coordinates for filler particles should be zeroed.
* \param[in] d_x GPU coordinates buffer in plain rvec format to be transformed.
* \param[in] xReadyOnDevice Event synchronizer indicating that the coordinates are ready in the device memory.
*/
void convertCoordinatesGpu(gmx::AtomLocality locality,
- bool fillLocal,
DeviceBuffer<gmx::RVec> d_x,
GpuEventSynchronizer* xReadyOnDevice);
bool isDynamicPruningStepGpu(int64_t step) const;
//! Dispatches the dynamic pruning kernel for the given locality, for CPU lists
- void dispatchPruneKernelCpu(gmx::InteractionLocality iLocality, const rvec* shift_vec) const;
+ void dispatchPruneKernelCpu(gmx::InteractionLocality iLocality,
+ gmx::ArrayRef<const gmx::RVec> shift_vec) const;
//! Dispatches the dynamic pruning kernel for GPU lists
void dispatchPruneKernelGpu(int64_t step);
//! \brief Executes the non-bonded kernel of the GPU or launches it on the GPU
- void dispatchNonbondedKernel(gmx::InteractionLocality iLocality,
- const interaction_const_t& ic,
- const gmx::StepWorkload& stepWork,
- int clearF,
- const t_forcerec& fr,
- gmx_enerdata_t* enerd,
- t_nrnb* nrnb);
-
- //! Executes the non-bonded free-energy kernel, always runs on the CPU
- void dispatchFreeEnergyKernel(gmx::InteractionLocality iLocality,
- const t_forcerec* fr,
- rvec x[],
- gmx::ForceWithShiftForces* forceWithShiftForces,
- const t_mdatoms& mdatoms,
- t_lambda* fepvals,
- gmx::ArrayRef<const real> lambda,
- gmx_enerdata_t* enerd,
- const gmx::StepWorkload& stepWork,
- t_nrnb* nrnb);
+ void dispatchNonbondedKernel(gmx::InteractionLocality iLocality,
+ const interaction_const_t& ic,
+ const gmx::StepWorkload& stepWork,
+ int clearF,
+ gmx::ArrayRef<const gmx::RVec> shiftvec,
+ gmx::ArrayRef<real> repulsionDispersionSR,
+ gmx::ArrayRef<real> CoulombSR,
+ t_nrnb* nrnb) const;
+
+ //! Executes the non-bonded free-energy kernels, local + non-local, always runs on the CPU
+ void dispatchFreeEnergyKernels(const gmx::ArrayRefWithPadding<const gmx::RVec>& coords,
+ gmx::ForceWithShiftForces* forceWithShiftForces,
+ bool useSimd,
+ int ntype,
+ real rlist,
+ const interaction_const_t& ic,
+ gmx::ArrayRef<const gmx::RVec> shiftvec,
+ gmx::ArrayRef<const real> nbfp,
+ gmx::ArrayRef<const real> nbfp_grid,
+ gmx::ArrayRef<const real> chargeA,
+ gmx::ArrayRef<const real> chargeB,
+ gmx::ArrayRef<const int> typeA,
+ gmx::ArrayRef<const int> typeB,
+ t_lambda* fepvals,
+ gmx::ArrayRef<const real> lambda,
+ gmx_enerdata_t* enerd,
+ const gmx::StepWorkload& stepWork,
+ t_nrnb* nrnb);
/*! \brief Add the forces stored in nbat to f, zeros the forces in nbat
* \param [in] locality Local or non-local
*/
int getNumAtoms(gmx::AtomLocality locality) const;
- /*! \brief Get the pointer to the GPU nonbonded force buffer
- *
- * \returns A pointer to the force buffer in GPU memory
- */
- void* getGpuForces() const;
-
//! Return the kernel setup
const Nbnxm::KernelSetup& kernelSetup() const { return kernelSetup_; }
void changePairlistRadii(real rlistOuter, real rlistInner) const;
//! Set up internal flags that indicate what type of short-range work there is.
- void setupGpuShortRangeWork(const gmx::GpuBonded* gpuBonded, gmx::InteractionLocality iLocality) const;
+ void setupGpuShortRangeWork(const gmx::ListedForcesGpu* listedForcesGpu,
+ gmx::InteractionLocality iLocality) const;
+
+ void setupFepThreadedForceBuffer(int numAtomsForce);
// TODO: Make all data members private
//! All data related to the pair lists
private:
//! The non-bonded setup, also affects the pairlist construction kernel
Nbnxm::KernelSetup kernelSetup_;
+
//! \brief Pointer to wallcycle structure.
gmx_wallcycle* wcycle_;
+ //! \brief The non-bonded free-energy kernel dispatcher
+ std::unique_ptr<FreeEnergyDispatch> freeEnergyDispatch_;
+
public:
//! GPU Nbnxm data, only used with a physical GPU (TODO: use unique_ptr)
NbnxmGpu* gpu_nbv;
const gmx::UpdateGroupsCog* updateGroupsCog,
gmx::Range<int> atomRange,
real atomDensity,
- gmx::ArrayRef<const int> atomInfo,
+ gmx::ArrayRef<const int64_t> atomInfo,
gmx::ArrayRef<const gmx::RVec> x,
int numAtomsMoved,
const int* move);
*/
void nbnxn_put_on_grid_nonlocal(nonbonded_verlet_t* nb_verlet,
const struct gmx_domdec_zones_t* zones,
- gmx::ArrayRef<const int> atomInfo,
+ gmx::ArrayRef<const int64_t> atomInfo,
gmx::ArrayRef<const gmx::RVec> x);
+/*! \brief Check if GROMACS has been built with GPU support.
+ *
+ * \param[in] error Pointer to error string or nullptr.
+ * \todo Move this to NB module once it exists.
+ */
+bool buildSupportsNonbondedOnGpu(std::string* error);
+
#endif // GMX_NBNXN_NBNXM_H