COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
hyperthread_finder.cpp
Go to the documentation of this file.
1#include <map>
2#include <fstream>
3#include <iostream>
4#include <string>
5#include <sstream>
6
7using namespace std;
8
9int main(int argv, char * argc[])
10{
11 // map (proc id, core id) to physical id
12 map< pair<int, int>, int> htmap;
13 pair< map< pair<int,int> ,int>::iterator, bool > ret;
14
15 ifstream fin(argc[1]);
16 int i=0;
17 while(!fin.eof())
18 {
19 // processor : 75
20 // physical id : 3
21 // core id : 2
22 int proc, pid, cid;
23 string line;
24 getline(fin, line);
25 size_t loc1 = line.find(":");
26 stringstream linestream1(line.substr(loc1+1, string::npos));
27 linestream1 >> proc;
28
29 getline(fin, line);
30 size_t loc2 = line.find(":");
31 stringstream linestream2(line.substr(loc2+1, string::npos));
32 linestream2 >> pid;
33
34 getline(fin, line);
35 size_t loc3 = line.find(":");
36 stringstream linestream3(line.substr(loc3+1, string::npos));
37 linestream3 >> cid;
38
39 ret = htmap.insert(map< pair<int,int>, int>::value_type(make_pair(pid,cid), proc));
40 if (ret.second)
41 {
42 cout << "rank " << i++ << "=localhost slot=" << pid <<":" << cid<< endl;
43 }
44 }
45}
int main()
Definition Driver.cpp:12