Skip to content

Commit 27eae2f

Browse files
HanatoKgiacomofiorin
authored andcommitted
fix: fix the compilation in the GPU code path
1 parent b04afc6 commit 27eae2f

3 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/colvar_gpu_calc.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int colvarmodule_gpu_calc::cvc_calc_total_force(
7171
if (cvmodule->debug()) {
7272
if (g.graph_exec_initialized) {
7373
// Debug graph
74-
const std::string filename = cvm::output_prefix() + "_calc_total_force.dot";
74+
const std::string filename = cvmodule->output_prefix() + "_calc_total_force.dot";
7575
cvmodule->log("Writing calc_total_force graph to " + filename);
7676
g.dump_graph(filename.c_str());
7777
}
@@ -293,7 +293,7 @@ int colvarmodule_gpu_calc::cvc_calc_value(
293293
if (cvmodule->debug()) {
294294
if (g.graph_exec_initialized) {
295295
// Debug graph
296-
const std::string filename = cvm::output_prefix() + "_calc_value.dot";
296+
const std::string filename = cvmodule->output_prefix() + "_calc_value.dot";
297297
cvmodule->log("Writing calc_value graph to " + filename);
298298
g.dump_graph(filename.c_str());
299299
}
@@ -380,7 +380,7 @@ int colvarmodule_gpu_calc::cvc_calc_gradients(
380380
if (cvmodule->debug()) {
381381
if (g.graph_exec_initialized) {
382382
// Debug graph
383-
const std::string filename = cvm::output_prefix() + "_calc_gradients.dot";
383+
const std::string filename = cvmodule->output_prefix() + "_calc_gradients.dot";
384384
cvmodule->log("Writing calc_gradients graph to " + filename);
385385
g.dump_graph(filename.c_str());
386386
}
@@ -571,7 +571,7 @@ int colvarmodule_gpu_calc::cvc_calc_Jacobian_derivative(
571571
if (cvmodule->debug()) {
572572
if (g.graph_exec_initialized) {
573573
// Debug graph
574-
const std::string filename = cvm::output_prefix() + "_calc_Jacobian_derivative.dot";
574+
const std::string filename = cvmodule->output_prefix() + "_calc_Jacobian_derivative.dot";
575575
cvmodule->log("Writing calc_Jacobian_derivative graph to " + filename);
576576
g.dump_graph(filename.c_str());
577577
}

src/colvarcomp.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ int colvar::cvc::debug_gradients_gpu(
858858
// NOTE: this assumes that groups for this cvc are non-overlapping,
859859
// since atom coordinates are modified only within the current group
860860

861-
cvm::log("Debugging GPU gradients for " + description);
861+
cvmodule->log("Debugging GPU gradients for " + description);
862862
colvarproxy *p = cvmodule->proxy;
863863
cudaStream_t stream = p->get_default_stream();
864864
error_code |= checkGPUError(cudaStreamSynchronize(stream));
@@ -940,7 +940,7 @@ int colvar::cvc::debug_gradients_gpu(
940940
rot.to_cpu(rot_cpu);
941941
const auto rot_0 = rot_cpu.matrix();
942942
// fit_gradients are in the simulation frame: we should print them in the rotated frame
943-
cvm::log("Fit gradients for group " + group->key + ":\n");
943+
cvmodule->log("Fit gradients for group " + group->key + ":\n");
944944
// Synchronized copy the fit gradients from GPU
945945
cvm::ag_vector_real_t h_fit_gradients(3 * group_for_fit->size());
946946
error_code |= p->copy_DtoH(
@@ -954,7 +954,7 @@ int colvar::cvc::debug_gradients_gpu(
954954
h_fit_gradients_x[j],
955955
h_fit_gradients_y[j],
956956
h_fit_gradients_z[j]);
957-
cvm::log((group->fitting_group ? std::string("fittingGroup") : group->key) +
957+
cvmodule->log((group->fitting_group ? std::string("fittingGroup") : group->key) +
958958
"[" + cvm::to_str(j) + "] = " +
959959
(group->is_enabled(f_ag_rotate) ?
960960
cvm::to_str(rot_0 * (fit_grad)) :
@@ -963,7 +963,7 @@ int colvar::cvc::debug_gradients_gpu(
963963
}
964964
}
965965

966-
cvm::log("Gradients for group " + group->key + ":\n");
966+
cvmodule->log("Gradients for group " + group->key + ":\n");
967967
const auto gradients_x = ag_gradients.at(group)[0].begin();
968968
const auto gradients_y = gradients_x + group->size();
969969
const auto gradients_z = gradients_y + group->size();
@@ -1011,7 +1011,7 @@ int colvar::cvc::debug_gradients_gpu(
10111011
cvm::real rel_error = cvm::fabs (num_diff - dx_pred) / (cvm::fabs (num_diff) + cvm::fabs(dx_pred));
10121012
cvmodule->record_gradient_error(rel_error);
10131013

1014-
cvm::log("Atom "+cvm::to_str(ia) + ", ID " + cvm::to_str(this_atom.id) + \
1014+
cvmodule->log("Atom "+cvm::to_str(ia) + ", ID " + cvm::to_str(this_atom.id) + \
10151015
", comp. " + cvm::to_str(id) + ":" + \
10161016
" dx(actual) = " + cvm::to_str (num_diff, 19, 12) + \
10171017
" dx(interp) = " + cvm::to_str (dx_pred, 19, 12) + \
@@ -1075,7 +1075,7 @@ int colvar::cvc::debug_gradients_gpu(
10751075
cvm::real rel_error = cvm::fabs (num_diff - dx_pred) / (cvm::fabs (num_diff) + cvm::fabs(dx_pred));
10761076
cvmodule->record_gradient_error(rel_error);
10771077

1078-
cvm::log("fittingGroup atom " + cvm::to_str(ia) + ", ID " + cvm::to_str(this_atom.id) + \
1078+
cvmodule->log("fittingGroup atom " + cvm::to_str(ia) + ", ID " + cvm::to_str(this_atom.id) + \
10791079
", comp. " + cvm::to_str(id) + ":" + \
10801080
" dx(actual) = " + cvm::to_str (num_diff, 19, 12) + \
10811081
" dx(interp) = " + cvm::to_str (dx_pred, 19, 12) + \
@@ -1084,7 +1084,7 @@ int colvar::cvc::debug_gradients_gpu(
10841084

10851085
}
10861086
}
1087-
cvm::log("Gradient sum: " + cvm::to_str(gradient_sum) +
1087+
cvmodule->log("Gradient sum: " + cvm::to_str(gradient_sum) +
10881088
" Fit gradient sum: " + cvm::to_str(fit_gradient_sum) +
10891089
" Total " + cvm::to_str(gradient_sum + fit_gradient_sum));
10901090
}

src/colvarcomp_distances.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ colvar::rmsd::rmsd()
843843

844844
colvar::rmsd::~rmsd() {
845845
#if defined (COLVARS_CUDA) || defined (COLVARS_HIP)
846-
colvarproxy* p = cvm::proxy;
846+
colvarproxy* p = cvmodule->proxy;
847847
if (colvar::rmsd::has_gpu_implementation()) {
848848
p->deallocate_device(&d_ref_pos_soa);
849849
p->deallocate_device(&d_permutation_msds);
@@ -862,7 +862,7 @@ colvar::rmsd::~rmsd() {
862862

863863
bool colvar::rmsd::has_gpu_implementation() const {
864864
#if defined (COLVARS_CUDA) || defined (COLVARS_HIP)
865-
const colvarproxy* p = cvm::proxy;
865+
const colvarproxy* p = cvmodule->proxy;
866866
if (p->get_smp_mode() == colvarproxy_smp::smp_mode_t::gpu){
867867
return true;
868868
} else {
@@ -971,7 +971,7 @@ int colvar::rmsd::init(std::string const &conf)
971971
ref_pos_soa = cvm::atom_group::pos_aos_to_soa(ref_pos);
972972
if (has_gpu_implementation()) {
973973
#if defined (COLVARS_CUDA) || defined (COLVARS_GPU)
974-
colvarproxy* p = cvm::proxy;
974+
colvarproxy* p = cvmodule->proxy;
975975
error_code |= p->reallocate_device(&d_ref_pos_soa, 3 * num_ref_pos);
976976
error_code |= p->copy_HtoD(ref_pos_soa.data(), d_ref_pos_soa, 3 * num_ref_pos);
977977
error_code |= p->reallocate_device(&d_permutation_msds, n_permutations);

0 commit comments

Comments
 (0)