Skip to content

Commit

Permalink
fix logic for determining field to use to determine CPU flags
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Jan 10, 2025
1 parent d82a188 commit 562fd4d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 2 additions & 0 deletions init/arch_specs/eessi_arch_arm.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# ARM CPU architecture specifications (see https://gpages.juszkiewicz.com.pl/arm-socs-table/arm-socs.html for guidance)
# CPU implementers: 0x41 (ARM), 0x46 (Fujitsu) - also see https://github.com/hrw/arm-socs-table/blob/main/data/socs.yml

# Software path in EESSI | 'Vendor ID' or 'CPU implementer' | List of defining CPU features
"aarch64/a64fx" "0x46" "asimdhp sve" # Fujitsu A64FX
"aarch64/neoverse_n1" "ARM" "asimddp" # Ampere Altra
Expand Down
17 changes: 13 additions & 4 deletions init/eessi_archdetect.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,20 @@ cpupath(){
log "DEBUG" "cpupath: CPU vendor of host system: '$cpu_vendor'"

# Identify the host CPU flags or features
local cpu_flag_tag='flags'
# cpuinfo systems print different line identifiers, eg features, instead of flags
[ "${cpu_vendor}" == "ARM" ] && cpu_flag_tag='flags'
[ "${machine_type}" == "aarch64" ] && [ "${cpu_flag_tag}" == "flags" ] && cpu_flag_tag='features'
[ "${machine_type}" == "ppc64le" ] && cpu_flag_tag='cpu'
local cpu_flag_tag;
if [ "${cpu_vendor}" == "ARM" ]; then
# if CPU vendor field is ARM, then we should be able to determine CPU microarchitecture based on 'flags' field
cpu_flag_tag='flags'
# if 64-bit Arm CPU without "ARM" as vendor ID, we need to take into account 'features' field
elif [ "${machine_type}" == "aarch64" ]; then
cpu_flag_tag='features'
# on 64-bit POWER, we need to look at 'cpu' field
elif [ "${machine_type}" == "ppc64le" ]; then
cpu_flag_tag='cpu'
else
cpu_flag_tag='flags'
fi

local cpu_flags=$(get_cpuinfo "$cpu_flag_tag")
log "DEBUG" "cpupath: CPU flags of host system: '$cpu_flags'"
Expand Down

0 comments on commit 562fd4d

Please sign in to comment.