static bool
get_thread_affinity_layout(FILE *fplog,
const t_commrec *cr,
- const gmx_hw_info_t * hwinfo,
+ const gmx::HardwareTopology &hwTop,
int threads,
bool automatic,
int pin_offset, int * pin_stride,
bool haveTopology;
bool invalidValue;
- const gmx::HardwareTopology &hwTop = *hwinfo->hardwareTopology;
-
haveTopology = (hwTop.supportLevel() >= gmx::HardwareTopology::SupportLevel::Basic);
if (pin_offset < 0)
else
{
/* topology information not available or invalid, ignore it */
- hwThreads = hwinfo->nthreads_hw_avail;
+ hwThreads = hwTop.machine().logicalProcessorCount;
*localityOrder = NULL;
}
// Only warn about the first problem per node. Otherwise, the first test
if only PME is using threads.
*/
void
-gmx_set_thread_affinity(FILE *fplog,
- const t_commrec *cr,
- const gmx_hw_opt_t *hw_opt,
- const gmx_hw_info_t *hwinfo)
+gmx_set_thread_affinity(FILE *fplog,
+ const t_commrec *cr,
+ const gmx_hw_opt_t *hw_opt,
+ const gmx::HardwareTopology &hwTop)
{
int thread0_id_node,
nthread_local, nthread_node;
bool automatic = (hw_opt->thread_affinity == threadaffAUTO);
bool validLayout
- = get_thread_affinity_layout(fplog, cr, hwinfo, nthread_node, automatic,
+ = get_thread_affinity_layout(fplog, cr, hwTop, nthread_node, automatic,
offset, &core_pinning_stride, &localityOrder);
gmx::scoped_guard_sfree localityOrderGuard(localityOrder);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include <cstdio>
-#include "gromacs/hardware/hw_info.h"
#include "gromacs/utility/basedefinitions.h"
+struct gmx_hw_opt_t;
struct t_commrec;
+namespace gmx
+{
+class HardwareTopology;
+}
+
/*! \brief
* Sets the thread affinity using the requested setting stored in hw_opt.
- *
- * The hardware topology is requested from hwinfo, when present.
*/
void
-gmx_set_thread_affinity(FILE *fplog,
- const t_commrec *cr,
- const gmx_hw_opt_t *hw_opt,
- const gmx_hw_info_t *hwinfo);
+gmx_set_thread_affinity(FILE *fplog,
+ const t_commrec *cr,
+ const gmx_hw_opt_t *hw_opt,
+ const gmx::HardwareTopology &hwTop);
/*! \brief
* Checks the process affinity mask and if it is found to be non-zero,
hw_opt, hwinfo->nthreads_hw_avail, TRUE);
/* Set the CPU affinity */
- gmx_set_thread_affinity(fplog, cr, hw_opt, hwinfo);
+ gmx_set_thread_affinity(fplog, cr, hw_opt, *hwinfo->hardwareTopology);
}
/* Initiate PME if necessary,