Skip to content

TheMatthew/hyperthread_utils

Repository files navigation

hyperthread_utils

Hyper Threading (SMT) helpers

read_topology.py

reads the topology files in Linux.

usage: python3 read_topology.py

output

CPU        Core ID    Physical Package ID 
----------------------------------------
cpu0       0          0                   
cpu8       0          0                   
cpu1       1          0                   
cpu9       1          0                   
cpu10      2          0                   
cpu2       2          0                   
cpu11      3          0                   
cpu3       3          0                   
cpu12      4          0                   
cpu4       4          0                   
cpu13      5          0                   
cpu5       5          0                   
cpu14      6          0                   
cpu6       6          0                   
cpu15      7          0                   
cpu7       7          0                   

cross_core_test.cpp

Test inter core communication latency

Compile

g++ cross_core_test.cpp -o cross_core_test

or

make

Run

For latency

./cross_core_test

For Bandwidth

./cross_core_bench

results

For a 16 core ryzen, the results look like

CPU	0	1	2	3	4	5	6	7	8	9	10	11	12	13	14	15
0	0	62.294	92.049	108.409	285.671	297.455	294.568	296.252	71.249	63.333	73.745	116.718	295.835	299.795	299.681	299.917
1	73.329	0	127.725	105.381	300.728	295.337	294.227	299.989	71.265	71.656	65.799	66.842	300.469	304.246	306.089	307.116
2	166.723	112.265	0	143.077	312.171	306.554	293.393	306.414	73.313	98.282	72.78	70.749	297.82	307.213	298.214	297.792
3	103.173	64.414	74.753	0	295.646	298.557	288.412	299.014	146.153	94.253	141.302	72.714	299.706	304.709	305.162	313.76
4	300.204	296.106	300.033	310.444	0	67.561	136.691	89.873	300.075	305.911	299.96	298.283	71.223	77.317	79.5	99.389
5	302.509	304.178	299.708	302.307	68.703	0	112.564	71.546	301.205	305.351	304.086	294.849	131.485	71.444	60.71	64.064
6	296.597	300.421	291.959	296.693	67.089	63.387	0	64.506	294.896	299.026	293.066	298.684	65.818	88.101	72.65	64
7	299.037	306.425	294.272	303.968	107.94	140.504	80.916	0	304.151	306.171	300.099	299.465	95.268	64.143	93.066	72.053
8	75.504	62.399	134.186	125.914	310.512	301.329	299.517	301.555	0	65.07	78.645	82.324	304.611	304.121	300.99	298.206
9	93.755	72.883	134.701	67.999	299.199	295.025	303.916	305.514	122.687	0	101.972	79.827	301.016	304.206	295.516	300.981
10	63.737	63.257	73.273	108.031	286.636	299.824	295.542	302.332	76.723	65.813	0	61.95	299.276	299.004	300.614	295.443
11	108.335	83.869	131.626	73.128	294.655	289.375	294.715	293.516	104.199	78.86	79.684	0	299.026	298.721	294.107	306.622
12	297.723	292.901	302.142	302.096	73.094	80.073	135.197	136.017	297.059	303.678	300.134	298.527	0	64.745	94.32	114.271
13	299.979	289.832	298.722	306.671	65.698	72.976	128.347	62.548	302.771	303.877	297.96	297.489	73.365	0	63.172	82.316
14	300.807	300.236	301.28	296.584	69.114	63.271	72.865	81.975	295.176	299.75	293.971	300.862	72.371	76.277	0	71.612
15	297.165	282.29	297.686	301.04	89.494	63.266	82.127	73.273	297.067	297.738	292.76	295.256	93.479	65.896	82.324	0

To convert CSVs to a heatmap, call the heatmapify.py program as follows

python3 heatmapify.py input.csv output.png

About

Hyper Threading (SMT) helpers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •