@@ -609,6 +609,8 @@ bool PCM::detectModel()
609
609
610
610
pcm_cpuid (7 , 0 , cpuinfo);
611
611
612
+ std::cerr << " \n ===== Processor information =====\n " ;
613
+
612
614
#ifdef __linux__
613
615
auto checkLinuxCpuinfoFlag = [](const std::string& flag) -> bool
614
616
{
@@ -1361,69 +1363,6 @@ bool PCM::discoverSystemTopology()
1361
1363
1362
1364
#endif // end of ifdef _MSC_VER
1363
1365
1364
- // produce debug output similar to Intel MPI cpuinfo
1365
- #ifndef PCM_DEBUG_TOPOLOGY
1366
- if (safe_getenv (" PCM_PRINT_TOPOLOGY" ) == " 1" )
1367
- #endif
1368
- {
1369
- std::cerr << " ===== Processor identification =====\n " ;
1370
- std::cerr << " Processor Thread Id. Core Id. Tile Id. Package Id. Core Type. Native CPU Model.\n " ;
1371
- std::map<uint32, std::vector<uint32> > os_id_by_core, os_id_by_tile, core_id_by_socket;
1372
- for (auto it = topology.begin (); it != topology.end (); ++it)
1373
- {
1374
- std::cerr << std::left << std::setfill (' ' )
1375
- << std::setw (16 ) << it->os_id
1376
- << std::setw (16 ) << it->thread_id
1377
- << std::setw (16 ) << it->core_id
1378
- << std::setw (16 ) << it->tile_id
1379
- << std::setw (16 ) << it->socket
1380
- << std::setw (16 ) << it->getCoreTypeStr ()
1381
- << std::setw (16 ) << it->native_cpu_model
1382
- << " \n " ;
1383
- if (std::find (core_id_by_socket[it->socket ].begin (), core_id_by_socket[it->socket ].end (), it->core_id )
1384
- == core_id_by_socket[it->socket ].end ())
1385
- core_id_by_socket[it->socket ].push_back (it->core_id );
1386
- // add socket offset to distinguish cores and tiles from different sockets
1387
- os_id_by_core[(it->socket << 15 ) + it->core_id ].push_back (it->os_id );
1388
- os_id_by_tile[(it->socket << 15 ) + it->tile_id ].push_back (it->os_id );
1389
- }
1390
- std::cerr << " ===== Placement on packages =====\n " ;
1391
- std::cerr << " Package Id. Core Id. Processors\n " ;
1392
- for (auto pkg = core_id_by_socket.begin (); pkg != core_id_by_socket.end (); ++pkg)
1393
- {
1394
- auto core_id = pkg->second .begin ();
1395
- std::cerr << std::left << std::setfill (' ' ) << std::setw (15 ) << pkg->first << *core_id;
1396
- for (++core_id; core_id != pkg->second .end (); ++core_id)
1397
- {
1398
- std::cerr << " ," << *core_id;
1399
- }
1400
- std::cerr << " \n " ;
1401
- }
1402
- std::cerr << " \n ===== Core/Tile sharing =====\n " ;
1403
- std::cerr << " Level Processors\n Core " ;
1404
- for (auto core = os_id_by_core.begin (); core != os_id_by_core.end (); ++core)
1405
- {
1406
- auto os_id = core->second .begin ();
1407
- std::cerr << " (" << *os_id;
1408
- for (++os_id; os_id != core->second .end (); ++os_id) {
1409
- std::cerr << " ," << *os_id;
1410
- }
1411
- std::cerr << " )" ;
1412
- }
1413
- std::cerr << " \n Tile / L2$ " ;
1414
- for (auto core = os_id_by_tile.begin (); core != os_id_by_tile.end (); ++core)
1415
- {
1416
- auto os_id = core->second .begin ();
1417
- std::cerr << " (" << *os_id;
1418
- for (++os_id; os_id != core->second .end (); ++os_id) {
1419
- std::cerr << " ," << *os_id;
1420
- }
1421
- std::cerr << " )" ;
1422
- }
1423
- std::cerr << " \n " ;
1424
- std::cerr << " \n " ;
1425
- }
1426
-
1427
1366
if (num_cores == 0 ) {
1428
1367
num_cores = (int32)topology.size ();
1429
1368
}
@@ -2268,6 +2207,8 @@ PCM::PCM() :
2268
2207
2269
2208
showSpecControlMSRs ();
2270
2209
2210
+ printDetailedSystemTopology ();
2211
+
2271
2212
initEnergyMonitoring ();
2272
2213
2273
2214
initUncoreObjects ();
@@ -2288,6 +2229,72 @@ PCM::PCM() :
2288
2229
}
2289
2230
}
2290
2231
2232
+ void PCM::printDetailedSystemTopology ()
2233
+ {
2234
+ // produce debug output similar to Intel MPI cpuinfo
2235
+ #ifndef PCM_DEBUG_TOPOLOGY
2236
+ if (safe_getenv (" PCM_PRINT_TOPOLOGY" ) == " 1" )
2237
+ #endif
2238
+ {
2239
+ std::cerr << " \n ===== Processor topology =====\n " ;
2240
+ std::cerr << " OS_Processor Thread_Id Core_Id Tile_Id Package_Id Core_Type Native_CPU_Model\n " ;
2241
+ std::map<uint32, std::vector<uint32> > os_id_by_core, os_id_by_tile, core_id_by_socket;
2242
+ for (auto it = topology.begin (); it != topology.end (); ++it)
2243
+ {
2244
+ std::cerr << std::left << std::setfill (' ' )
2245
+ << std::setw (16 ) << it->os_id
2246
+ << std::setw (16 ) << it->thread_id
2247
+ << std::setw (16 ) << it->core_id
2248
+ << std::setw (16 ) << it->tile_id
2249
+ << std::setw (16 ) << it->socket
2250
+ << std::setw (16 ) << it->getCoreTypeStr ()
2251
+ << std::setw (16 ) << it->native_cpu_model
2252
+ << " \n " ;
2253
+ if (std::find (core_id_by_socket[it->socket ].begin (), core_id_by_socket[it->socket ].end (), it->core_id )
2254
+ == core_id_by_socket[it->socket ].end ())
2255
+ core_id_by_socket[it->socket ].push_back (it->core_id );
2256
+ // add socket offset to distinguish cores and tiles from different sockets
2257
+ os_id_by_core[(it->socket << 15 ) + it->core_id ].push_back (it->os_id );
2258
+ os_id_by_tile[(it->socket << 15 ) + it->tile_id ].push_back (it->os_id );
2259
+ }
2260
+ std::cerr << " ===== Placement on packages =====\n " ;
2261
+ std::cerr << " Package Id. Core Id. Processors\n " ;
2262
+ for (auto pkg = core_id_by_socket.begin (); pkg != core_id_by_socket.end (); ++pkg)
2263
+ {
2264
+ auto core_id = pkg->second .begin ();
2265
+ std::cerr << std::left << std::setfill (' ' ) << std::setw (15 ) << pkg->first << *core_id;
2266
+ for (++core_id; core_id != pkg->second .end (); ++core_id)
2267
+ {
2268
+ std::cerr << " ," << *core_id;
2269
+ }
2270
+ std::cerr << " \n " ;
2271
+ }
2272
+ std::cerr << " \n ===== Core/Tile sharing =====\n " ;
2273
+ std::cerr << " Level Processors\n Core " ;
2274
+ for (auto core = os_id_by_core.begin (); core != os_id_by_core.end (); ++core)
2275
+ {
2276
+ auto os_id = core->second .begin ();
2277
+ std::cerr << " (" << *os_id;
2278
+ for (++os_id; os_id != core->second .end (); ++os_id) {
2279
+ std::cerr << " ," << *os_id;
2280
+ }
2281
+ std::cerr << " )" ;
2282
+ }
2283
+ std::cerr << " \n Tile / L2$ " ;
2284
+ for (auto core = os_id_by_tile.begin (); core != os_id_by_tile.end (); ++core)
2285
+ {
2286
+ auto os_id = core->second .begin ();
2287
+ std::cerr << " (" << *os_id;
2288
+ for (++os_id; os_id != core->second .end (); ++os_id) {
2289
+ std::cerr << " ," << *os_id;
2290
+ }
2291
+ std::cerr << " )" ;
2292
+ }
2293
+ std::cerr << " \n " ;
2294
+ std::cerr << " \n " ;
2295
+ }
2296
+ }
2297
+
2291
2298
void PCM::enableJKTWorkaround (bool enable)
2292
2299
{
2293
2300
if (disable_JKT_workaround) return ;
0 commit comments