Skip to content

Commit

Permalink
Merge pull request EESSI#396 from boegel/2023.06-pilot.eessi-hpc.org
Browse files Browse the repository at this point in the history
Allow archdetect to print all possible cpu paths + fix paths for `aarch64/*` (drop `/arm/` subdir)
  • Loading branch information
ocaisa authored Nov 25, 2023
2 parents 77c8845 + e22453e commit 2a66987
Show file tree
Hide file tree
Showing 20 changed files with 50 additions and 19 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/tests_archdetect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ jobs:
- x86_64/amd/zen2/Azure-CentOS7-7V12
- x86_64/amd/zen3/Azure-CentOS7-7V73X
- ppc64le/power9le/unknown-power9le
- aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra
- aarch64/arm/neoverse-n1/AWS-awslinux-graviton2
- aarch64/arm/neoverse-v1/AWS-awslinux-graviton3
- aarch64/neoverse_n1/Azure-Ubuntu20-Altra
- aarch64/neoverse_n1/AWS-awslinux-graviton2
- aarch64/neoverse_v1/AWS-awslinux-graviton3
fail-fast: false
steps:
- name: checkout
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0

- name: Enable EESSI
uses: eessi/github-action-eessi@58b50fd2eead2162c2b9ac258d4fb60cc9f30503 # v2.0.13
- name: test eessi_archdetect.sh
run: |
export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}}
Expand All @@ -34,3 +35,15 @@ jobs:
echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2
exit 1
fi
CPU_ARCHES=$(./init/eessi_archdetect.sh -a cpupath)
if [[ $CPU_ARCHES == "$( cat ./tests/archdetect/${{matrix.proc_cpuinfo}}.all.output )" ]]; then
echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCHES" >&2
else
echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCHES" >&2
exit 1
fi
# Check all those architectures actually exist
for dir in $(echo "$CPU_ARCHES" | tr ':' '\n'); do
# Search all EESSI versions as we may drop support at some point
ls -d "$EESSI_PREFIX"/../*/software/linux/"$dir"
done
8 changes: 4 additions & 4 deletions init/arch_specs/eessi_arch_arm.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ARM CPU architecture specifications
# Software path in EESSI | Vendor ID | List of defining CPU features
"aarch64/arm/neoverse-n1" "ARM" "asimd" # Ampere Altra
"aarch64/arm/neoverse-n1" "" "asimd" # AWS Graviton2
"aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm"
"aarch64/arm/neoverse-v1" "" "asimd svei8mm" # AWS Graviton3
"aarch64/neoverse_n1" "ARM" "asimd" # Ampere Altra
"aarch64/neoverse_n1" "" "asimd" # AWS Graviton2
"aarch64/neoverse_v1" "ARM" "asimd svei8mm"
"aarch64/neoverse_v1" "" "asimd svei8mm" # AWS Graviton3
26 changes: 18 additions & 8 deletions init/eessi_archdetect.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/usr/bin/env bash
VERSION="1.0.0"
VERSION="1.1.0"

# Logging
LOG_LEVEL="INFO"
# Default result type is a best match
CPUPATH_RESULT="best"

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

# Default to generic CPU
local best_arch_match="generic"
local best_arch_match="$machine_type/generic"
local all_arch_matches=$best_arch_match

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

log "INFO" "cpupath: best match for host CPU: $best_arch_match"
echo "$best_arch_match"
if [ "allx" == "${CPUPATH_RESULT}x" ]; then
log "INFO" "cpupath: all matches for host CPU: $all_arch_matches"
echo "$all_arch_matches"
else
log "INFO" "cpupath: best match for host CPU: $best_arch_match"
echo "$best_arch_match"
fi
}

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

while getopts 'hdv' OPTION; do
while getopts 'hdva' OPTION; do
case "$OPTION" in
h) echo "$USAGE"; exit 0;;
d) LOG_LEVEL="DEBUG";;
v) echo "eessi_archdetect.sh v$VERSION"; exit 0;;
a) CPUPATH_RESULT="all";;
?) echo "$USAGE"; exit 1;;
esac
done
Expand All @@ -139,5 +149,5 @@ ARGUMENT=${1:-none}

case "$ARGUMENT" in
"cpupath") cpupath; exit;;
*) echo "$USAGE"; log "ERROR" "Missing <action> argument";;
*) echo "$USAGE"; log "ERROR" "Missing <action> argument (possible actions: 'cpupath')";;
esac

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/neoverse_n1:aarch64/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/neoverse_n1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/neoverse_n1:aarch64/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/neoverse_n1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/neoverse_v1:aarch64/neoverse_n1:aarch64/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
aarch64/neoverse_v1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ppc64le/power9le:ppc64le/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x86_64/amd/zen2:x86_64/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x86_64/amd/zen3:x86_64/amd/zen2:x86_64/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x86_64/intel/haswell:x86_64/generic
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x86_64/intel/skylake_avx512:x86_64/intel/haswell:x86_64/generic

0 comments on commit 2a66987

Please sign in to comment.