From ef1ae0baaf21cbf7f69d4d74b6a4aef24502905c Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Wed, 18 Jan 2023 19:40:41 +0100 Subject: [PATCH] add support for Raspberry Pi --- .github/workflows/tests_archdetect.yml | 1 + init/arch_specs/eessi_arch_arm_part.spec | 5 +++++ init/eessi_archdetect.sh | 22 ++++++++++++++----- .../arm/cortex-a72/debian-rpi4.cpuinfo | 8 +++++++ .../aarch64/arm/cortex-a72/debian-rpi4.output | 1 + 5 files changed, 31 insertions(+), 6 deletions(-) create mode 100755 init/arch_specs/eessi_arch_arm_part.spec create mode 100644 tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.cpuinfo create mode 100644 tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.output diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 4fffce0dde..227071fcd3 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -15,6 +15,7 @@ jobs: - aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra - aarch64/arm/neoverse-n1/AWS-awslinux-graviton2 - aarch64/arm/neoverse-v1/AWS-awslinux-graviton3 + - aarch64/arm/cortex-a72/debian-rpi4 fail-fast: false steps: - uses: actions/checkout@v2 diff --git a/init/arch_specs/eessi_arch_arm_part.spec b/init/arch_specs/eessi_arch_arm_part.spec new file mode 100755 index 0000000000..7a56b222ba --- /dev/null +++ b/init/arch_specs/eessi_arch_arm_part.spec @@ -0,0 +1,5 @@ +# ARM CPU architecture specifications +# Software path in EESSI | Vendor ID | List of defining CPU features +"aarch64/arm/cortex-a72" "" "0xd08" # Raspberry Pi 4 +"aarch64/arm/neoverse-n1" "" "0xd0c" # AWS Graviton2 +"aarch64/arm/neoverse-v1" "" "0xd40" # AWS Graviton3 diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index af63e36f3a..68d3e600b4 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -78,27 +78,37 @@ cpupath(){ local machine_type=${EESSI_MACHINE_TYPE:-$(uname -m)} log "DEBUG" "cpupath: Host CPU architecture identified as '$machine_type'" + # Identify the host CPU vendor + local cpu_vendor_tag="vendor[ _]id" + local cpu_vendor=$(get_cpuinfo "$cpu_vendor_tag") + log "DEBUG" "cpupath: CPU vendor of host system: '$cpu_vendor'" + + # Identify the host CPU part + local cpu_part_tag="cpu[ _]part" + local cpu_part=$(get_cpuinfo "$cpu_part_tag") + log "DEBUG" "cpupath: CPU part of host system: '$cpu_part'" + # Populate list of supported specs for this architecture case $machine_type in "x86_64") local spec_file="eessi_arch_x86.spec";; - "aarch64") local spec_file="eessi_arch_arm.spec";; + "aarch64") + local spec_file="eessi_arch_arm.spec" + [ ! "${cpu_part}x" == "x" ] && local spec_file="eessi_arch_arm_part.spec" + ;; "ppc64le") local spec_file="eessi_arch_ppc.spec";; *) log "ERROR" "cpupath: Unsupported CPU architecture $machine_type" esac + # spec files are located in a subfolder with this script local base_dir=$(dirname $(realpath $0)) update_arch_specs cpu_arch_spec "$base_dir/arch_specs/${spec_file}" - # Identify the host CPU vendor - local cpu_vendor_tag="vendor[ _]id" - local cpu_vendor=$(get_cpuinfo "$cpu_vendor_tag") - 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_vendor}x" == "x" ] && cpu_flag_tag='features' + [ "${machine_type}" == "aarch64" ] && [ ! "${cpu_part}x" == "x" ] && cpu_flag_tag='cpu part' [ "${machine_type}" == "ppc64le" ] && cpu_flag_tag='cpu' local cpu_flags=$(get_cpuinfo "$cpu_flag_tag") diff --git a/tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.cpuinfo b/tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.cpuinfo new file mode 100644 index 0000000000..045264e878 --- /dev/null +++ b/tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.cpuinfo @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 108.00 +Features : fp asimd evtstrm crc32 cpuid +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x0 +CPU part : 0xd08 +CPU revision : 3 diff --git a/tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.output b/tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.output new file mode 100644 index 0000000000..4fe0bd1183 --- /dev/null +++ b/tests/archdetect/aarch64/arm/cortex-a72/debian-rpi4.output @@ -0,0 +1 @@ +aarch64/arm/cortex-a72