Select Git revision
TransferDocStrings.cmake
PotentialPairGPU_MC.h 7.27 KiB
/* Copyright 2020 Max-Planck-Institut für Polymerforschung
* This file is part of the semi-grand canonical plugin, under BSD 3-Clause License
*
* Parts of this file include source code from HOOMD-Blue
*/
#ifdef __CLION_IDE__
#define ENABLE_CUDA
#endif
#ifndef __POTENTIAL_PAIR_MC_GPU_H__
#define __POTENTIAL_PAIR_MC_GPU_H__
#ifdef ENABLE_HIP
#include <memory>
#include "PotentialPair_MC.h"
#include "PotentialPairGPU_MC.cuh"
#include "hoomd/Autotuner.h"
/*! \file PotentialPairGPUMC.h
\brief Defines the template class for standard pair potentials on the GPU
\note This header cannot be compiled by nvcc
*/
#ifdef __HIPCC__
#error This header cannot be compiled by nvcc
#endif
#include <pybind11/pybind11.h>
using namespace hoomd;
using namespace hoomd::md;
//! Template class for computing pair potentials on the GPU
/*! Derived from PotentialPair, this class provides exactly the same interface for computing pair potentials and forces.
In the same way as PotentialPair, this class serves as a shell dealing with all the details common to every pair
potential calculation while the \a evaluator calculates V(r) in a generic way.
Due to technical limitations, the instantiation of PotentialPairGPUMC cannot create a CUDA kernel automatically
with the \a evaluator. Instead, a .cu file must be written that provides a driver function to call
gpu_compute_pair_forces() instantiated with the same evaluator. (See PotentialPairLJGPU.cu and
PotentialPairLJGPU.cuh for an example). That function is then passed into this class as another template parameter
\a gpu_cgpf
\tparam evaluator EvaluatorPair class used to evaluate V(r) and F(r)/r
\tparam gpu_cgpf Driver function that calls gpu_compute_pair_forces<evaluator>()
\sa export_PotentialPairGPUMC()
*/
template< class evaluator>
class PYBIND11_EXPORT PotentialPairGPUMC : public PotentialPairMC<evaluator>
{
public:
//! Construct the pair potential
PotentialPairGPUMC(std::shared_ptr<SystemDefinition> sysdef,
std::shared_ptr<NeighborList> nlist, unsigned int type_override);
//! Destructor
virtual ~PotentialPairGPUMC() {}
protected:
std::shared_ptr<Autotuner<2>> m_tuner; //!< Autotuner for block size and threads per particle
//! Actually compute the forces
virtual void computeForces(uint64_t timestep);
};