// TODO: Get rid of this altogether.
hwinfo_g->nthreads_hw_avail = hwinfo_g->hardwareTopology->machine().logicalProcessorCount;
- check_nthreads_hw_avail(mdlog, hwinfo_g->nthreads_hw_avail);
+ // If we detected the topology on this system, double-check that it makes sense
+ if (hwinfo_g->hardwareTopology->isThisSystem())
+ {
- check_nthreads_hw_avail(cr, fplog, hwinfo_g->nthreads_hw_avail);
++ check_nthreads_hw_avail(mdlog, hwinfo_g->nthreads_hw_avail);
+ }
/* detect GPUs */
hwinfo_g->gpu_info.n_dev = 0;
getenv("GMX_DISABLE_GPU_DETECTION") == NULL);
if (hwinfo_g->gpu_info.bDetectGPUs)
{
- gmx_detect_gpus(fplog, cr);
+ gmx_detect_gpus(mdlog, cr);
}
+
+ gmx_collect_hardware_mpi(*hwinfo_g->cpuInfo);
}
/* increase the reference counter */
n_hwinfo++;
{
HardwareTopology result;
- result.supportLevel_ = SupportLevel::None;
- // Default values for machine and numa stuff
- result.machine_.logicalProcessorCount = 0;
- result.machine_.numa.baseLatency = 0.0;
- result.machine_.numa.maxRelativeLatency = 0.0;
- result.supportLevel_ = SupportLevel::None;
- result.isThisSystem_ = true;
--
#if GMX_HWLOC
- parseHwLoc(&result.machine_, &result.supportLevel_);
+ parseHwLoc(&result.machine_, &result.supportLevel_, &result.isThisSystem_);
#endif
// If something went wrong in hwloc (or if it was not present) we might
return result;
}
+HardwareTopology::Machine::Machine()
+{
+ logicalProcessorCount = 0;
+ numa.baseLatency = 0.0;
+ numa.maxRelativeLatency = 0.0;
+}
+
HardwareTopology::HardwareTopology()
-- : supportLevel_(SupportLevel::None)
++ : supportLevel_(SupportLevel::None),
++ machine_(),
++ isThisSystem_(true)
{
}
- : supportLevel_(SupportLevel::None)
+HardwareTopology::HardwareTopology(int logicalProcessorCount)
++ : supportLevel_(SupportLevel::None),
++ machine_(),
++ isThisSystem_(true)
+{
+ if (logicalProcessorCount > 0)
+ {
+ machine_.logicalProcessorCount = logicalProcessorCount;
+ supportLevel_ = SupportLevel::LogicalProcessorCount;
+ }
+}
+
int HardwareTopology::numberOfCores() const
{
if (supportLevel() >= SupportLevel::Basic)
#include "gromacs/topology/mtop_util.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/utility/cstringutil.h"
+ #include "gromacs/utility/exceptions.h"
#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/logger.h"
#include "gromacs/utility/pleasecite.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
return nbv != NULL && nbv->bUseGPU;
}
-void init_forcerec(FILE *fp,
- t_forcerec *fr,
- t_fcdata *fcd,
- const t_inputrec *ir,
- const gmx_mtop_t *mtop,
- const t_commrec *cr,
- matrix box,
- const char *tabfn,
- const char *tabpfn,
- const t_filenm *tabbfnm,
- const char *nbpu_opt,
- gmx_bool bNoSolvOpt,
- real print_force)
+void init_forcerec(FILE *fp,
+ const gmx::MDLogger &mdlog,
+ t_forcerec *fr,
+ t_fcdata *fcd,
+ const t_inputrec *ir,
+ const gmx_mtop_t *mtop,
+ const t_commrec *cr,
+ matrix box,
+ const char *tabfn,
+ const char *tabpfn,
- const char *tabbfn,
++ const t_filenm *tabbfnm,
+ const char *nbpu_opt,
+ gmx_bool bNoSolvOpt,
+ real print_force)
{
int i, m, negp_pp, negptable, egi, egj;
real rtab;
struct t_commrec;
struct t_fcdata;
+ struct t_filenm;
+namespace gmx
+{
+class MDLogger;
+}
+
/*! \brief Create a new forcerec structure */
t_forcerec *mk_forcerec(void);
fr = mk_forcerec();
fr->hwinfo = hwinfo;
fr->gpu_opt = &hw_opt->gpu_opt;
- init_forcerec(fplog, fr, fcd, inputrec, mtop, cr, box,
+ init_forcerec(fplog, mdlog, fr, fcd, inputrec, mtop, cr, box,
opt2fn("-table", nfile, fnm),
opt2fn("-tablep", nfile, fnm),
- opt2fn("-tableb", nfile, fnm),
+ getFilenm("-tableb", nfile, fnm),
nbpu_opt,
FALSE,
pforce);