Skip to content

Commit 686ac58

Browse files
authored
Merge pull request EESSI#264 from ocaisa/ocaisa-patch-2
Allow `archdetect` to print all possible cpu paths + fix paths for `aarch64/*` (drop `/arm/` subdir)
2 parents 8d8be67 + 409ba53 commit 686ac58

20 files changed

+50
-19
lines changed

.github/workflows/tests_archdetect.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ jobs:
1414
- x86_64/amd/zen2/Azure-CentOS7-7V12
1515
- x86_64/amd/zen3/Azure-CentOS7-7V73X
1616
- ppc64le/power9le/unknown-power9le
17-
- aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra
18-
- aarch64/arm/neoverse-n1/AWS-awslinux-graviton2
19-
- aarch64/arm/neoverse-v1/AWS-awslinux-graviton3
17+
- aarch64/neoverse_n1/Azure-Ubuntu20-Altra
18+
- aarch64/neoverse_n1/AWS-awslinux-graviton2
19+
- aarch64/neoverse_v1/AWS-awslinux-graviton3
2020
fail-fast: false
2121
steps:
2222
- name: checkout
2323
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
24-
24+
- name: Enable EESSI
25+
uses: eessi/github-action-eessi@58b50fd2eead2162c2b9ac258d4fb60cc9f30503 # v2.0.13
2526
- name: test eessi_archdetect.sh
2627
run: |
2728
export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}}
@@ -34,3 +35,15 @@ jobs:
3435
echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2
3536
exit 1
3637
fi
38+
CPU_ARCHES=$(./init/eessi_archdetect.sh -a cpupath)
39+
if [[ $CPU_ARCHES == "$( cat ./tests/archdetect/${{matrix.proc_cpuinfo}}.all.output )" ]]; then
40+
echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCHES" >&2
41+
else
42+
echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCHES" >&2
43+
exit 1
44+
fi
45+
# Check all those architectures actually exist
46+
for dir in $(echo "$CPU_ARCHES" | tr ':' '\n'); do
47+
# Search all EESSI versions as we may drop support at some point
48+
ls -d "$EESSI_PREFIX"/../*/software/linux/"$dir"
49+
done
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ARM CPU architecture specifications
22
# Software path in EESSI | Vendor ID | List of defining CPU features
3-
"aarch64/arm/neoverse-n1" "ARM" "asimd" # Ampere Altra
4-
"aarch64/arm/neoverse-n1" "" "asimd" # AWS Graviton2
5-
"aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm"
6-
"aarch64/arm/neoverse-v1" "" "asimd svei8mm" # AWS Graviton3
3+
"aarch64/neoverse_n1" "ARM" "asimd" # Ampere Altra
4+
"aarch64/neoverse_n1" "" "asimd" # AWS Graviton2
5+
"aarch64/neoverse_v1" "ARM" "asimd svei8mm"
6+
"aarch64/neoverse_v1" "" "asimd svei8mm" # AWS Graviton3

init/eessi_archdetect.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/usr/bin/env bash
2-
VERSION="1.0.0"
2+
VERSION="1.1.0"
33

44
# Logging
55
LOG_LEVEL="INFO"
6+
# Default result type is a best match
7+
CPUPATH_RESULT="best"
68

79
timestamp () {
810
date "+%Y-%m-%d %H:%M:%S"
@@ -105,7 +107,8 @@ cpupath(){
105107
log "DEBUG" "cpupath: CPU flags of host system: '$cpu_flags'"
106108

107109
# Default to generic CPU
108-
local best_arch_match="generic"
110+
local best_arch_match="$machine_type/generic"
111+
local all_arch_matches=$best_arch_match
109112

110113
# Iterate over the supported CPU specifications to find the best match for host CPU
111114
# Order of the specifications matters, the last one to match will be selected
@@ -114,22 +117,29 @@ cpupath(){
114117
if [ "${cpu_vendor}x" == "${arch_spec[1]}x" ]; then
115118
# each flag in this CPU specification must be found in the list of flags of the host
116119
check_allinfirst "${cpu_flags[*]}" ${arch_spec[2]} && best_arch_match=${arch_spec[0]} && \
117-
log "DEBUG" "cpupath: host CPU best match updated to $best_arch_match"
120+
all_arch_matches="$best_arch_match:$all_arch_matches" && \
121+
log "DEBUG" "cpupath: host CPU best match updated to $best_arch_match"
118122
fi
119123
done
120124

121-
log "INFO" "cpupath: best match for host CPU: $best_arch_match"
122-
echo "$best_arch_match"
125+
if [ "allx" == "${CPUPATH_RESULT}x" ]; then
126+
log "INFO" "cpupath: all matches for host CPU: $all_arch_matches"
127+
echo "$all_arch_matches"
128+
else
129+
log "INFO" "cpupath: best match for host CPU: $best_arch_match"
130+
echo "$best_arch_match"
131+
fi
123132
}
124133

125134
# Parse command line arguments
126-
USAGE="Usage: eessi_archdetect.sh [-h][-d] <action>"
135+
USAGE="Usage: eessi_archdetect.sh [-h][-d][-a] <action>"
127136

128-
while getopts 'hdv' OPTION; do
137+
while getopts 'hdva' OPTION; do
129138
case "$OPTION" in
130139
h) echo "$USAGE"; exit 0;;
131140
d) LOG_LEVEL="DEBUG";;
132141
v) echo "eessi_archdetect.sh v$VERSION"; exit 0;;
142+
a) CPUPATH_RESULT="all";;
133143
?) echo "$USAGE"; exit 1;;
134144
esac
135145
done
@@ -139,5 +149,5 @@ ARGUMENT=${1:-none}
139149

140150
case "$ARGUMENT" in
141151
"cpupath") cpupath; exit;;
142-
*) echo "$USAGE"; log "ERROR" "Missing <action> argument";;
152+
*) echo "$USAGE"; log "ERROR" "Missing <action> argument (possible actions: 'cpupath')";;
143153
esac

tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aarch64/neoverse_n1:aarch64/generic

tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.cpuinfo renamed to tests/archdetect/aarch64/neoverse_n1/AWS-awslinux-graviton2.cpuinfo

File renamed without changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aarch64/neoverse_n1
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
aarch64/neoverse_n1:aarch64/generic

0 commit comments

Comments
 (0)