Galois
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HWTopo.h
Go to the documentation of this file.
1 /*
2  * This file belongs to the Galois project, a C++ library for exploiting
3  * parallelism. The code is being released under the terms of the 3-Clause BSD
4  * License (a copy is located in LICENSE.txt at the top-level directory).
5  *
6  * Copyright (C) 2018, The University of Texas at Austin. All rights reserved.
7  * UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS
8  * SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY,
9  * FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF
10  * PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF
11  * DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH
12  * RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances
13  * shall University be liable for incidental, special, indirect, direct or
14  * consequential damages or loss of profits, interruption of business, or
15  * related expenses which may arise from use of Software or Documentation,
16  * including but not limited to those resulting from defects in Software and/or
17  * Documentation, or loss or inaccuracy of data of any kind.
18  */
19 
20 #ifndef GALOIS_SUBSTRATE_HWTOPO_H
21 #define GALOIS_SUBSTRATE_HWTOPO_H
22 
23 #include <string>
24 #include <vector>
25 
26 #include "galois/config.h"
27 
28 namespace galois::substrate {
29 
31  unsigned tid; // this thread (galois id)
32  unsigned socketLeader; // first thread id in tid's socket
33  unsigned socket; // socket (L3 normally) of thread
34  unsigned numaNode; // memory bank. may be different than socket.
35  unsigned cumulativeMaxSocket; // max socket id seen from [0, tid]
36  unsigned osContext; // OS ID to use for thread binding
37  unsigned osNumaNode; // OS ID for numa node
38 };
39 
41  unsigned maxThreads;
42  unsigned maxCores;
43  unsigned maxSockets;
44  unsigned maxNumaNodes;
45 };
46 
47 struct HWTopoInfo {
49  std::vector<ThreadTopoInfo> threadTopoInfo;
50 };
51 
57 
62 std::vector<int> parseCPUList(const std::string& in);
63 
67 bool bindThreadSelf(unsigned osContext);
68 
69 } // namespace galois::substrate
70 
71 #endif
std::vector< ThreadTopoInfo > threadTopoInfo
Definition: HWTopo.h:49
unsigned osContext
Definition: HWTopo.h:36
unsigned maxThreads
Definition: HWTopo.h:41
unsigned tid
Definition: HWTopo.h:31
unsigned osNumaNode
Definition: HWTopo.h:37
unsigned maxSockets
Definition: HWTopo.h:43
unsigned maxCores
Definition: HWTopo.h:42
MachineTopoInfo machineTopoInfo
Definition: HWTopo.h:48
unsigned socketLeader
Definition: HWTopo.h:32
Definition: HWTopo.h:47
unsigned numaNode
Definition: HWTopo.h:34
bool bindThreadSelf(unsigned osContext)
bindThreadSelf binds a thread to an osContext as returned by getHWTopo.
Definition: HWTopoDarwin.cpp:115
HWTopoInfo getHWTopo()
getHWTopo determines the machine topology from the process information exposed in /proc and /dev file...
Definition: HWTopoDarwin.cpp:130
std::vector< int > parseCPUList(const std::string &in)
parseCPUList parses cpuset information in &quot;List format&quot; as described in cpuset(7) and available under...
Definition: HWTopo.cpp:5
Definition: HWTopo.h:30
Definition: HWTopo.h:40
unsigned cumulativeMaxSocket
Definition: HWTopo.h:35
unsigned maxNumaNodes
Definition: HWTopo.h:44
unsigned socket
Definition: HWTopo.h:33