Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.C
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,13 @@ void colvarproxy_impl::calculate() {
cudaCheck(cudaSetDevice(m_device_id));
// The following memcpy operations are supposed to be overlapped with the NB kernel
if (numAtoms > 0) {
if (mClient->requestUpdateAtomTotalForces()) {
if (mClient->isStartupStep()) {
set_total_forces_invalid();
} else {
set_total_forces_valid();
}
}
if (!has_gpu_support()) {
// Transform the arrays for Colvars
auto &colvars_pos = *(modify_atom_positions());
Expand Down Expand Up @@ -1078,8 +1085,8 @@ bool CudaGlobalMasterColvars::requestUpdateCharges() {
return mImpl->atomsChanged();
}

void CudaGlobalMasterColvars::setStep(int64_t step) {
CudaGlobalMasterClient::setStep(step);
void CudaGlobalMasterColvars::setStep(int64_t step, int startup, int doMigration) {
CudaGlobalMasterClient::setStep(step, startup, doMigration);
if (mImpl->atomsChanged()) {
mImpl->reallocate();
}
Expand Down
3 changes: 2 additions & 1 deletion namd/cudaglobalmaster/colvarproxy_cudaglobalmaster.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CudaGlobalMasterColvars: public CudaGlobalMasterClient {
int updateFromTCLCommand(const std::vector<std::string>& arguments) override;
void onBuffersUpdated() override;
void calculate() override;
void setStep(int64_t step) override;
void setStep(int64_t step, int startup, int doMigration) override;
cudaStream_t getStream() override;
bool requestedAtomsChanged() override;
bool requestedForcedAtomsChanged() override { return requestedAtomsChanged(); }
Expand Down Expand Up @@ -76,6 +76,7 @@ class CudaGlobalMasterColvars: public CudaGlobalMasterClient {
return CudaGlobalMasterClient::replica_comm_send(msg_data, msg_len, dest_rep);
}
int64_t getStep() const {return m_step;}
int isStartupStep() const {return m_is_startup_step;}
std::string getTCLUpdateResult() override {return mTCLResult;}
private:
std::unique_ptr<colvarproxy_impl> mImpl;
Expand Down
4 changes: 1 addition & 3 deletions src/colvar_gpu_calc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -708,9 +708,7 @@ int colvarmodule_gpu_calc::calc_cvs(const std::vector<colvar*>& colvars, colvarm
// Update flags
checkColvarsError(cv_update_flags(colvars));
// Calculate total force
if (colvar_module->step_relative() > 0) {
checkColvarsError(cvc_calc_total_force(colvars, calc_total_force_compute, colvar_module, false));
}
checkColvarsError(cvc_calc_total_force(colvars, calc_total_force_compute, colvar_module, false));
// Read data to atom groups
checkColvarsError(atom_group_read_data_gpu(
colvars, read_data_compute, colvar_module));
Expand Down