1 #ifndef CUDAGLOBALMASTERCLIENT_H 2 #define CUDAGLOBALMASTERCLIENT_H 27 :
public std::enable_shared_from_this<CudaGlobalMasterClient> {
28 #if (defined(NAMD_CUDA) || defined(NAMD_HIP)) && defined(NODEGROUP_FORCE_REGISTER) 45 virtual void initialize(
46 const std::vector<std::string>& arguments,
47 int deviceID, cudaStream_t stream);
52 virtual void setStep(int64_t step) { m_step = step; }
57 void setMaster(std::shared_ptr<CudaGlobalMasterServer>
master) {
64 void subscribe(std::shared_ptr<CudaGlobalMasterServer>
master);
72 std::string name() {
return m_name; }
82 virtual void onBuffersUpdated() {}
86 virtual void calculate() {}
93 virtual bool requestedAtomsChanged() = 0;
100 virtual bool requestedTotalForcesAtomsChanged() = 0;
107 virtual bool requestedForcedAtomsChanged() = 0;
115 virtual bool requestUpdateAtomPositions() = 0;
123 virtual bool requestUpdateAtomTotalForces() = 0;
131 virtual bool requestUpdateForcedAtoms() = 0;
140 virtual bool requestUpdateMasses() = 0;
150 virtual bool requestUpdateCharges() = 0;
155 virtual bool requestUpdateLattice() = 0;
165 virtual bool requestUpdateTransforms() {
return false; }
174 virtual bool requestUpdateVelocities() {
return false; }
190 virtual double *getAppliedForces()
const = 0;
206 virtual double *getPositions() = 0;
222 virtual float *getMasses() = 0;
238 virtual float *getCharges() = 0;
254 virtual double *getTotalForces() = 0;
269 virtual double *getLattice() = 0;
287 virtual char *getTransforms() {
return nullptr; }
303 virtual double *getVelocities() {
return nullptr; }
309 virtual int updateFromTCLCommand(
const std::vector<std::string>& arguments);
314 virtual std::string getTCLUpdateResult();
318 bool tclAvailable()
const;
330 void finishReductions(
bool doEnergy,
bool doVirial,
SubmitReduction *reduction);
335 virtual const std::vector<AtomID> &getRequestedAtoms()
const = 0;
339 virtual const std::vector<AtomID> &getRequestedTotalForcesAtoms()
const = 0;
344 virtual const std::vector<AtomID> &getRequestedForcedAtoms()
const = 0;
350 virtual cudaStream_t getStream() = 0;
354 virtual bool hasEnergy()
const {
return true; }
359 virtual double getEnergy()
const {
return 0; }
363 virtual bool hasVirial()
const {
return false; }
376 virtual bool hasExtForce()
const {
return false; }
381 virtual Vector getExtForce()
const {
return Vector{0}; };
387 virtual bool useDefaultExtForceAndVirial()
const {
return true; };
406 bool replica_enabled()
const;
407 int replica_index()
const;
408 int num_replicas()
const;
409 void replica_comm_barrier();
410 int replica_comm_recv(
char* msg_data,
int buf_len,
int src_rep);
411 int replica_comm_send(
char* msg_data,
int msg_len,
int dest_rep);
414 std::weak_ptr<CudaGlobalMasterServer> m_master;
425 #endif // (defined(NAMD_CUDA) || defined(NAMD_HIP)) && defined(NODEGROUP_FORCE_REGISTER) 430 #endif // CUDAGLOBALMASTERCLIENT_H
A class for performing calculations on specific atoms selected by atom serial numbers.
Molecule stores the structural information for the system.
A class for copying atom information from SequencerCUDA to CudaGlobalMasterClient.