Commit 182141b8 authored by Giacomo Fiorin's avatar Giacomo Fiorin
Browse files

Make SMP parallelism for Colvars optional

parent e02505c8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -156,6 +156,12 @@ int colvarmodule::parse_global_params(std::string const &conf)
    read_index_file(index_file_name.c_str());
  }

  if (parse->get_keyval(conf, "smp", proxy->b_smp_active, proxy->b_smp_active)) {
    if (proxy->b_smp_active == false) {
      cvm::log("SMP parallelism has been disabled.\n");
    }
  }

  parse->get_keyval(conf, "analysis", b_analysis, b_analysis);

  parse->get_keyval(conf, "debugGradientsStepSize", debug_gradients_step_size,
+5 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ public:
  colvarmodule *colvars;

  /// Default constructor
  inline colvarproxy() : script(NULL) {}
  inline colvarproxy() : script(NULL), b_smp_active(true) {}

  /// Default destructor
  virtual ~colvarproxy() {}
@@ -116,12 +116,15 @@ public:

  // ***************** SHARED-MEMORY PARALLELIZATION *****************

  /// Whether or not threaded parallelization is available
  /// Whether threaded parallelization is available (TODO: make this a cvm::deps feature)
  virtual int smp_enabled()
  {
    return COLVARS_NOT_IMPLEMENTED;
  }

  /// Whether threaded parallelization should be used (TODO: make this a cvm::deps feature)
  bool b_smp_active;

  /// Distribute calculation of colvars (and their components) across threads
  virtual int smp_colvars_loop()
  {
+4 −1
Original line number Diff line number Diff line
@@ -333,8 +333,11 @@ int colvarproxy_lammps::backup_file(char const *filename)

int colvarproxy_lammps::smp_enabled()
{
  if (b_smp_active) {
    return COLVARS_OK;
  }
  return COLVARS_ERROR;
}


int colvarproxy_lammps::smp_colvars_loop()