@@ -1215,39 +1215,42 @@ done
12151215 Architectures : []string {cpus .X86Architecture },
12161216 ScriptTemplate : `# Function to expand a range of numbers, e.g. "0-24", into an array of numbers
12171217expand_range() {
1218- local range=$1
1219- local expanded=()
1220- IFS=',' read -ra parts <<< "$range"
1221- for part in "${parts[@]}"; do
1222- if [[ $part == *-* ]]; then
1223- IFS='-' read -ra limits <<< "$part"
1224- for ((i=${limits[0]}; i<=${limits[1]}; i++)); do
1225- expanded+=("$i")
1226- done
1227- else
1228- expanded+=("$part")
1229- fi
1230- done
1231- echo "${expanded[@]}"
1218+ local range=$1
1219+ local expanded=()
1220+ IFS=',' read -ra parts <<< "$range"
1221+ for part in "${parts[@]}"; do
1222+ if [[ $part == *-* ]]; then
1223+ IFS='-' read -ra limits <<< "$part"
1224+ for ((i=${limits[0]}; i<=${limits[1]}; i++)); do
1225+ expanded+=("$i")
1226+ done
1227+ else
1228+ expanded+=("$part")
1229+ fi
1230+ done
1231+ echo "${expanded[@]}"
12321232}
12331233
12341234num_cores_per_socket=$( lscpu | grep -E 'Core\(s\) per socket:' | head -1 | awk '{print $4}' )
12351235# echo "Number of cores per socket: $num_cores_per_socket"
12361236family=$(lscpu | grep -E '^CPU family:' | awk '{print $3}')
12371237model=$(lscpu | grep -E '^Model:' | awk '{print $2}')
12381238
1239- # if GNR (family 6, model 173), we need to interleave the core-ids across dies
1240- if [ $family -eq 6 ] && [ $model -eq 173 ]; then
1241- # Get the number of dies and sockets
1242- num_devices=$(lspci -d 8086:3258 | wc -l)
1239+ # if GNR or CWF (family 6, model 173 or 221), we need to interleave the core-ids across dies
1240+ if [ $family -eq 6 ] && { [ $model -eq 173 ] || [ $model -eq 221 ]; }; then
1241+ # count the total number of compute dies
1242+ output=$(pcm-tpmi 2 0x10 -d -b 26:26)
1243+ compute_die_count=0
1244+ while read -r line; do
1245+ if [[ $line == *"entry"* && $line == *"instance"* && $line == *"value 0"* ]]; then
1246+ compute_die_count=$((compute_die_count + 1))
1247+ fi
1248+ done <<< "$output"
1249+ # echo "Number of compute dies: $compute_die_count"
12431250 num_sockets=$(lscpu | grep -E '^Socket\(s\):' | awk '{print $2}')
1244- # echo "Number of devices: $num_devices"
12451251 # echo "Number of sockets: $num_sockets"
1246- num_devices_per_die=2
1247- # Calculate the number of dies per socket
1248- dies_per_socket=$((num_devices / num_sockets / num_devices_per_die))
1252+ dies_per_socket=$(( compute_die_count / num_sockets ))
12491253 # echo "Number of dies per socket: $dies_per_socket"
1250- # Calculate the number of cores per die
12511254 cores_per_die=$((num_cores_per_socket / dies_per_socket))
12521255 # echo "Number of cores per die: $cores_per_die"
12531256
@@ -1298,7 +1301,7 @@ avx-turbo --min-threads=1 --max-threads=$num_cores_per_socket --test scalar_iadd
12981301` ,
12991302 Superuser : true ,
13001303 Lkms : []string {"msr" },
1301- Depends : []string {"avx-turbo" , "lspci " },
1304+ Depends : []string {"avx-turbo" , "pcm-tpmi " },
13021305 Sequential : true ,
13031306 },
13041307 PowerBenchmarkScriptName : {
0 commit comments