Skip to content

Commit 9e888b3

Browse files
committed
debug: Print debug statements only from within host code
1 parent 9722e54 commit 9e888b3

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/colvarmodule.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,13 @@ static inline real acos(real const &x)
374374
std::vector<colvarbias *> *biases_active();
375375

376376
/// \brief Whether debug output should be enabled (compile-time option)
377-
static inline bool debug()
377+
static inline bool constexpr debug()
378378
{
379+
#if (defined(__HIP_DEVICE_COMPILE__)) || (defined(__CUDA_ARCH__))
380+
return false;
381+
#else
379382
return COLVARS_DEBUG;
383+
#endif
380384
}
381385

382386
/// How many objects (variables and biases) are configured yet?

src/colvars_system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ inline COLVARS_HOST_DEVICE void cvm::system_boundary_conditions::set_boundaries(
154154
reciprocal_cell_z = v_xy / (v_xy * unit_cell_z);
155155
}
156156

157-
if (true) {
157+
if (cvm::debug()) {
158158
cvm::log("periodic_x = " + cvm::to_str(periodic_x));
159159
cvm::log("periodic_y = " + cvm::to_str(periodic_y));
160160
cvm::log("periodic_z = " + cvm::to_str(periodic_z));

0 commit comments

Comments
 (0)