Extend task assignment code
[gromacs.git] / src / gromacs / hardware / hw_info.h
blobe86d8cdc4bed1f5f2979bf01df2f41b3d4cc1b42
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
35 #ifndef GMX_HARDWARE_HWINFO_H
36 #define GMX_HARDWARE_HWINFO_H
38 #include <string>
39 #include <vector>
41 #include "gromacs/hardware/gpu_hw_info.h"
42 #include "gromacs/utility/basedefinitions.h"
44 namespace gmx
46 class CpuInfo;
47 class HardwareTopology;
48 } // namespace
50 /* Hardware information structure with CPU and GPU information.
51 * It is initialized by gmx_detect_hardware().
52 * NOTE: this structure may only contain structures that are globally valid
53 * (i.e. must be able to be shared among all threads) */
54 struct gmx_hw_info_t
56 /* Data for our local physical node */
57 struct gmx_gpu_info_t gpu_info; /* Information about GPUs detected in the system */
59 int nthreads_hw_avail; /* Number of hardware threads available; this number
60 is based on the number of CPUs reported as available
61 by the OS at the time of detection. */
63 const gmx::CpuInfo * cpuInfo; /* Information about CPU capabilities */
64 const gmx::HardwareTopology *hardwareTopology; /* Information about hardware topology */
66 /* Data reduced through MPI over all physical nodes */
67 int nphysicalnode; /* Number of physical nodes */
68 int ncore_tot; /* Sum of #cores over all nodes, can be 0 */
69 int ncore_min; /* Min #cores over all nodes */
70 int ncore_max; /* Max #cores over all nodes */
71 int nhwthread_tot; /* Sum of #hwthreads over all nodes */
72 int nhwthread_min; /* Min #hwthreads over all nodes */
73 int nhwthread_max; /* Max #hwthreads over all nodes */
74 int ngpu_compatible_tot; /* Sum of #GPUs over all nodes */
75 int ngpu_compatible_min; /* Min #GPUs over all nodes */
76 int ngpu_compatible_max; /* Max #GPUs over all nodes */
78 int simd_suggest_min; /* Highest SIMD instruction set supported by all ranks */
79 int simd_suggest_max; /* Highest SIMD instruction set supported by at least one rank */
81 gmx_bool bIdenticalGPUs; /* TRUE if all ranks have the same type(s) and order of GPUs */
85 /* The options for the thread affinity setting, default: auto */
86 enum {
87 threadaffSEL, threadaffAUTO, threadaffON, threadaffOFF, threadaffNR
90 /*! \internal \brief Threading and GPU options, can be set automatically or by the user
92 * \todo During mdrunner(), if the user has left any of these values
93 * at their defaults (which tends to mean "choose automatically"),
94 * then those values are over-written with the result of such
95 * automation. This creates problems for the subsequent code in
96 * knowing what was done, why, and reporting correctly to the
97 * user. Find a way to improve this.
99 struct gmx_hw_opt_t
101 //! Total number of threads requested (thread-MPI + OpenMP).
102 int nthreads_tot = 0;
103 //! Number of thread-MPI threads requested.
104 int nthreads_tmpi = 0;
105 //! Number of OpenMP threads requested.
106 int nthreads_omp = 0;
107 //! Number of OpenMP threads to use on PME_only ranks.
108 int nthreads_omp_pme = 0;
109 //! Thread affinity switch, see enum above.
110 int thread_affinity = threadaffSEL;
111 //! Logical core pinning stride.
112 int core_pinning_stride = 0;
113 //! Logical core pinning offset.
114 int core_pinning_offset = 0;
115 //! Empty, or a string provided by the user declaring (unique) GPU IDs available for mdrun to use.
116 std::string gpuIdsAvailable = "";
117 //! Empty, or a string provided by the user mapping GPU tasks to devices.
118 std::string userGpuTaskAssignment = "";
121 #endif