forked from lijiext/lammps
Make SMP parallelism for Colvars optional
This commit is contained in:
parent
e02505c8cc
commit
182141b850
|
@ -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,
|
||||
|
|
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -333,7 +333,10 @@ int colvarproxy_lammps::backup_file(char const *filename)
|
|||
|
||||
int colvarproxy_lammps::smp_enabled()
|
||||
{
|
||||
return COLVARS_OK;
|
||||
if (b_smp_active) {
|
||||
return COLVARS_OK;
|
||||
}
|
||||
return COLVARS_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue