From 9766267f475b1f266923b6c03b545d10caabd42a Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 16 Dec 2021 19:26:11 +0100 Subject: [PATCH 01/90] also install SciPy-bundle-2021.05-foss-2021a.eb into 2021.12 pilot --- EESSI-pilot-install-software.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 10c57c6d13..4cbf0d3b8e 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -326,6 +326,24 @@ fail_msg="Installation of IPython failed, that's unexpected..." $EB IPython-7.15.0-foss-2020a-Python-3.8.2.eb -r check_exit_code $? "${ok_msg}" "${fail_msg}" +echo ">> Installing EasyBuild 4.5.1..." +ok_msg="EasyBuild v4.5.1 installed" +fail_msg="EasyBuild v4.5.1 failed to install" +$EB --from-pr 14545 +check_exit_code $? "${ok_msg}" "${fail_msg}" + +LMOD_IGNORE_CACHE=1 module swap EasyBuild/4.5.1 +check_exit_code $? "Swapped to EasyBuild/4.5.1" "Couldn't swap to EasyBuild/4.5.1" + +echo ">> Installing SciPy-bundle with foss/2021a..." +ok_msg="SciPy-bundle with foss/2021a installed, welcome to the modern age" +fail_msg="Installation of SciPy-bundle with foss/2021a failed, back to the stone age..." +$EB SciPy-bundle-2021.05-foss-2021a.eb -M +$EB CMake-3.20.1-GCCcore-10.3.0.eb --robot --include-easyblocks-from-pr 2248 +$EB --from-pr 14584 Rust-1.52.1-GCCcore-10.3.0.eb --robot +$EB SciPy-bundle-2021.05-foss-2021a.eb -r --buildpath /dev/shm/$USER/easybuild_build +check_exit_code $? "${ok_msg}" "${fail_msg}" + echo ">> Creating/updating Lmod cache..." export LMOD_RC="${EASYBUILD_INSTALLPATH}/.lmod/lmodrc.lua" if [ ! -f $LMOD_RC ]; then From 596ab7adc3ac5d7fe045b4be6fc3b4b6aad4f840 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 16 Dec 2021 19:41:37 +0100 Subject: [PATCH 02/90] update hooks to add --disable-psm3 when building libfabric on x86_64 without AVX support --- eb_hooks.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index 126d89ca46..7eb7627643 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -4,7 +4,8 @@ from easybuild.tools.build_log import EasyBuildError, print_msg from easybuild.tools.config import build_option, update_build_option -from easybuild.tools.systemtools import POWER, get_cpu_architecture +from easybuild.tools.systemtools import POWER, X86_64, get_cpu_architecture, get_cpu_features +from easybuild.tools.toolchain.compiler import OPTARCH_GENERIC EESSI_RPATH_OVERRIDE_ATTR = 'orig_rpath_override_dirs' @@ -52,6 +53,13 @@ def parse_hook(ec, *args, **kwargs): PARSE_HOOKS[ec.name](ec, eprefix) +def pre_configure_hook(self, *args, **kwargs): + """Main pre-configure hook: trigger custom functions based on software name.""" + + if self.name in PRE_CONFIGURE_HOOKS: + PRE_CONFIGURE_HOOKS[self.name](self, *args, **kwargs) + + def pre_prepare_hook(self, *args, **kwargs): """Main pre-prepare hook: trigger custom functions.""" @@ -114,12 +122,25 @@ def fontconfig_add_fonts(ec, eprefix): raise EasyBuildError("fontconfig-specific hook triggered for non-fontconfig easyconfig?!") +def libfabric_disable_psm3_x86_64_generic(self, *args, **kwargs): + """Add --disable-psm3 to libfabric configure options when building with --optarch=GENERIC on x86_64.""" + if self.name == 'libfabric': + if get_cpu_architecture() == X86_64: + generic = build_option('optarch') == OPTARCH_GENERIC + no_avx = 'avx' not in get_cpu_features() + if generic or no_avx: + self.cfg.update('configopts', '--disable-psm3') + print_msg("Using custom configure options for %s: %s", self.name, self.cfg['configopts']) + else: + raise EasyBuildError("libfabric-specific hook triggered for non-libfabric easyconfig?!") + + def ucx_eprefix(ec, eprefix): """Make UCX aware of compatibility layer via additional configuration options.""" if ec.name == 'UCX': ec.update('configopts', '--with-sysroot=%s' % eprefix) ec.update('configopts', '--with-rdmacm=%s' % os.path.join(eprefix, 'usr')) - print_msg("Using custom configure option for %s: %s", ec.name, ec['configopts']) + print_msg("Using custom configure options for %s: %s", ec.name, ec['configopts']) else: raise EasyBuildError("UCX-specific hook triggered for non-UCX easyconfig?!") @@ -129,3 +150,7 @@ def ucx_eprefix(ec, eprefix): 'fontconfig': fontconfig_add_fonts, 'UCX': ucx_eprefix, } + +PRE_CONFIGURE_HOOKS = { + 'libfabric': libfabric_disable_psm3_x86_64_generic, +} From 7adc0764864f45b85b1e0feeb27c90cd86fc736e Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 6 Jan 2022 17:07:41 +0100 Subject: [PATCH 03/90] reorder software alphabetically in easystack file for 2021.12 --- eessi-2021.12.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/eessi-2021.12.yml b/eessi-2021.12.yml index 0d060f55ac..cc1519e30b 100644 --- a/eessi-2021.12.yml +++ b/eessi-2021.12.yml @@ -1,10 +1,8 @@ software: - R-bundle-Bioconductor: + code-server: toolchains: - foss-2020a: - versions: - '3.11': - versionsuffix: -R-4.0.0 + SYSTEM: + versions: '3.7.3' GROMACS: toolchains: foss-2020a: @@ -31,19 +29,21 @@ software: toolchains: foss-2020a: versions: ['6.6'] - TensorFlow: + R-bundle-Bioconductor: toolchains: foss-2020a: versions: - '2.3.1': - versionsuffix: -Python-3.8.2 + '3.11': + versionsuffix: -R-4.0.0 RStudio-Server: toolchains: foss-2020a: versions: '1.3.1093': versionsuffix: -Java-11-R-4.0.0 - code-server: + TensorFlow: toolchains: - SYSTEM: - versions: '3.7.3' + foss-2020a: + versions: + '2.3.1': + versionsuffix: -Python-3.8.2 From 1e3d482ed47a4defd819d7826f29678dfcf4f8d3 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 6 Jan 2022 17:12:22 +0100 Subject: [PATCH 04/90] add SciPy-bundle with foss/2021a to easystack file for 2021.12 EESSI pilot --- eessi-2021.12.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eessi-2021.12.yml b/eessi-2021.12.yml index cc1519e30b..d2e1ccb1ba 100644 --- a/eessi-2021.12.yml +++ b/eessi-2021.12.yml @@ -41,6 +41,10 @@ software: versions: '1.3.1093': versionsuffix: -Java-11-R-4.0.0 + SciPy-bundle: + toolchains: + foss-2021a: + versions: ['2021.05'] TensorFlow: toolchains: foss-2020a: From e5d67b2c16650c40551a6513ed64d25053e14613 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 7 Jan 2022 15:59:49 +0100 Subject: [PATCH 05/90] use enhanced Perl easyblock to fix problem with excessive long shebang line in Perl scripts --- EESSI-pilot-install-software.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 4cbf0d3b8e..be699069d6 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -339,7 +339,14 @@ echo ">> Installing SciPy-bundle with foss/2021a..." ok_msg="SciPy-bundle with foss/2021a installed, welcome to the modern age" fail_msg="Installation of SciPy-bundle with foss/2021a failed, back to the stone age..." $EB SciPy-bundle-2021.05-foss-2021a.eb -M +# use enhanced Perl easyblock from https://github.com/easybuilders/easybuild-easyblocks/pull/2640 +# to avoid trouble when using long installation prefix (for example with EESSI pilot 2021.12 on skylake_avx512...) +$EB Perl-5.32.1-GCCcore-10.3.0.eb --robot --include-easyblocks-from-pr 2640 +# use enhanced CMake easyblock to patch CMake's UnixPaths.cmake script if --sysroot is set +# from https://github.com/easybuilders/easybuild-easyblocks/pull/2248 $EB CMake-3.20.1-GCCcore-10.3.0.eb --robot --include-easyblocks-from-pr 2248 +# use Rust easyconfig from https://github.com/easybuilders/easybuild-easyconfigs/pull/14584 +# that includes patch to fix bootstrap problem when using alternate sysroot $EB --from-pr 14584 Rust-1.52.1-GCCcore-10.3.0.eb --robot $EB SciPy-bundle-2021.05-foss-2021a.eb -r --buildpath /dev/shm/$USER/easybuild_build check_exit_code $? "${ok_msg}" "${fail_msg}" From 1659ca917400a4eac49dcaeb67e8a86cf301666d Mon Sep 17 00:00:00 2001 From: Thomas Roeblitz Date: Fri, 9 Sep 2022 13:41:50 +0200 Subject: [PATCH 06/90] Adjustments to scripts necessary for bot PR24 The parameters for EESSI-pilot-install-software.sh and the handling of GENERIC option have been changed. Also a note where more sections for additional packages has been added. The README.md has been updated (newer pilot version). The 'exit 2' when /tmp directory does not support extended attributes or the command 'attr' was not found has been commented out. In 'install_software_layer.sh' the parameter "$@" was added to running the script "EESSI-pilot-install-software.sh". --- EESSI-pilot-install-software.sh | 51 +++++++++++++++++++++++++++++++-- README.md | 14 ++++----- build_container.sh | 2 +- install_software_layer.sh | 2 +- 4 files changed, 56 insertions(+), 13 deletions(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 0c832fdee9..7312818a2c 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -1,7 +1,52 @@ #!/bin/bash # # Script to install EESSI pilot software stack (version 2021.12) -# + +# see example parsing of command line arguments at +# https://wiki.bash-hackers.org/scripting/posparams#using_a_while_loop +# https://stackoverflow.com/questions/192249/how-do-i-parse-command-line-arguments-in-bash + +display_help() { + echo "usage: $0 [OPTIONS]" + echo " -g | --generic - instructs script to build for generic architecture target" + echo " -h | --help - display this usage information" + echo " -x | --http-proxy URL - provides URL for the environment variable http_proxy" + echo " -y | --https-proxy URL - provides URL for the environment variable https_proxy" +} + +POSITIONAL_ARGS=() + +while [[ $# -gt 0 ]]; do + case $1 in + -g|--generic) + EASYBUILD_OPTARCH="GENERIC" + shift + ;; + -h|--help) + display_help # Call your function + # no shifting needed here, we're done. + exit 0 + ;; + -x|--http-proxy) + export http_proxy="$2" + shift 2 + ;; + -y|--https-proxy) + export https_proxy="$2" + shift 2 + ;; + -*|--*) + echo "Error: Unknown option: $1" >&2 + exit 1 + ;; + *) # No more options + POSITIONAL_ARGS+=("$1") # save positional arg + shift + ;; + esac +done + +set -- "${POSITIONAL_ARGS[@]}" TOPDIR=$(dirname $(realpath $0)) @@ -39,7 +84,7 @@ export PYTHONPYCACHEPREFIX=$TMPDIR/pycache DETECTION_PARAMETERS='' GENERIC=0 EB='eb' -if [[ "$1" == "--generic" || "$EASYBUILD_OPTARCH" == "GENERIC" ]]; then +if [[ "$EASYBUILD_OPTARCH" == "GENERIC" ]]; then echo_yellow ">> GENERIC build requested, taking appropriate measures!" DETECTION_PARAMETERS="$DETECTION_PARAMETERS --generic" GENERIC=1 @@ -305,6 +350,8 @@ fail_msg="Installation of WRF failed, that's unexpected..." OMPI_MCA_pml=ucx UCX_TLS=tcp $EB WRF-3.9.1.1-foss-2020a-dmpar.eb -r --include-easyblocks-from-pr 2648 check_exit_code $? "${ok_msg}" "${fail_msg}" +### add packages here + echo ">> Creating/updating Lmod cache..." export LMOD_RC="${EASYBUILD_INSTALLPATH}/.lmod/lmodrc.lua" if [ ! -f $LMOD_RC ]; then diff --git a/README.md b/README.md index 508763c090..4d463b1c5b 100644 --- a/README.md +++ b/README.md @@ -6,21 +6,17 @@ See also https://eessi.github.io/docs/software_layer. ## Pilot software stack -A script that sets up your environment to start using the 2020.08 version of the EESSI pilot software stack -is available at `EESSI-pilot-2020.08_init.sh`. - -This script should be copied to `/cvmfs/pilot.eessi-hpc.org/2020.08/init/bash` if it is not available there already, -and sourced to set up your environment: +You can set up your environment by sourcing the init script: ``` -$ source /cvmfs/pilot.eessi-hpc.org/2020.08/init/bash -Found EESSI pilot repo @ /cvmfs/pilot.eessi-hpc.org/2020.08! +$ source /cvmfs/pilot.eessi-hpc.org/versions/2021.12/init/bash +Found EESSI pilot repo @ /cvmfs/pilot.eessi-hpc.org/versions/2021.12! Derived subdirectory for software layer: x86_64/intel/haswell Using x86_64/intel/haswell subdirectory for software layer (HARDCODED) Initializing Lmod... -Prepending /cvmfs/pilot.eessi-hpc.org/2020.08/software/x86_64/intel/haswell/modules/all to $MODULEPATH... +Prepending /cvmfs/pilot.eessi-hpc.org/versions/2021.12/software/x86_64/intel/haswell/modules/all to $MODULEPATH... Environment set up to use EESSI pilot software stack, have fun! -[EESSI pilot 2020.08] $ +[EESSI pilot 2021.12] $ ``` # License diff --git a/build_container.sh b/build_container.sh index e9fe593d92..1fffde9c75 100755 --- a/build_container.sh +++ b/build_container.sh @@ -26,7 +26,7 @@ if [ $? -eq 0 ]; then attr -s test -V test $testfile > /dev/null if [ $? -ne 0 ]; then echo "ERROR: $EESSI_TMPDIR does not support extended attributes!" >&2 - exit 2 + #exit 2 else rm $testfile fi diff --git a/install_software_layer.sh b/install_software_layer.sh index b045d75f90..e0b2f785d5 100755 --- a/install_software_layer.sh +++ b/install_software_layer.sh @@ -1,3 +1,3 @@ #!/bin/bash export EESSI_PILOT_VERSION='2021.12' -./run_in_compat_layer_env.sh ./EESSI-pilot-install-software.sh +./run_in_compat_layer_env.sh ./EESSI-pilot-install-software.sh "$@" From 9d06a89345d751c40b83fb298c8608e01dfddf23 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 05:34:10 +0200 Subject: [PATCH 07/90] alternative to detect cpu arch for path --- init/eessi_archdetect.sh | 70 ++++++++++++++++++++++++++++++++ init/eessi_environment_variables | 12 ++++-- 2 files changed, 79 insertions(+), 3 deletions(-) create mode 100755 init/eessi_archdetect.sh diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh new file mode 100755 index 0000000000..e9514ee439 --- /dev/null +++ b/init/eessi_archdetect.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +# current pathways implemented in EESSI +# x86_64/generic +# x86_64/intel/haswell +# x86_64/intel/skylake_avx512 +# x86_64/amd/zen2 +# x86_64/amd/zen3 +# aarch64/generic +# ppc64le/generic +# ppc64le/power9le + +ARGUMENT=${1:-none} + +cpupath () { + # let the kernel tell base machine type + MACHINE_TYPE=$(uname -m) + + # fallback path + CPU_PATH="${MACHINE_TYPE}/generic" + + if [ ${MACHINE_TYPE} == "aarch64" ]; then + echo ${CPU_PATH} + exit + fi + + if [ ${MACHINE_TYPE} == "ppc64le" ]; then + echo ${CPU_PATH} "not sure what to do next..." + echo "please mail output of lscpu to me..." + exit + fi + + if [ ${MACHINE_TYPE} == "x86_64" ]; then + # check for vendor info, if available, for x86_64 + CPUINFO_VENDOR_FLAG=$(grep -m 1 ^vendor_id /proc/cpuinfo) + [[ $CPUINFO_VENDOR_FLAG =~ .*GenuineIntel* ]] && CPU_VENDOR=intel + [[ $CPU_VENDOR_FLAG =~ .*AuthenticAMD* ]] && CPU_VENDOR=amd + + CPU_FLAGS=$(grep -m 1 ^flags /proc/cpuinfo) + [[ $CPU_FLAGS =~ .*avx2* ]] && HAS_AVX2=true + [[ $CPU_FLAGS =~ .*fma* ]] && HAS_FMA=true + [[ $CPU_FLAGS =~ .*avx512f* ]] && HAS_AVX512F=true + [[ $CPU_FLAGS =~ .*avx512vl* ]] && HAS_AVX512VL=true + [[ $CPU_FLAGS =~ .*avx512ifma* ]] && HAS_AVX512IFMA=true + [[ $CPU_FLAGS =~ .*avx512_vbmi2* ]] && HAS_AVX512_VBMI2=true + [[ $CPU_FLAGS =~ .*avx512_vnni* ]] && HAS_AVX512_VNNI=true + [[ $CPU_FLAGS =~ .*avx512fp16* ]] && HAS_AVX512FP16=true + + [[ ${CPU_VENDOR} == "intel" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell + [[ ${CPU_VENDOR} == "intel" ]] && [[ ${HAS_AVX512F} ]] && CPU_TYPE=skylake_avx512 + # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 + # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 + + [[ ${CPU_VENDOR} ]] && [[ $CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${CPU_VENDOR}/${CPU_TYPE}" + + echo ${CPU_PATH} + exit + fi + + echo "should not see this...something weird going on..." + echo "please mail output of lscpu to me..." +} + +if [ ${ARGUMENT} == "none" ]; then + echo usage: $0 cpupath + exit +elif [ ${ARGUMENT} == "cpupath" ]; then + echo $(cpupath) + exit +fi diff --git a/init/eessi_environment_variables b/init/eessi_environment_variables index 34dc8f9f98..caf935751e 100644 --- a/init/eessi_environment_variables +++ b/init/eessi_environment_variables @@ -25,9 +25,15 @@ if [ -d $EESSI_PREFIX ]; then if [ -d $EESSI_EPREFIX ]; then # determine subdirectory in software layer - # note: eessi_software_subdir_for_host.py will pick up value from $EESSI_SOFTWARE_SUBDIR_OVERRIDE if it's defined! - export EESSI_EPREFIX_PYTHON=$EESSI_EPREFIX/usr/bin/python3 - export EESSI_SOFTWARE_SUBDIR=$($EESSI_EPREFIX_PYTHON ${EESSI_INIT_DIR_PATH}/eessi_software_subdir_for_host.py $EESSI_PREFIX) + if [ -z $EESSI_USE_ARCHDETECT ]; then + # if archdetect is enabled, use internal code + export EESSI_SOFTWARE_SUBDIR=$(${EESSI_INIT_DIR_PATH}/eessi_archdetect.sh cpupath) + echo "archdetect says ${EESSI_SOFTWARE_SUBDIR}" + else + # note: eessi_software_subdir_for_host.py will pick up value from $EESSI_SOFTWARE_SUBDIR_OVERRIDE if it's defined! + export EESSI_EPREFIX_PYTHON=$EESSI_EPREFIX/usr/bin/python3 + export EESSI_SOFTWARE_SUBDIR=$($EESSI_EPREFIX_PYTHON ${EESSI_INIT_DIR_PATH}/eessi_software_subdir_for_host.py $EESSI_PREFIX) + fi if [ ! -z $EESSI_SOFTWARE_SUBDIR ]; then echo "Using ${EESSI_SOFTWARE_SUBDIR} as software subdirectory." >> $output From 898b4d564be11119178246343c8aa306a5d10355 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 06:34:29 +0200 Subject: [PATCH 08/90] adding support for amd detection --- init/eessi_archdetect.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index e9514ee439..2463741283 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -45,12 +45,16 @@ cpupath () { [[ $CPU_FLAGS =~ .*avx512_vbmi2* ]] && HAS_AVX512_VBMI2=true [[ $CPU_FLAGS =~ .*avx512_vnni* ]] && HAS_AVX512_VNNI=true [[ $CPU_FLAGS =~ .*avx512fp16* ]] && HAS_AVX512FP16=true + [[ $CPU_FLAGS =~ .*vaes* ]] && HAS_VAES=true [[ ${CPU_VENDOR} == "intel" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell [[ ${CPU_VENDOR} == "intel" ]] && [[ ${HAS_AVX512F} ]] && CPU_TYPE=skylake_avx512 # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 + [[ ${CPU_VENDOR} == "amd" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=zen2 + [[ ${CPU_VENDOR} == "amd" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && [[ ${HAS_VAES} ]] && CPU_TYPE=zen3 + [[ ${CPU_VENDOR} ]] && [[ $CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${CPU_VENDOR}/${CPU_TYPE}" echo ${CPU_PATH} From 46e0c070a0bcb6a62343c9f80eaef0630a88acf6 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 06:38:05 +0200 Subject: [PATCH 09/90] document example lscpu outputs which is input to archdetect --- init/archdetect.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 init/archdetect.md diff --git a/init/archdetect.md b/init/archdetect.md new file mode 100644 index 0000000000..8d371d14ea --- /dev/null +++ b/init/archdetect.md @@ -0,0 +1,64 @@ +# archdetect + +bash based script to detect e.g. cpu architectures and provide cpupath for setting pointer to optimized software + + +example lscpu outputs: + +# Zen2 +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +CPU(s): 120 +On-line CPU(s) list: 0-119 +Thread(s) per core: 1 +Core(s) per socket: 60 +Socket(s): 2 +NUMA node(s): 4 +Vendor ID: AuthenticAMD +CPU family: 23 +Model: 49 +Model name: AMD EPYC 7V12 64-Core Processor +Stepping: 0 +CPU MHz: 2445.424 +BogoMIPS: 4890.84 +Hypervisor vendor: Microsoft +Virtualization type: full +L1d cache: 32K +L1i cache: 32K +L2 cache: 512K +L3 cache: 16384K +NUMA node0 CPU(s): 0-29 +NUMA node1 CPU(s): 30-59 +NUMA node2 CPU(s): 60-89 +NUMA node3 CPU(s): 90-119 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext retpoline_amd ssbd vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip + +# Zen3 +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +CPU(s): 120 +On-line CPU(s) list: 0-119 +Thread(s) per core: 1 +Core(s) per socket: 60 +Socket(s): 2 +NUMA node(s): 4 +Vendor ID: AuthenticAMD +CPU family: 25 +Model: 1 +Model name: AMD EPYC 7V73X 64-Core Processor +Stepping: 2 +CPU MHz: 1846.550 +BogoMIPS: 3693.10 +Hypervisor vendor: Microsoft +Virtualization type: full +L1d cache: 32K +L1i cache: 32K +L2 cache: 512K +L3 cache: 98304K +NUMA node0 CPU(s): 0-29 +NUMA node1 CPU(s): 30-59 +NUMA node2 CPU(s): 60-89 +NUMA node3 CPU(s): 90-119 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core invpcid_single retpoline_amd vmmcall fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip vaes vpclmulqdq From eb9f8911f0815d4efcae91a94cc112c1ccce61f6 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 07:28:42 +0200 Subject: [PATCH 10/90] add arm ampere altra lscpu example --- init/archdetect.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/init/archdetect.md b/init/archdetect.md index 8d371d14ea..384567ad4a 100644 --- a/init/archdetect.md +++ b/init/archdetect.md @@ -62,3 +62,35 @@ NUMA node1 CPU(s): 30-59 NUMA node2 CPU(s): 60-89 NUMA node3 CPU(s): 90-119 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core invpcid_single retpoline_amd vmmcall fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip vaes vpclmulqdq + +# Arm Ampere Altra +Architecture: aarch64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +CPU(s): 64 +On-line CPU(s) list: 0-63 +Thread(s) per core: 1 +Core(s) per socket: 64 +Socket(s): 1 +NUMA node(s): 1 +Vendor ID: ARM +Model: 1 +Model name: Neoverse-N1 +Stepping: r3p1 +BogoMIPS: 50.00 +L1d cache: 4 MiB +L1i cache: 4 MiB +L2 cache: 64 MiB +L3 cache: 32 MiB +NUMA node0 CPU(s): 0-63 +Vulnerability Itlb multihit: Not affected +Vulnerability L1tf: Not affected +Vulnerability Mds: Not affected +Vulnerability Meltdown: Mitigation; PTI +Vulnerability Mmio stale data: Not affected +Vulnerability Spec store bypass: Not affected +Vulnerability Spectre v1: Mitigation; __user pointer sanitization +Vulnerability Spectre v2: Mitigation; CSV2, BHB +Vulnerability Srbds: Not affected +Vulnerability Tsx async abort: Not affected +Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp From 2c561a497d943f2c8a0f6bf3c610d0f62b2d6339 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 08:26:11 +0200 Subject: [PATCH 11/90] allow overrides for unittesting and make cpu_vendor more readable --- init/eessi_archdetect.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 2463741283..5785b9db22 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -14,7 +14,7 @@ ARGUMENT=${1:-none} cpupath () { # let the kernel tell base machine type - MACHINE_TYPE=$(uname -m) + MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} # fallback path CPU_PATH="${MACHINE_TYPE}/generic" @@ -32,11 +32,12 @@ cpupath () { if [ ${MACHINE_TYPE} == "x86_64" ]; then # check for vendor info, if available, for x86_64 - CPUINFO_VENDOR_FLAG=$(grep -m 1 ^vendor_id /proc/cpuinfo) + PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} + CPUINFO_VENDOR_FLAG=$(grep -m 1 ^vendor_id ${PROC_CPUINFO}) [[ $CPUINFO_VENDOR_FLAG =~ .*GenuineIntel* ]] && CPU_VENDOR=intel [[ $CPU_VENDOR_FLAG =~ .*AuthenticAMD* ]] && CPU_VENDOR=amd - CPU_FLAGS=$(grep -m 1 ^flags /proc/cpuinfo) + CPU_FLAGS=$(grep -m 1 ^flags ${PROC_CPUINFO}) [[ $CPU_FLAGS =~ .*avx2* ]] && HAS_AVX2=true [[ $CPU_FLAGS =~ .*fma* ]] && HAS_FMA=true [[ $CPU_FLAGS =~ .*avx512f* ]] && HAS_AVX512F=true @@ -47,13 +48,15 @@ cpupath () { [[ $CPU_FLAGS =~ .*avx512fp16* ]] && HAS_AVX512FP16=true [[ $CPU_FLAGS =~ .*vaes* ]] && HAS_VAES=true - [[ ${CPU_VENDOR} == "intel" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell - [[ ${CPU_VENDOR} == "intel" ]] && [[ ${HAS_AVX512F} ]] && CPU_TYPE=skylake_avx512 - # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 - # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 - - [[ ${CPU_VENDOR} == "amd" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=zen2 - [[ ${CPU_VENDOR} == "amd" ]] && [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && [[ ${HAS_VAES} ]] && CPU_TYPE=zen3 + if [ ${CPU_VENDOR} == "intel" ]; then + [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell + [[ ${HAS_AVX512F} ]] && CPU_TYPE=skylake_avx512 + # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 + # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 + elif [ ${CPU_VENDOR} == "amd" ]; then + [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=zen2 + [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && [[ ${HAS_VAES} ]] && CPU_TYPE=zen3 + fi [[ ${CPU_VENDOR} ]] && [[ $CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${CPU_VENDOR}/${CPU_TYPE}" From 0dd9a2a3cb9e9a79b6f6bdf0d00b56567991c92c Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 08:31:53 +0200 Subject: [PATCH 12/90] adding ref files for lscpu for unit tests --- tests/archdetect/x86_64/amd/zen2 | 27 +++++++++++++++++++++++++++ tests/archdetect/x86_64/amd/zen3 | 27 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 tests/archdetect/x86_64/amd/zen2 create mode 100644 tests/archdetect/x86_64/amd/zen3 diff --git a/tests/archdetect/x86_64/amd/zen2 b/tests/archdetect/x86_64/amd/zen2 new file mode 100644 index 0000000000..edf9c3e15b --- /dev/null +++ b/tests/archdetect/x86_64/amd/zen2 @@ -0,0 +1,27 @@ +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +CPU(s): 120 +On-line CPU(s) list: 0-119 +Thread(s) per core: 1 +Core(s) per socket: 60 +Socket(s): 2 +NUMA node(s): 4 +Vendor ID: AuthenticAMD +CPU family: 23 +Model: 49 +Model name: AMD EPYC 7V12 64-Core Processor +Stepping: 0 +CPU MHz: 2445.424 +BogoMIPS: 4890.84 +Hypervisor vendor: Microsoft +Virtualization type: full +L1d cache: 32K +L1i cache: 32K +L2 cache: 512K +L3 cache: 16384K +NUMA node0 CPU(s): 0-29 +NUMA node1 CPU(s): 30-59 +NUMA node2 CPU(s): 60-89 +NUMA node3 CPU(s): 90-119 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext retpoline_amd ssbd vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip diff --git a/tests/archdetect/x86_64/amd/zen3 b/tests/archdetect/x86_64/amd/zen3 new file mode 100644 index 0000000000..24961c80c3 --- /dev/null +++ b/tests/archdetect/x86_64/amd/zen3 @@ -0,0 +1,27 @@ +Architecture: x86_64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +CPU(s): 120 +On-line CPU(s) list: 0-119 +Thread(s) per core: 1 +Core(s) per socket: 60 +Socket(s): 2 +NUMA node(s): 4 +Vendor ID: AuthenticAMD +CPU family: 25 +Model: 1 +Model name: AMD EPYC 7V73X 64-Core Processor +Stepping: 2 +CPU MHz: 1846.550 +BogoMIPS: 3693.10 +Hypervisor vendor: Microsoft +Virtualization type: full +L1d cache: 32K +L1i cache: 32K +L2 cache: 512K +L3 cache: 98304K +NUMA node0 CPU(s): 0-29 +NUMA node1 CPU(s): 30-59 +NUMA node2 CPU(s): 60-89 +NUMA node3 CPU(s): 90-119 +Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core invpcid_single retpoline_amd vmmcall fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip vaes vpclmulqdq From 4914394291d23943fb9458ddc3f01dcf748ad2e5 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 15 Sep 2022 13:53:09 +0200 Subject: [PATCH 13/90] add CI workflow to test cpu_archdetect.yml --- .github/workflows/tests_archdetect.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/tests_archdetect.yml diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml new file mode 100644 index 0000000000..c54eef94fa --- /dev/null +++ b/.github/workflows/tests_archdetect.yml @@ -0,0 +1,25 @@ +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions +name: Tests for eessi_archdetect.sh +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-20.04 + strategy: + matrix: + proc_cpuinfo: + - x86_64/intel/haswell + - x86_64/amd/zen2 + fail-fast: false + steps: + - uses: actions/checkout@v2 + + - name: test eessi_archdetect.sh + run: | + export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} + CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) + if [[ $CPU_ARCH == "${{matrix.python}}" ]]; then + echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" >&2 + else + echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2 + exit 1 + fi From 0aab86fb418d63c6675f4fda4234eb541db43db6 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:06:39 +0200 Subject: [PATCH 14/90] ignore case in cpuinfo to allow CentOS & Ubuntu --- init/eessi_archdetect.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 5785b9db22..e8f24aadc9 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -33,11 +33,11 @@ cpupath () { if [ ${MACHINE_TYPE} == "x86_64" ]; then # check for vendor info, if available, for x86_64 PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} - CPUINFO_VENDOR_FLAG=$(grep -m 1 ^vendor_id ${PROC_CPUINFO}) + CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) [[ $CPUINFO_VENDOR_FLAG =~ .*GenuineIntel* ]] && CPU_VENDOR=intel - [[ $CPU_VENDOR_FLAG =~ .*AuthenticAMD* ]] && CPU_VENDOR=amd + [[ $CPUINFO_VENDOR_FLAG =~ .*AuthenticAMD* ]] && CPU_VENDOR=amd - CPU_FLAGS=$(grep -m 1 ^flags ${PROC_CPUINFO}) + CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO}) [[ $CPU_FLAGS =~ .*avx2* ]] && HAS_AVX2=true [[ $CPU_FLAGS =~ .*fma* ]] && HAS_FMA=true [[ $CPU_FLAGS =~ .*avx512f* ]] && HAS_AVX512F=true From c51613d91dcc81bf565e8f1ae49d85cd9ada19f9 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:13:23 +0200 Subject: [PATCH 15/90] correct variable for positive check --- .github/workflows/tests_archdetect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index c54eef94fa..8035cb8a9e 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -17,7 +17,7 @@ jobs: run: | export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) - if [[ $CPU_ARCH == "${{matrix.python}}" ]]; then + if [[ $CPU_ARCH == "${{matrix.proc_cpuinfo}}" ]]; then echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" >&2 else echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2 From d31887407fee46ed3dc58b73e2d94c280e59d00e Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:16:58 +0200 Subject: [PATCH 16/90] add testcases for intel cpuinfo --- tests/archdetect/x86_64/intel/haswell | 25 ++++++++++++++++++++ tests/archdetect/x86_64/intel/skylake_avx512 | 25 ++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 tests/archdetect/x86_64/intel/haswell create mode 100644 tests/archdetect/x86_64/intel/skylake_avx512 diff --git a/tests/archdetect/x86_64/intel/haswell b/tests/archdetect/x86_64/intel/haswell new file mode 100644 index 0000000000..7bb5aa958f --- /dev/null +++ b/tests/archdetect/x86_64/intel/haswell @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 63 +model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz +stepping : 2 +microcode : 0x3c +cpu MHz : 1757.910 +cache size : 30720 KB +physical id : 0 +siblings : 12 +core id : 0 +cpu cores : 12 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 15 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc ibpb ibrs stibp dtherm arat pln pts spec_ctrl intel_stibp +bogomips : 4987.97 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/tests/archdetect/x86_64/intel/skylake_avx512 b/tests/archdetect/x86_64/intel/skylake_avx512 new file mode 100644 index 0000000000..e9ab1987dd --- /dev/null +++ b/tests/archdetect/x86_64/intel/skylake_avx512 @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 85 +model name : Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz +stepping : 4 +microcode : 0x200004d +cpu MHz : 2600.000 +cache size : 19712 KB +physical id : 0 +siblings : 14 +core id : 0 +cpu cores : 14 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 22 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local ibpb ibrs stibp dtherm ida arat pln pts spec_ctrl intel_stibp ssbd +bogomips : 5200.00 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: From 978e16a4a5fcf75b7f3d3963cdc5ab012a66814a Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:18:59 +0200 Subject: [PATCH 17/90] add testcases for intel and amd cpuinfo --- .github/workflows/tests_archdetect.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 8035cb8a9e..9a26efe437 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -8,7 +8,9 @@ jobs: matrix: proc_cpuinfo: - x86_64/intel/haswell + - x86_64/intel/skylake_avx512 - x86_64/amd/zen2 + - x86_64/amd/zen3 fail-fast: false steps: - uses: actions/checkout@v2 From 4a9fc68497699f58000c9abd53c5a77139591403 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:34:04 +0200 Subject: [PATCH 18/90] add power9 detection --- init/eessi_archdetect.sh | 8 ++++++-- tests/archdetect/ppc64le/power9le | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 tests/archdetect/ppc64le/power9le diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index e8f24aadc9..3b2fc2986a 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -25,8 +25,12 @@ cpupath () { fi if [ ${MACHINE_TYPE} == "ppc64le" ]; then - echo ${CPU_PATH} "not sure what to do next..." - echo "please mail output of lscpu to me..." + PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} + CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) + [[ $CPU_FLAGS =~ .*POWER9* ]] && HAS_POWER9=true + + [[ ${HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le + echo ${CPU_PATH} exit fi diff --git a/tests/archdetect/ppc64le/power9le b/tests/archdetect/ppc64le/power9le new file mode 100644 index 0000000000..4e6bdbb97b --- /dev/null +++ b/tests/archdetect/ppc64le/power9le @@ -0,0 +1,4 @@ +processor : 0 +cpu : POWER9 (architected), altivec supported +clock : 2200.000000MHz +revision : 2.2 (pvr 004e 1202) From a7fc80adcf4ce09ccae44f09ac50dbc082a8a61b Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:34:55 +0200 Subject: [PATCH 19/90] add power9 test --- .github/workflows/tests_archdetect.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 9a26efe437..8fbe8d7946 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -11,6 +11,7 @@ jobs: - x86_64/intel/skylake_avx512 - x86_64/amd/zen2 - x86_64/amd/zen3 + - ppc64le/power9le fail-fast: false steps: - uses: actions/checkout@v2 From 636ef94bd57f7a25519c42402a730bc07c5437b8 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 09:54:49 +0200 Subject: [PATCH 20/90] update matrix --- .github/workflows/tests_archdetect.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 8fbe8d7946..54dccf76f5 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -6,18 +6,29 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: + machine_type: + - x86_64 + - ppc64le proc_cpuinfo: - x86_64/intel/haswell - x86_64/intel/skylake_avx512 - x86_64/amd/zen2 - x86_64/amd/zen3 - ppc64le/power9le + exclude: + - machine_type: x86_64 + proc_cpuinfo: ppc64le/power9le + - machine_type: ppc64le + include: + - machine_type: ppc64le + proc_cpuinfo: ppc64le/power9le fail-fast: false steps: - uses: actions/checkout@v2 - name: test eessi_archdetect.sh run: | + export EESSI_MACHINE_TYPE=${{matrix.machine_type}} export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) if [[ $CPU_ARCH == "${{matrix.proc_cpuinfo}}" ]]; then From 78f76ffb68b87484547033c3a8cda0ac510609c1 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 10:10:18 +0200 Subject: [PATCH 21/90] remove matrix --- .github/workflows/tests_archdetect.yml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 54dccf76f5..124a95ca74 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -6,29 +6,19 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - machine_type: - - x86_64 - - ppc64le proc_cpuinfo: - x86_64/intel/haswell - x86_64/intel/skylake_avx512 - x86_64/amd/zen2 - x86_64/amd/zen3 - ppc64le/power9le - exclude: - - machine_type: x86_64 - proc_cpuinfo: ppc64le/power9le - - machine_type: ppc64le - include: - - machine_type: ppc64le - proc_cpuinfo: ppc64le/power9le fail-fast: false steps: - uses: actions/checkout@v2 - name: test eessi_archdetect.sh run: | - export EESSI_MACHINE_TYPE=${{matrix.machine_type}} + export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo%%/*}} export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) if [[ $CPU_ARCH == "${{matrix.proc_cpuinfo}}" ]]; then From 09d822d3ddd6ad3b12b3c633e79c83bee8d8aeef Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 10:11:53 +0200 Subject: [PATCH 22/90] remove matrix --- .github/workflows/tests_archdetect.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 124a95ca74..b5d51ea3c8 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -18,7 +18,8 @@ jobs: - name: test eessi_archdetect.sh run: | - export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo%%/*}} + export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}} + export EESSI_MACHINE_TYPE=${EESSI_MACHINE_TYPE%%/*} export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) if [[ $CPU_ARCH == "${{matrix.proc_cpuinfo}}" ]]; then From e821c4e4dddfbe2404b8b45d6d70febd9d75843f Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 10:26:55 +0200 Subject: [PATCH 23/90] code cleanup --- init/eessi_archdetect.sh | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 3b2fc2986a..9a9b8f793e 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -15,6 +15,7 @@ ARGUMENT=${1:-none} cpupath () { # let the kernel tell base machine type MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} + PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} # fallback path CPU_PATH="${MACHINE_TYPE}/generic" @@ -25,9 +26,8 @@ cpupath () { fi if [ ${MACHINE_TYPE} == "ppc64le" ]; then - PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ .*POWER9* ]] && HAS_POWER9=true + [[ $CPU_FLAGS =~ ".* POWER9 *" ]] && HAS_POWER9=true [[ ${HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le echo ${CPU_PATH} @@ -36,21 +36,20 @@ cpupath () { if [ ${MACHINE_TYPE} == "x86_64" ]; then # check for vendor info, if available, for x86_64 - PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) - [[ $CPUINFO_VENDOR_FLAG =~ .*GenuineIntel* ]] && CPU_VENDOR=intel - [[ $CPUINFO_VENDOR_FLAG =~ .*AuthenticAMD* ]] && CPU_VENDOR=amd + [[ $CPUINFO_VENDOR_FLAG =~ ".*GenuineIntel*" ]] && CPU_VENDOR=intel + [[ $CPUINFO_VENDOR_FLAG =~ ".*AuthenticAMD*" ]] && CPU_VENDOR=amd CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ .*avx2* ]] && HAS_AVX2=true - [[ $CPU_FLAGS =~ .*fma* ]] && HAS_FMA=true - [[ $CPU_FLAGS =~ .*avx512f* ]] && HAS_AVX512F=true - [[ $CPU_FLAGS =~ .*avx512vl* ]] && HAS_AVX512VL=true - [[ $CPU_FLAGS =~ .*avx512ifma* ]] && HAS_AVX512IFMA=true - [[ $CPU_FLAGS =~ .*avx512_vbmi2* ]] && HAS_AVX512_VBMI2=true - [[ $CPU_FLAGS =~ .*avx512_vnni* ]] && HAS_AVX512_VNNI=true - [[ $CPU_FLAGS =~ .*avx512fp16* ]] && HAS_AVX512FP16=true - [[ $CPU_FLAGS =~ .*vaes* ]] && HAS_VAES=true + [[ $CPU_FLAGS =~ ".*avx2*" ]] && HAS_AVX2=true + [[ $CPU_FLAGS =~ ".*fma*" ]] && HAS_FMA=true + [[ $CPU_FLAGS =~ ".*avx512f*" ]] && HAS_AVX512F=true + [[ $CPU_FLAGS =~ ".*avx512vl*" ]] && HAS_AVX512VL=true + [[ $CPU_FLAGS =~ ".*avx512ifma*" ]] && HAS_AVX512IFMA=true + [[ $CPU_FLAGS =~ ".*avx512_vbmi2*" ]] && HAS_AVX512_VBMI2=true + [[ $CPU_FLAGS =~ ".*avx512_vnni*" ]] && HAS_AVX512_VNNI=true + [[ $CPU_FLAGS =~ ".*avx512fp16*" ]] && HAS_AVX512FP16=true + [[ $CPU_FLAGS =~ ".*vaes*" ]] && HAS_VAES=true if [ ${CPU_VENDOR} == "intel" ]; then [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell From c7d3e2bb656e068b5bb35def399573a51008f384 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 10:42:17 +0200 Subject: [PATCH 24/90] code cleanup --- init/eessi_archdetect.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 9a9b8f793e..cfb05c0204 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -27,7 +27,7 @@ cpupath () { if [ ${MACHINE_TYPE} == "ppc64le" ]; then CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ ".* POWER9 *" ]] && HAS_POWER9=true + [[ $CPU_FLAGS =~ " POWER9( |$)" ]] && HAS_POWER9=true [[ ${HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le echo ${CPU_PATH} @@ -37,19 +37,19 @@ cpupath () { if [ ${MACHINE_TYPE} == "x86_64" ]; then # check for vendor info, if available, for x86_64 CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) - [[ $CPUINFO_VENDOR_FLAG =~ ".*GenuineIntel*" ]] && CPU_VENDOR=intel + [[ $CPUINFO_VENDOR_FLAG =~ "GenuineIntel" ]] && CPU_VENDOR=intel [[ $CPUINFO_VENDOR_FLAG =~ ".*AuthenticAMD*" ]] && CPU_VENDOR=amd CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ ".*avx2*" ]] && HAS_AVX2=true - [[ $CPU_FLAGS =~ ".*fma*" ]] && HAS_FMA=true - [[ $CPU_FLAGS =~ ".*avx512f*" ]] && HAS_AVX512F=true - [[ $CPU_FLAGS =~ ".*avx512vl*" ]] && HAS_AVX512VL=true - [[ $CPU_FLAGS =~ ".*avx512ifma*" ]] && HAS_AVX512IFMA=true - [[ $CPU_FLAGS =~ ".*avx512_vbmi2*" ]] && HAS_AVX512_VBMI2=true - [[ $CPU_FLAGS =~ ".*avx512_vnni*" ]] && HAS_AVX512_VNNI=true - [[ $CPU_FLAGS =~ ".*avx512fp16*" ]] && HAS_AVX512FP16=true - [[ $CPU_FLAGS =~ ".*vaes*" ]] && HAS_VAES=true + [[ $CPU_FLAGS =~ " avx2( |$)" ]] && HAS_AVX2=true + [[ $CPU_FLAGS =~ " fma( |$)" ]] && HAS_FMA=true + [[ $CPU_FLAGS =~ " avx512f( |$)" ]] && HAS_AVX512F=true + [[ $CPU_FLAGS =~ " avx512vl( |$)" ]] && HAS_AVX512VL=true + [[ $CPU_FLAGS =~ " avx512ifma( |$)" ]] && HAS_AVX512IFMA=true + [[ $CPU_FLAGS =~ " avx512_vbmi2( |$)" ]] && HAS_AVX512_VBMI2=true + [[ $CPU_FLAGS =~ " avx512_vnni( |$)" ]] && HAS_AVX512_VNNI=true + [[ $CPU_FLAGS =~ " avx512fp16( |$)" ]] && HAS_AVX512FP16=true + [[ $CPU_FLAGS =~ " vaes( |$)" ]] && HAS_VAES=true if [ ${CPU_VENDOR} == "intel" ]; then [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell From 36e8fa4f48f19460479f296f1caa76787b88bb72 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 10:50:39 +0200 Subject: [PATCH 25/90] code cleanup --- init/eessi_archdetect.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index cfb05c0204..f9f9871fe9 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -27,7 +27,7 @@ cpupath () { if [ ${MACHINE_TYPE} == "ppc64le" ]; then CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ " POWER9( |$)" ]] && HAS_POWER9=true + [[ $CPU_FLAGS =~ " POWER9 " ]] && HAS_POWER9=true [[ ${HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le echo ${CPU_PATH} @@ -38,18 +38,18 @@ cpupath () { # check for vendor info, if available, for x86_64 CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) [[ $CPUINFO_VENDOR_FLAG =~ "GenuineIntel" ]] && CPU_VENDOR=intel - [[ $CPUINFO_VENDOR_FLAG =~ ".*AuthenticAMD*" ]] && CPU_VENDOR=amd + [[ $CPUINFO_VENDOR_FLAG =~ "AuthenticAMD" ]] && CPU_VENDOR=amd - CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ " avx2( |$)" ]] && HAS_AVX2=true - [[ $CPU_FLAGS =~ " fma( |$)" ]] && HAS_FMA=true - [[ $CPU_FLAGS =~ " avx512f( |$)" ]] && HAS_AVX512F=true - [[ $CPU_FLAGS =~ " avx512vl( |$)" ]] && HAS_AVX512VL=true - [[ $CPU_FLAGS =~ " avx512ifma( |$)" ]] && HAS_AVX512IFMA=true - [[ $CPU_FLAGS =~ " avx512_vbmi2( |$)" ]] && HAS_AVX512_VBMI2=true - [[ $CPU_FLAGS =~ " avx512_vnni( |$)" ]] && HAS_AVX512_VNNI=true - [[ $CPU_FLAGS =~ " avx512fp16( |$)" ]] && HAS_AVX512FP16=true - [[ $CPU_FLAGS =~ " vaes( |$)" ]] && HAS_VAES=true + CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') + [[ $CPU_FLAGS =~ " avx2 " ]] && HAS_AVX2=true + [[ $CPU_FLAGS =~ " fma " ]] && HAS_FMA=true + [[ $CPU_FLAGS =~ " avx512f " ]] && HAS_AVX512F=true + [[ $CPU_FLAGS =~ " avx512vl " ]] && HAS_AVX512VL=true + [[ $CPU_FLAGS =~ " avx512ifma " ]] && HAS_AVX512IFMA=true + [[ $CPU_FLAGS =~ " avx512_vbmi2 " ]] && HAS_AVX512_VBMI2=true + [[ $CPU_FLAGS =~ " avx512_vnni " ]] && HAS_AVX512_VNNI=true + [[ $CPU_FLAGS =~ " avx512fp16 " ]] && HAS_AVX512FP16=true + [[ $CPU_FLAGS =~ " vaes " ]] && HAS_VAES=true if [ ${CPU_VENDOR} == "intel" ]; then [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell From e796e4f26549be77de1c4c2874eefe8cf666c12a Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 11:04:39 +0200 Subject: [PATCH 26/90] code cleanup --- init/eessi_archdetect.sh | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index f9f9871fe9..3dcc5a70d6 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -27,9 +27,9 @@ cpupath () { if [ ${MACHINE_TYPE} == "ppc64le" ]; then CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ " POWER9 " ]] && HAS_POWER9=true + [[ $CPU_FLAGS =~ " POWER9 " ]] && EESSI_HAS_POWER9=true - [[ ${HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le + [[ ${EESSI_HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le echo ${CPU_PATH} exit fi @@ -37,31 +37,31 @@ cpupath () { if [ ${MACHINE_TYPE} == "x86_64" ]; then # check for vendor info, if available, for x86_64 CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) - [[ $CPUINFO_VENDOR_FLAG =~ "GenuineIntel" ]] && CPU_VENDOR=intel - [[ $CPUINFO_VENDOR_FLAG =~ "AuthenticAMD" ]] && CPU_VENDOR=amd + [[ $CPUINFO_VENDOR_FLAG =~ "GenuineIntel" ]] && EESSI_CPU_VENDOR=intel + [[ $CPUINFO_VENDOR_FLAG =~ "AuthenticAMD" ]] && EESSI_CPU_VENDOR=amd CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') - [[ $CPU_FLAGS =~ " avx2 " ]] && HAS_AVX2=true - [[ $CPU_FLAGS =~ " fma " ]] && HAS_FMA=true - [[ $CPU_FLAGS =~ " avx512f " ]] && HAS_AVX512F=true - [[ $CPU_FLAGS =~ " avx512vl " ]] && HAS_AVX512VL=true - [[ $CPU_FLAGS =~ " avx512ifma " ]] && HAS_AVX512IFMA=true - [[ $CPU_FLAGS =~ " avx512_vbmi2 " ]] && HAS_AVX512_VBMI2=true - [[ $CPU_FLAGS =~ " avx512_vnni " ]] && HAS_AVX512_VNNI=true - [[ $CPU_FLAGS =~ " avx512fp16 " ]] && HAS_AVX512FP16=true - [[ $CPU_FLAGS =~ " vaes " ]] && HAS_VAES=true + [[ $CPU_FLAGS =~ " avx2 " ]] && EESSI_HAS_AVX2=true + [[ $CPU_FLAGS =~ " fma " ]] && EESSI_HAS_FMA=true + [[ $CPU_FLAGS =~ " avx512f " ]] && EESSI_HAS_AVX512F=true + [[ $CPU_FLAGS =~ " avx512vl " ]] && EESSI_HAS_AVX512VL=true + [[ $CPU_FLAGS =~ " avx512ifma " ]] && EESSI_HAS_AVX512IFMA=true + [[ $CPU_FLAGS =~ " avx512_vbmi2 " ]] && EESSI_HAS_AVX512_VBMI2=true + [[ $CPU_FLAGS =~ " avx512_vnni " ]] && EESSI_HAS_AVX512_VNNI=true + [[ $CPU_FLAGS =~ " avx512fp16 " ]] && EESSI_HAS_AVX512FP16=true + [[ $CPU_FLAGS =~ " vaes " ]] && EESSI_HAS_VAES=true - if [ ${CPU_VENDOR} == "intel" ]; then - [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=haswell - [[ ${HAS_AVX512F} ]] && CPU_TYPE=skylake_avx512 + if [ ${EESSI_CPU_VENDOR} == "intel" ]; then + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=haswell + [[ ${EESSI_HAS_AVX512F} ]] && EESSI_CPU_TYPE=skylake_avx512 # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 - elif [ ${CPU_VENDOR} == "amd" ]; then - [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && CPU_TYPE=zen2 - [[ ${HAS_AVX2} ]] && [[ ${HAS_FMA} ]] && [[ ${HAS_VAES} ]] && CPU_TYPE=zen3 + elif [ ${EESSI_CPU_VENDOR} == "amd" ]; then + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && CPU_TYPE=zen2 + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && CPU_TYPE=zen3 fi - [[ ${CPU_VENDOR} ]] && [[ $CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${CPU_VENDOR}/${CPU_TYPE}" + [[ ${EESSI_CPU_VENDOR} ]] && [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} exit From 572143e866fa4249d8d29d1888b063966a688bc0 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 11:06:36 +0200 Subject: [PATCH 27/90] code cleanup --- init/eessi_archdetect.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 3dcc5a70d6..09feff8c36 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -57,8 +57,8 @@ cpupath () { # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 elif [ ${EESSI_CPU_VENDOR} == "amd" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && CPU_TYPE=zen2 - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && CPU_TYPE=zen3 + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=zen2 + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && EESSI_CPU_TYPE=zen3 fi [[ ${EESSI_CPU_VENDOR} ]] && [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" From b3c9b13b75e8d907f9786fdff8fb890280cbb06a Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 11:17:20 +0200 Subject: [PATCH 28/90] add aarch64 cpuinfo test data --- tests/archdetect/aarch64/graviton2 | 8 ++++++++ tests/archdetect/aarch64/graviton3 | 8 ++++++++ 2 files changed, 16 insertions(+) create mode 100644 tests/archdetect/aarch64/graviton2 create mode 100644 tests/archdetect/aarch64/graviton3 diff --git a/tests/archdetect/aarch64/graviton2 b/tests/archdetect/aarch64/graviton2 new file mode 100644 index 0000000000..17f1615825 --- /dev/null +++ b/tests/archdetect/aarch64/graviton2 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 243.75 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp ssbs +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x3 +CPU part : 0xd0c +CPU revision : 1 diff --git a/tests/archdetect/aarch64/graviton3 b/tests/archdetect/aarch64/graviton3 new file mode 100644 index 0000000000..01246f99da --- /dev/null +++ b/tests/archdetect/aarch64/graviton3 @@ -0,0 +1,8 @@ +processor : 0 +BogoMIPS : 2100.00 +Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs paca pacg dcpodp svei8mm svebf16 i8mm bf16 dgh rng +CPU implementer : 0x41 +CPU architecture: 8 +CPU variant : 0x1 +CPU part : 0xd40 +CPU revision : 1 From e8341a694bb3e645d9bdb7e9cf370daf5a0fe515 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Thu, 15 Sep 2022 11:23:49 +0200 Subject: [PATCH 29/90] add unset for feature vars --- init/eessi_archdetect.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 09feff8c36..ada7149d62 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -16,6 +16,9 @@ cpupath () { # let the kernel tell base machine type MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} + + # clean up any existing pointers to cpu features + unset $(env | grep EESSI_HAS | cut -f1 -d=) # fallback path CPU_PATH="${MACHINE_TYPE}/generic" From 3ce8a01c890039e9cc9eccc6ea557b016e581f6b Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 08:33:57 +0200 Subject: [PATCH 30/90] re-order power and add aarch64 detection --- init/eessi_archdetect.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index ada7149d62..571689a3d6 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,12 +1,14 @@ #!/bin/bash -# current pathways implemented in EESSI +# current pathways implemented in EESSI 2021.12 pilot version # x86_64/generic # x86_64/intel/haswell # x86_64/intel/skylake_avx512 # x86_64/amd/zen2 # x86_64/amd/zen3 # aarch64/generic +# aarch64/graviton2 +# aarch64/graviton3 # ppc64le/generic # ppc64le/power9le @@ -24,6 +26,14 @@ cpupath () { CPU_PATH="${MACHINE_TYPE}/generic" if [ ${MACHINE_TYPE} == "aarch64" ]; then + CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') + [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true + [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true + + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=graviton2 + [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=graviton3 + + [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} exit fi @@ -32,7 +42,9 @@ cpupath () { CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) [[ $CPU_FLAGS =~ " POWER9 " ]] && EESSI_HAS_POWER9=true - [[ ${EESSI_HAS_POWER9} ]] && CPU_PATH=${MACHINE_TYPE}/power9le + [[ ${EESSI_HAS_POWER9} ]] && EESSI_CPU_TYPE=power9le + + [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} exit fi From 30925e6e8953c143f436d1e482b5e30fdb0ad2ae Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 08:35:29 +0200 Subject: [PATCH 31/90] add aarch64 tests --- .github/workflows/tests_archdetect.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index b5d51ea3c8..942bafe560 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -12,6 +12,8 @@ jobs: - x86_64/amd/zen2 - x86_64/amd/zen3 - ppc64le/power9le + - aarch64/graviton2 + - aarch64/graviton3 fail-fast: false steps: - uses: actions/checkout@v2 From e42e0a6f7076b7cf359ca963a906d471015874a8 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 08:38:53 +0200 Subject: [PATCH 32/90] move to features for aarch64 --- init/eessi_archdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 571689a3d6..7680325417 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -26,7 +26,7 @@ cpupath () { CPU_PATH="${MACHINE_TYPE}/generic" if [ ${MACHINE_TYPE} == "aarch64" ]; then - CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') + CPU_FLAGS=$(grep -m 1 -i ^features ${PROC_CPUINFO} | sed 's/$/ /g') [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true From 51ddaa76603fc686bf68ec7e679334ded12acbb1 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 08:53:41 +0200 Subject: [PATCH 33/90] add support for aarch64 neoverse-n1 --- init/eessi_archdetect.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 7680325417..d83242c00f 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -21,19 +21,33 @@ cpupath () { # clean up any existing pointers to cpu features unset $(env | grep EESSI_HAS | cut -f1 -d=) + unset EESSI_CPU_VENDOR # fallback path CPU_PATH="${MACHINE_TYPE}/generic" if [ ${MACHINE_TYPE} == "aarch64" ]; then - CPU_FLAGS=$(grep -m 1 -i ^features ${PROC_CPUINFO} | sed 's/$/ /g') - [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true - [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=graviton2 - [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=graviton3 + CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) + [[ $CPUINFO_VENDOR_FLAG =~ "ARM" ]] && EESSI_CPU_VENDOR=arm + + if [ ${EESSI_CPU_VENDOR} == "arm" ]; then + CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') + [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true + [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true + + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 + [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 + [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" + else + CPU_FLAGS=$(grep -m 1 -i ^features ${PROC_CPUINFO} | sed 's/$/ /g') + [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true + [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true + + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=graviton2 + [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=graviton3 + [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" + fi - [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} exit fi From 38194b89ed7547734948c98384f59842fc0c4b5c Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 08:54:24 +0200 Subject: [PATCH 34/90] add support for aarch64 neoverse-n1 --- tests/archdetect/aarch64/arm/neoverse-n1 | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/archdetect/aarch64/arm/neoverse-n1 diff --git a/tests/archdetect/aarch64/arm/neoverse-n1 b/tests/archdetect/aarch64/arm/neoverse-n1 new file mode 100644 index 0000000000..49824722f2 --- /dev/null +++ b/tests/archdetect/aarch64/arm/neoverse-n1 @@ -0,0 +1,30 @@ +Architecture: aarch64 +CPU op-mode(s): 32-bit, 64-bit +Byte Order: Little Endian +CPU(s): 64 +On-line CPU(s) list: 0-63 +Thread(s) per core: 1 +Core(s) per socket: 64 +Socket(s): 1 +NUMA node(s): 1 +Vendor ID: ARM +Model: 1 +Model name: Neoverse-N1 +Stepping: r3p1 +BogoMIPS: 50.00 +L1d cache: 4 MiB +L1i cache: 4 MiB +L2 cache: 64 MiB +L3 cache: 32 MiB +NUMA node0 CPU(s): 0-63 +Vulnerability Itlb multihit: Not affected +Vulnerability L1tf: Not affected +Vulnerability Mds: Not affected +Vulnerability Meltdown: Mitigation; PTI +Vulnerability Mmio stale data: Not affected +Vulnerability Spec store bypass: Not affected +Vulnerability Spectre v1: Mitigation; __user pointer sanitization +Vulnerability Spectre v2: Mitigation; CSV2, BHB +Vulnerability Srbds: Not affected +Vulnerability Tsx async abort: Not affected +Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp From d891813105f2eb34a5404bdd29b3b45918c53038 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 08:55:09 +0200 Subject: [PATCH 35/90] add support for aarch64 neoverse-n1 --- .github/workflows/tests_archdetect.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 942bafe560..51a6bcb4d8 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -14,6 +14,7 @@ jobs: - ppc64le/power9le - aarch64/graviton2 - aarch64/graviton3 + - aarch64/arm/neoverse-n1 fail-fast: false steps: - uses: actions/checkout@v2 From 0cd0af421b7b4be55f82224b6d5da423fd86040b Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 09:48:13 +0200 Subject: [PATCH 36/90] add architecture-cpu comments --- init/eessi_archdetect.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index d83242c00f..c22ff4dfa3 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -35,7 +35,7 @@ cpupath () { [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 #Ampere Altra [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" else @@ -43,8 +43,8 @@ cpupath () { [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=graviton2 - [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=graviton3 + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=graviton2 #AWS Graviton2 + [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=graviton3 #AWS Graviton3 [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" fi @@ -56,7 +56,7 @@ cpupath () { CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) [[ $CPU_FLAGS =~ " POWER9 " ]] && EESSI_HAS_POWER9=true - [[ ${EESSI_HAS_POWER9} ]] && EESSI_CPU_TYPE=power9le + [[ ${EESSI_HAS_POWER9} ]] && EESSI_CPU_TYPE=power9le #Power9 [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} @@ -81,13 +81,13 @@ cpupath () { [[ $CPU_FLAGS =~ " vaes " ]] && EESSI_HAS_VAES=true if [ ${EESSI_CPU_VENDOR} == "intel" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=haswell - [[ ${EESSI_HAS_AVX512F} ]] && EESSI_CPU_TYPE=skylake_avx512 + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=haswell #Haswell, Broadwell + [[ ${EESSI_HAS_AVX512F} ]] && EESSI_CPU_TYPE=skylake_avx512 #Skylake, Cascade Lake # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 elif [ ${EESSI_CPU_VENDOR} == "amd" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=zen2 - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && EESSI_CPU_TYPE=zen3 + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=zen2 #Rome + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && EESSI_CPU_TYPE=zen3 #Milan, Milan-X fi [[ ${EESSI_CPU_VENDOR} ]] && [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" From 28c7b2310e10598bd5cc9671386a695729881fd0 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 09:53:26 +0200 Subject: [PATCH 37/90] re-order aarch64 output and remove graviton --- init/eessi_archdetect.sh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index c22ff4dfa3..6ca9690eee 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -32,22 +32,17 @@ cpupath () { if [ ${EESSI_CPU_VENDOR} == "arm" ]; then CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') - [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true - [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 #Ampere Altra - [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 - [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" else CPU_FLAGS=$(grep -m 1 -i ^features ${PROC_CPUINFO} | sed 's/$/ /g') - [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true - [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=graviton2 #AWS Graviton2 - [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=graviton3 #AWS Graviton3 - [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" fi + [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true + [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true + + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 #Ampere Altra + [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 + [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" + echo ${CPU_PATH} exit fi From ed42876f109e2ffebf4f1bc8dbd80b137e88920a Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 09:56:40 +0200 Subject: [PATCH 38/90] re-order aarch64 output and remove graviton --- init/eessi_archdetect.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 6ca9690eee..52f7af728e 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -38,9 +38,12 @@ cpupath () { [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 #Ampere Altra - [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 + + # we will not return graviton2 as a result here, since then we get get graviton2 as a result while we're actually on a thunderx2, for example. + # We should break here with archspec, and symlink aarch64/arm/neoverse-n1 to aarch64/graviton2 in EESSI pilot 2021.12, + # and then the reverse in the next EESSI pilot (so it still works with archspec). + [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 # Ampere Altra, AWS graviton2 + [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 # AWS graviton3 [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} @@ -51,7 +54,7 @@ cpupath () { CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) [[ $CPU_FLAGS =~ " POWER9 " ]] && EESSI_HAS_POWER9=true - [[ ${EESSI_HAS_POWER9} ]] && EESSI_CPU_TYPE=power9le #Power9 + [[ ${EESSI_HAS_POWER9} ]] && EESSI_CPU_TYPE=power9le # IBM Power9 [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" echo ${CPU_PATH} @@ -76,13 +79,13 @@ cpupath () { [[ $CPU_FLAGS =~ " vaes " ]] && EESSI_HAS_VAES=true if [ ${EESSI_CPU_VENDOR} == "intel" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=haswell #Haswell, Broadwell - [[ ${EESSI_HAS_AVX512F} ]] && EESSI_CPU_TYPE=skylake_avx512 #Skylake, Cascade Lake + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=haswell # Intel Haswell, Broadwell + [[ ${EESSI_HAS_AVX512F} ]] && EESSI_CPU_TYPE=skylake_avx512 # Intel Skylake, Cascade Lake # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 elif [ ${EESSI_CPU_VENDOR} == "amd" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=zen2 #Rome - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && EESSI_CPU_TYPE=zen3 #Milan, Milan-X + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=zen2 # AMD Rome + [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && EESSI_CPU_TYPE=zen3 # AMD Milan, Milan-X fi [[ ${EESSI_CPU_VENDOR} ]] && [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" From d0fdf4bfa620cf524d2d0b932a6dc40d13709d96 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 10:15:25 +0200 Subject: [PATCH 39/90] remove graviton from test --- .github/workflows/tests_archdetect.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 51a6bcb4d8..2b8b2f9465 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -12,8 +12,8 @@ jobs: - x86_64/amd/zen2 - x86_64/amd/zen3 - ppc64le/power9le - - aarch64/graviton2 - - aarch64/graviton3 + # - aarch64/graviton2 + # - aarch64/graviton3 - aarch64/arm/neoverse-n1 fail-fast: false steps: From 28999603e6f3089a85973cbd8a9aea798d3a0054 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 10:21:08 +0200 Subject: [PATCH 40/90] move from /bin/bash to /usr/bin/env bash --- init/eessi_archdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 52f7af728e..4a598eafdc 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # current pathways implemented in EESSI 2021.12 pilot version # x86_64/generic From bbac2525de86b9d6e69e842648dbb61bbd4f6512 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Fri, 16 Sep 2022 11:15:47 +0200 Subject: [PATCH 41/90] synch output for archdetect / archspec --- init/eessi_environment_variables | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/init/eessi_environment_variables b/init/eessi_environment_variables index caf935751e..d32a1c8279 100644 --- a/init/eessi_environment_variables +++ b/init/eessi_environment_variables @@ -28,11 +28,12 @@ if [ -d $EESSI_PREFIX ]; then if [ -z $EESSI_USE_ARCHDETECT ]; then # if archdetect is enabled, use internal code export EESSI_SOFTWARE_SUBDIR=$(${EESSI_INIT_DIR_PATH}/eessi_archdetect.sh cpupath) - echo "archdetect says ${EESSI_SOFTWARE_SUBDIR}" + echo "archdetect says ${EESSI_SOFTWARE_SUBDIR}" >> $output else # note: eessi_software_subdir_for_host.py will pick up value from $EESSI_SOFTWARE_SUBDIR_OVERRIDE if it's defined! export EESSI_EPREFIX_PYTHON=$EESSI_EPREFIX/usr/bin/python3 export EESSI_SOFTWARE_SUBDIR=$($EESSI_EPREFIX_PYTHON ${EESSI_INIT_DIR_PATH}/eessi_software_subdir_for_host.py $EESSI_PREFIX) + echo "archspec says ${EESSI_SOFTWARE_SUBDIR}" >> $output fi if [ ! -z $EESSI_SOFTWARE_SUBDIR ]; then From a5b4e8e5201d8de313b67bb727dd2f4f8bdf5aa7 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Mon, 19 Sep 2022 12:08:35 +0200 Subject: [PATCH 42/90] rewrite by Alex Domingo (lexming) --- init/arch_detect.sh | 65 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100755 init/arch_detect.sh diff --git a/init/arch_detect.sh b/init/arch_detect.sh new file mode 100755 index 0000000000..d0516ac8ec --- /dev/null +++ b/init/arch_detect.sh @@ -0,0 +1,65 @@ +#!/bin/bash + +# x86_64 CPU architecture specifications +arch_x86=() +arch_x86+=('("x86_64/intel/haswell" "GenuineIntel" "avx2 fma")') # Intel Haswell, Broadwell +arch_x86+=('("x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f")') # Intel Skylake, Cascade Lake +arch_x86+=('("x86_64/amd/zen2" "AuthenticAMD" "avx2 fma")') # AMD Rome +arch_x86+=('("x86_64/amd/zen3" "AuthenticAMD" "avx2 fma vaes")') # AMD Milan, Milan-X + +# ARM CPU architecture specifications +arch_arm=() +arch_arm+=('("aarch64/arm/neoverse-n1" "ARM" "asimd")') # Ampere Altra +arch_arm+=('("aarch64/arm/neoverse-n1" "" "asimd")') # AWS Graviton2 +arch_arm+=('("aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm")') +arch_arm+=('("aarch64/arm/neoverse-v1" "" "asimd svei8mm")') # AWS Graviton3 + +# CPU specification of host system +get_cpuinfo(){ + cpuinfo_pattern="^${1}\s*:" + #grep -i "$cpuinfo_pattern" /proc/cpuinfo | tail -n 1 | sed "s/$cpuinfo_pattern//" + grep -i "$cpuinfo_pattern" ${EESSI_PROC_CPUINFO:-/proc/cpuinfo} | tail -n 1 | sed "s/$cpuinfo_pattern//" +} + +#MACHINE_TYPE=$(uname -m) +MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} +echo cpu architecture seems to be $MACHINE_TYPE +[ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") +[ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") +[[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit + +#CPU_VENDOR_TAG="vendor_id" +CPU_VENDOR_TAG="vendor[ _]id" +CPU_VENDOR=$(get_cpuinfo "$CPU_VENDOR_TAG") +CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) +echo "== CPU vendor of host system: $CPU_VENDOR" >&2 + +CPU_FLAG_TAG='flags' +# cpuinfo of some ARM systems print features instead of flags +[ "${CPU_VENDOR}" == "ARM" ] && CPU_FLAG_TAG='flags' +[ "${MACHINE_TYPE}" == "aarch64" ] && [ "${CPU_VENDOR}x" == "x" ] && CPU_FLAG_TAG='features' + +CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") +echo "== CPU flags of host system: $CPU_FLAGS" >&2 + +# Default to generic CPU +BEST_MATCH="generic" + +# Find best match +check_flags(){ + for flag in "$@"; do + [[ " ${CPU_FLAGS[*]} " == *" $flag "* ]] || return 1 + done + return 0 +} + +for arch in "${CPU_ARCH_SPEC[@]}"; do + eval "arch_spec=$arch" + if [ "${CPU_VENDOR}x" == "${arch_spec[1]}x" ]; then + check_flags ${arch_spec[2]} && BEST_MATCH=${arch_spec[0]} + echo "== got a match with $BEST_MATCH" >&2 + fi +done + +echo "Best match is $BEST_MATCH" >&2 +echo "$BEST_MATCH" From 0d1daf422aa91c26c7c42787c0be95ea836fb33f Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Mon, 19 Sep 2022 12:11:22 +0200 Subject: [PATCH 43/90] move test to new code --- .github/workflows/tests_archdetect.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 2b8b2f9465..c7eb41767f 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -24,7 +24,8 @@ jobs: export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}} export EESSI_MACHINE_TYPE=${EESSI_MACHINE_TYPE%%/*} export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} - CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) + #CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) + CPU_ARCH=$(./init/arch_detect.sh cpupath) if [[ $CPU_ARCH == "${{matrix.proc_cpuinfo}}" ]]; then echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" >&2 else From ce2dacae8f258bdc3532c94d2a3746520baf78fc Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Mon, 19 Sep 2022 12:14:19 +0200 Subject: [PATCH 44/90] redirecting output to err, keeping final echo --- init/arch_detect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/arch_detect.sh b/init/arch_detect.sh index d0516ac8ec..74b308cf98 100755 --- a/init/arch_detect.sh +++ b/init/arch_detect.sh @@ -23,7 +23,7 @@ get_cpuinfo(){ #MACHINE_TYPE=$(uname -m) MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} -echo cpu architecture seems to be $MACHINE_TYPE +echo cpu architecture seems to be $MACHINE_TYPE >&2 [ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") [ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") [[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit From 1d710951226e66ecf206fca7ade7f95bc35761af Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Mon, 19 Sep 2022 12:34:48 +0200 Subject: [PATCH 45/90] adding power to arch_detect --- init/arch_detect.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/init/arch_detect.sh b/init/arch_detect.sh index 74b308cf98..a93256f678 100755 --- a/init/arch_detect.sh +++ b/init/arch_detect.sh @@ -14,6 +14,10 @@ arch_arm+=('("aarch64/arm/neoverse-n1" "" "asimd")') # AWS Graviton2 arch_arm+=('("aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm")') arch_arm+=('("aarch64/arm/neoverse-v1" "" "asimd svei8mm")') # AWS Graviton3 +# Power CPU architecture specifications +arch_power=() +arch_power+=('("ppc64le/power9le" "" "POWER9")') # IBM Power9 + # CPU specification of host system get_cpuinfo(){ cpuinfo_pattern="^${1}\s*:" @@ -26,6 +30,7 @@ MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} echo cpu architecture seems to be $MACHINE_TYPE >&2 [ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") [ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") +[ "${MACHINE_TYPE}" == "ppc64le" ] && CPU_ARCH_SPEC=("${arch_power[@]}") [[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit #CPU_VENDOR_TAG="vendor_id" @@ -35,9 +40,10 @@ CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) echo "== CPU vendor of host system: $CPU_VENDOR" >&2 CPU_FLAG_TAG='flags' -# cpuinfo of some ARM systems print features instead of 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}" == "ppc64le" ] && CPU_FLAG_TAG='cpu' CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") echo "== CPU flags of host system: $CPU_FLAGS" >&2 From 70be449fc2e6f1f362a07cb86c92445e92a9e49c Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Mon, 19 Sep 2022 12:51:56 +0200 Subject: [PATCH 46/90] prep arch_detect for other functions, now: cpupath --- init/arch_detect.sh | 72 ++++++++++++++++++++++++++------------------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/init/arch_detect.sh b/init/arch_detect.sh index a93256f678..ab7d96c986 100755 --- a/init/arch_detect.sh +++ b/init/arch_detect.sh @@ -25,32 +25,6 @@ get_cpuinfo(){ grep -i "$cpuinfo_pattern" ${EESSI_PROC_CPUINFO:-/proc/cpuinfo} | tail -n 1 | sed "s/$cpuinfo_pattern//" } -#MACHINE_TYPE=$(uname -m) -MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} -echo cpu architecture seems to be $MACHINE_TYPE >&2 -[ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") -[ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") -[ "${MACHINE_TYPE}" == "ppc64le" ] && CPU_ARCH_SPEC=("${arch_power[@]}") -[[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit - -#CPU_VENDOR_TAG="vendor_id" -CPU_VENDOR_TAG="vendor[ _]id" -CPU_VENDOR=$(get_cpuinfo "$CPU_VENDOR_TAG") -CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) -echo "== CPU vendor of host system: $CPU_VENDOR" >&2 - -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}" == "ppc64le" ] && CPU_FLAG_TAG='cpu' - -CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") -echo "== CPU flags of host system: $CPU_FLAGS" >&2 - -# Default to generic CPU -BEST_MATCH="generic" - # Find best match check_flags(){ for flag in "$@"; do @@ -59,13 +33,51 @@ check_flags(){ return 0 } -for arch in "${CPU_ARCH_SPEC[@]}"; do +ARGUMENT=${1:-none} + +cpupath () { + #MACHINE_TYPE=$(uname -m) + MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} + echo cpu architecture seems to be $MACHINE_TYPE >&2 + [ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") + [ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") + [ "${MACHINE_TYPE}" == "ppc64le" ] && CPU_ARCH_SPEC=("${arch_power[@]}") + [[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit + + #CPU_VENDOR_TAG="vendor_id" + CPU_VENDOR_TAG="vendor[ _]id" + CPU_VENDOR=$(get_cpuinfo "$CPU_VENDOR_TAG") + CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) + echo "== CPU vendor of host system: $CPU_VENDOR" >&2 + + 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}" == "ppc64le" ] && CPU_FLAG_TAG='cpu' + + CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") + echo "== CPU flags of host system: $CPU_FLAGS" >&2 + + # Default to generic CPU + BEST_MATCH="generic" + + for arch in "${CPU_ARCH_SPEC[@]}"; do eval "arch_spec=$arch" if [ "${CPU_VENDOR}x" == "${arch_spec[1]}x" ]; then check_flags ${arch_spec[2]} && BEST_MATCH=${arch_spec[0]} echo "== got a match with $BEST_MATCH" >&2 fi -done + done + + echo "Best match is $BEST_MATCH" >&2 + echo "$BEST_MATCH" +} -echo "Best match is $BEST_MATCH" >&2 -echo "$BEST_MATCH" +if [ ${ARGUMENT} == "none" ]; then + echo usage: $0 cpupath + exit +elif [ ${ARGUMENT} == "cpupath" ]; then + echo $(cpupath) + exit +fi From a797d6def90027927260224dc0a80d2c301ee177 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:11:56 +0200 Subject: [PATCH 47/90] renew tests schema --- .../x86_64/amd/{zen2 => zen2/Azure-CentOS7-7V12.cpuinfo} | 0 tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.output | 1 + 2 files changed, 1 insertion(+) rename tests/archdetect/x86_64/amd/{zen2 => zen2/Azure-CentOS7-7V12.cpuinfo} (100%) create mode 100644 tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.output diff --git a/tests/archdetect/x86_64/amd/zen2 b/tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.cpuinfo similarity index 100% rename from tests/archdetect/x86_64/amd/zen2 rename to tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.cpuinfo diff --git a/tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.output b/tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.output new file mode 100644 index 0000000000..9e4da0c5d6 --- /dev/null +++ b/tests/archdetect/x86_64/amd/zen2/Azure-CentOS7-7V12.output @@ -0,0 +1 @@ +x86_64/amd/zen2 From 8726b407bf20582d8c39812ea81d305b816072a2 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:15:08 +0200 Subject: [PATCH 48/90] allow multiple tests scenarios --- .github/workflows/tests_archdetect.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index c7eb41767f..44104f1a23 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -9,7 +9,7 @@ jobs: proc_cpuinfo: - x86_64/intel/haswell - x86_64/intel/skylake_avx512 - - x86_64/amd/zen2 + - x86_64/amd/zen2/Azure-CentOS7-7V12 - x86_64/amd/zen3 - ppc64le/power9le # - aarch64/graviton2 @@ -23,10 +23,10 @@ jobs: run: | export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}} export EESSI_MACHINE_TYPE=${EESSI_MACHINE_TYPE%%/*} - export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}} + export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}}.cpuinfo #CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) CPU_ARCH=$(./init/arch_detect.sh cpupath) - if [[ $CPU_ARCH == "${{matrix.proc_cpuinfo}}" ]]; then + if [[ $CPU_ARCH == "$( cat ${{matrix.proc_cpuinfo}}.output )" ]]; then echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" >&2 else echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2 From 037abce956d213fa09903d685fe6a7e6e01c6ee2 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:18:27 +0200 Subject: [PATCH 49/90] allow multiple tests scenarios --- .github/workflows/tests_archdetect.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 44104f1a23..7fa5604804 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -26,7 +26,7 @@ jobs: export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}}.cpuinfo #CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) CPU_ARCH=$(./init/arch_detect.sh cpupath) - if [[ $CPU_ARCH == "$( cat ${{matrix.proc_cpuinfo}}.output )" ]]; then + if [[ $CPU_ARCH == "$( cat ./tests/archdetect/${{matrix.proc_cpuinfo}}.output )" ]]; then echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" >&2 else echo "Test for ${{matrix.proc_cpuinfo}} FAILED: $CPU_ARCH" >&2 From a31ce0e151b96de3c5c94badffb6fb46cafba9f3 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:26:39 +0200 Subject: [PATCH 50/90] allow multiple tests scenarios --- .github/workflows/tests_archdetect.yml | 2 +- .../Azure-CentOS7-7V73X.cpuinfo} | 0 .../amd/zen3/Azure-CentOS7-7V73X.output | 1 + tests/archdetect/x86_64/intel/haswell | 25 ------------------- 4 files changed, 2 insertions(+), 26 deletions(-) rename tests/archdetect/x86_64/amd/{zen3 => zen3/Azure-CentOS7-7V73X.cpuinfo} (100%) create mode 100644 tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.output delete mode 100644 tests/archdetect/x86_64/intel/haswell diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 7fa5604804..8509905f28 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -10,7 +10,7 @@ jobs: - x86_64/intel/haswell - x86_64/intel/skylake_avx512 - x86_64/amd/zen2/Azure-CentOS7-7V12 - - x86_64/amd/zen3 + - x86_64/amd/zen3/Azure-CentOS7-7V73X - ppc64le/power9le # - aarch64/graviton2 # - aarch64/graviton3 diff --git a/tests/archdetect/x86_64/amd/zen3 b/tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.cpuinfo similarity index 100% rename from tests/archdetect/x86_64/amd/zen3 rename to tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.cpuinfo diff --git a/tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.output b/tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.output new file mode 100644 index 0000000000..341c027cc2 --- /dev/null +++ b/tests/archdetect/x86_64/amd/zen3/Azure-CentOS7-7V73X.output @@ -0,0 +1 @@ +x86_64/amd/zen3 diff --git a/tests/archdetect/x86_64/intel/haswell b/tests/archdetect/x86_64/intel/haswell deleted file mode 100644 index 7bb5aa958f..0000000000 --- a/tests/archdetect/x86_64/intel/haswell +++ /dev/null @@ -1,25 +0,0 @@ -processor : 0 -vendor_id : GenuineIntel -cpu family : 6 -model : 63 -model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz -stepping : 2 -microcode : 0x3c -cpu MHz : 1757.910 -cache size : 30720 KB -physical id : 0 -siblings : 12 -core id : 0 -cpu cores : 12 -apicid : 0 -initial apicid : 0 -fpu : yes -fpu_exception : yes -cpuid level : 15 -wp : yes -flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc ibpb ibrs stibp dtherm arat pln pts spec_ctrl intel_stibp -bogomips : 4987.97 -clflush size : 64 -cache_alignment : 64 -address sizes : 46 bits physical, 48 bits virtual -power management: From 95ae9202339a3f43cbccf5b7373279d88e53c6dd Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:33:23 +0200 Subject: [PATCH 51/90] renewing tests --- .github/workflows/tests_archdetect.yml | 4 +-- .../haswell/archspec-linux-E5-2680-v3.cpuinfo | 25 +++++++++++++++++++ .../haswell/archspec-linux-E5-2680-v3.output | 1 + .../archspec-linux-6132.cpuinfo} | 0 .../skylake_avx512/archspec-linux-6132.output | 1 + 5 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.cpuinfo create mode 100644 tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.output rename tests/archdetect/x86_64/intel/{skylake_avx512 => skylake_avx512/archspec-linux-6132.cpuinfo} (100%) create mode 100644 tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.output diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 8509905f28..1462fab22a 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -7,8 +7,8 @@ jobs: strategy: matrix: proc_cpuinfo: - - x86_64/intel/haswell - - x86_64/intel/skylake_avx512 + - x86_64/intel/haswell/archspec-linux-E5-2680-v3 + - x86_64/intel/skylake_avx512/archspec-linux-6132 - x86_64/amd/zen2/Azure-CentOS7-7V12 - x86_64/amd/zen3/Azure-CentOS7-7V73X - ppc64le/power9le diff --git a/tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.cpuinfo b/tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.cpuinfo new file mode 100644 index 0000000000..7bb5aa958f --- /dev/null +++ b/tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.cpuinfo @@ -0,0 +1,25 @@ +processor : 0 +vendor_id : GenuineIntel +cpu family : 6 +model : 63 +model name : Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz +stepping : 2 +microcode : 0x3c +cpu MHz : 1757.910 +cache size : 30720 KB +physical id : 0 +siblings : 12 +core id : 0 +cpu cores : 12 +apicid : 0 +initial apicid : 0 +fpu : yes +fpu_exception : yes +cpuid level : 15 +wp : yes +flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm epb invpcid_single tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid cqm xsaveopt cqm_llc cqm_occup_llc ibpb ibrs stibp dtherm arat pln pts spec_ctrl intel_stibp +bogomips : 4987.97 +clflush size : 64 +cache_alignment : 64 +address sizes : 46 bits physical, 48 bits virtual +power management: diff --git a/tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.output b/tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.output new file mode 100644 index 0000000000..5af6120686 --- /dev/null +++ b/tests/archdetect/x86_64/intel/haswell/archspec-linux-E5-2680-v3.output @@ -0,0 +1 @@ +x86_64/intel/haswell diff --git a/tests/archdetect/x86_64/intel/skylake_avx512 b/tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.cpuinfo similarity index 100% rename from tests/archdetect/x86_64/intel/skylake_avx512 rename to tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.cpuinfo diff --git a/tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.output b/tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.output new file mode 100644 index 0000000000..918c33245c --- /dev/null +++ b/tests/archdetect/x86_64/intel/skylake_avx512/archspec-linux-6132.output @@ -0,0 +1 @@ +x86_64/intel/skylake_avx512 From c3329d5452da8f1276ed7235a16ea28af4005ea3 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:46:28 +0200 Subject: [PATCH 52/90] renew tests --- .github/workflows/tests_archdetect.yml | 8 ++++---- .../neoverse-n1/AWS-awslinux-graviton2.cpuinfo} | 0 .../aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output | 1 + .../Azure-Ubuntu20-Altra.cpuinfo} | 0 .../aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output | 1 + .../neoverse-v1/AWS-awslinux-graviton3.cpuinfo} | 0 .../aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output | 1 + .../{power9le => power9le/unknown-power9le.cpuinfo} | 0 tests/archdetect/ppc64le/power9le/unknown-power9le.output | 1 + 9 files changed, 8 insertions(+), 4 deletions(-) rename tests/archdetect/aarch64/{graviton2 => arm/neoverse-n1/AWS-awslinux-graviton2.cpuinfo} (100%) create mode 100644 tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output rename tests/archdetect/aarch64/arm/{neoverse-n1 => neoverse-n1/Azure-Ubuntu20-Altra.cpuinfo} (100%) create mode 100644 tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output rename tests/archdetect/aarch64/{graviton3 => arm/neoverse-v1/AWS-awslinux-graviton3.cpuinfo} (100%) create mode 100644 tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output rename tests/archdetect/ppc64le/{power9le => power9le/unknown-power9le.cpuinfo} (100%) create mode 100644 tests/archdetect/ppc64le/power9le/unknown-power9le.output diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 1462fab22a..c8870a5cd1 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -11,10 +11,10 @@ jobs: - x86_64/intel/skylake_avx512/archspec-linux-6132 - x86_64/amd/zen2/Azure-CentOS7-7V12 - x86_64/amd/zen3/Azure-CentOS7-7V73X - - ppc64le/power9le - # - aarch64/graviton2 - # - aarch64/graviton3 - - aarch64/arm/neoverse-n1 + - 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 fail-fast: false steps: - uses: actions/checkout@v2 diff --git a/tests/archdetect/aarch64/graviton2 b/tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.cpuinfo similarity index 100% rename from tests/archdetect/aarch64/graviton2 rename to tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.cpuinfo diff --git a/tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output b/tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output new file mode 100644 index 0000000000..b4dc5e9f1b --- /dev/null +++ b/tests/archdetect/aarch64/arm/neoverse-n1/AWS-awslinux-graviton2.output @@ -0,0 +1 @@ +aarch64/arm/neoverse-n1 diff --git a/tests/archdetect/aarch64/arm/neoverse-n1 b/tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.cpuinfo similarity index 100% rename from tests/archdetect/aarch64/arm/neoverse-n1 rename to tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.cpuinfo diff --git a/tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output b/tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output new file mode 100644 index 0000000000..b4dc5e9f1b --- /dev/null +++ b/tests/archdetect/aarch64/arm/neoverse-n1/Azure-Ubuntu20-Altra.output @@ -0,0 +1 @@ +aarch64/arm/neoverse-n1 diff --git a/tests/archdetect/aarch64/graviton3 b/tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.cpuinfo similarity index 100% rename from tests/archdetect/aarch64/graviton3 rename to tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.cpuinfo diff --git a/tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output b/tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output new file mode 100644 index 0000000000..20db96d01f --- /dev/null +++ b/tests/archdetect/aarch64/arm/neoverse-v1/AWS-awslinux-graviton3.output @@ -0,0 +1 @@ +aarch64/arm/neoverse-v1 diff --git a/tests/archdetect/ppc64le/power9le b/tests/archdetect/ppc64le/power9le/unknown-power9le.cpuinfo similarity index 100% rename from tests/archdetect/ppc64le/power9le rename to tests/archdetect/ppc64le/power9le/unknown-power9le.cpuinfo diff --git a/tests/archdetect/ppc64le/power9le/unknown-power9le.output b/tests/archdetect/ppc64le/power9le/unknown-power9le.output new file mode 100644 index 0000000000..8decf544ea --- /dev/null +++ b/tests/archdetect/ppc64le/power9le/unknown-power9le.output @@ -0,0 +1 @@ +ppc64le/power9le From 4e2033e59a5d298e857e687511487cc424264507 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 09:50:06 +0200 Subject: [PATCH 53/90] roll-over to new code for eessi_archdetect.sh --- .github/workflows/tests_archdetect.yml | 3 +- init/arch_detect.sh | 83 ------------- init/archdetect.md | 96 --------------- init/eessi_archdetect.sh | 164 +++++++++++-------------- 4 files changed, 71 insertions(+), 275 deletions(-) delete mode 100755 init/arch_detect.sh delete mode 100644 init/archdetect.md diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index c8870a5cd1..4fffce0dde 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -24,8 +24,7 @@ jobs: export EESSI_MACHINE_TYPE=${{matrix.proc_cpuinfo}} export EESSI_MACHINE_TYPE=${EESSI_MACHINE_TYPE%%/*} export EESSI_PROC_CPUINFO=./tests/archdetect/${{matrix.proc_cpuinfo}}.cpuinfo - #CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) - CPU_ARCH=$(./init/arch_detect.sh cpupath) + CPU_ARCH=$(./init/eessi_archdetect.sh cpupath) if [[ $CPU_ARCH == "$( cat ./tests/archdetect/${{matrix.proc_cpuinfo}}.output )" ]]; then echo "Test for ${{matrix.proc_cpuinfo}} PASSED: $CPU_ARCH" >&2 else diff --git a/init/arch_detect.sh b/init/arch_detect.sh deleted file mode 100755 index ab7d96c986..0000000000 --- a/init/arch_detect.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -# x86_64 CPU architecture specifications -arch_x86=() -arch_x86+=('("x86_64/intel/haswell" "GenuineIntel" "avx2 fma")') # Intel Haswell, Broadwell -arch_x86+=('("x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f")') # Intel Skylake, Cascade Lake -arch_x86+=('("x86_64/amd/zen2" "AuthenticAMD" "avx2 fma")') # AMD Rome -arch_x86+=('("x86_64/amd/zen3" "AuthenticAMD" "avx2 fma vaes")') # AMD Milan, Milan-X - -# ARM CPU architecture specifications -arch_arm=() -arch_arm+=('("aarch64/arm/neoverse-n1" "ARM" "asimd")') # Ampere Altra -arch_arm+=('("aarch64/arm/neoverse-n1" "" "asimd")') # AWS Graviton2 -arch_arm+=('("aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm")') -arch_arm+=('("aarch64/arm/neoverse-v1" "" "asimd svei8mm")') # AWS Graviton3 - -# Power CPU architecture specifications -arch_power=() -arch_power+=('("ppc64le/power9le" "" "POWER9")') # IBM Power9 - -# CPU specification of host system -get_cpuinfo(){ - cpuinfo_pattern="^${1}\s*:" - #grep -i "$cpuinfo_pattern" /proc/cpuinfo | tail -n 1 | sed "s/$cpuinfo_pattern//" - grep -i "$cpuinfo_pattern" ${EESSI_PROC_CPUINFO:-/proc/cpuinfo} | tail -n 1 | sed "s/$cpuinfo_pattern//" -} - -# Find best match -check_flags(){ - for flag in "$@"; do - [[ " ${CPU_FLAGS[*]} " == *" $flag "* ]] || return 1 - done - return 0 -} - -ARGUMENT=${1:-none} - -cpupath () { - #MACHINE_TYPE=$(uname -m) - MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} - echo cpu architecture seems to be $MACHINE_TYPE >&2 - [ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") - [ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") - [ "${MACHINE_TYPE}" == "ppc64le" ] && CPU_ARCH_SPEC=("${arch_power[@]}") - [[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit - - #CPU_VENDOR_TAG="vendor_id" - CPU_VENDOR_TAG="vendor[ _]id" - CPU_VENDOR=$(get_cpuinfo "$CPU_VENDOR_TAG") - CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) - echo "== CPU vendor of host system: $CPU_VENDOR" >&2 - - 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}" == "ppc64le" ] && CPU_FLAG_TAG='cpu' - - CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") - echo "== CPU flags of host system: $CPU_FLAGS" >&2 - - # Default to generic CPU - BEST_MATCH="generic" - - for arch in "${CPU_ARCH_SPEC[@]}"; do - eval "arch_spec=$arch" - if [ "${CPU_VENDOR}x" == "${arch_spec[1]}x" ]; then - check_flags ${arch_spec[2]} && BEST_MATCH=${arch_spec[0]} - echo "== got a match with $BEST_MATCH" >&2 - fi - done - - echo "Best match is $BEST_MATCH" >&2 - echo "$BEST_MATCH" -} - -if [ ${ARGUMENT} == "none" ]; then - echo usage: $0 cpupath - exit -elif [ ${ARGUMENT} == "cpupath" ]; then - echo $(cpupath) - exit -fi diff --git a/init/archdetect.md b/init/archdetect.md deleted file mode 100644 index 384567ad4a..0000000000 --- a/init/archdetect.md +++ /dev/null @@ -1,96 +0,0 @@ -# archdetect - -bash based script to detect e.g. cpu architectures and provide cpupath for setting pointer to optimized software - - -example lscpu outputs: - -# Zen2 -Architecture: x86_64 -CPU op-mode(s): 32-bit, 64-bit -Byte Order: Little Endian -CPU(s): 120 -On-line CPU(s) list: 0-119 -Thread(s) per core: 1 -Core(s) per socket: 60 -Socket(s): 2 -NUMA node(s): 4 -Vendor ID: AuthenticAMD -CPU family: 23 -Model: 49 -Model name: AMD EPYC 7V12 64-Core Processor -Stepping: 0 -CPU MHz: 2445.424 -BogoMIPS: 4890.84 -Hypervisor vendor: Microsoft -Virtualization type: full -L1d cache: 32K -L1i cache: 32K -L2 cache: 512K -L3 cache: 16384K -NUMA node0 CPU(s): 0-29 -NUMA node1 CPU(s): 30-59 -NUMA node2 CPU(s): 60-89 -NUMA node3 CPU(s): 90-119 -Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext retpoline_amd ssbd vmmcall fsgsbase bmi1 avx2 smep bmi2 rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip - -# Zen3 -Architecture: x86_64 -CPU op-mode(s): 32-bit, 64-bit -Byte Order: Little Endian -CPU(s): 120 -On-line CPU(s) list: 0-119 -Thread(s) per core: 1 -Core(s) per socket: 60 -Socket(s): 2 -NUMA node(s): 4 -Vendor ID: AuthenticAMD -CPU family: 25 -Model: 1 -Model name: AMD EPYC 7V73X 64-Core Processor -Stepping: 2 -CPU MHz: 1846.550 -BogoMIPS: 3693.10 -Hypervisor vendor: Microsoft -Virtualization type: full -L1d cache: 32K -L1i cache: 32K -L2 cache: 512K -L3 cache: 98304K -NUMA node0 CPU(s): 0-29 -NUMA node1 CPU(s): 30-59 -NUMA node2 CPU(s): 60-89 -NUMA node3 CPU(s): 90-119 -Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm art rep_good nopl extd_apicid aperfmperf eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm cmp_legacy cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw topoext perfctr_core invpcid_single retpoline_amd vmmcall fsgsbase bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 clzero xsaveerptr arat umip vaes vpclmulqdq - -# Arm Ampere Altra -Architecture: aarch64 -CPU op-mode(s): 32-bit, 64-bit -Byte Order: Little Endian -CPU(s): 64 -On-line CPU(s) list: 0-63 -Thread(s) per core: 1 -Core(s) per socket: 64 -Socket(s): 1 -NUMA node(s): 1 -Vendor ID: ARM -Model: 1 -Model name: Neoverse-N1 -Stepping: r3p1 -BogoMIPS: 50.00 -L1d cache: 4 MiB -L1i cache: 4 MiB -L2 cache: 64 MiB -L3 cache: 32 MiB -NUMA node0 CPU(s): 0-63 -Vulnerability Itlb multihit: Not affected -Vulnerability L1tf: Not affected -Vulnerability Mds: Not affected -Vulnerability Meltdown: Mitigation; PTI -Vulnerability Mmio stale data: Not affected -Vulnerability Spec store bypass: Not affected -Vulnerability Spectre v1: Mitigation; __user pointer sanitization -Vulnerability Spectre v2: Mitigation; CSV2, BHB -Vulnerability Srbds: Not affected -Vulnerability Tsx async abort: Not affected -Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 4a598eafdc..ab7d96c986 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,107 +1,83 @@ -#!/usr/bin/env bash +#!/bin/bash + +# x86_64 CPU architecture specifications +arch_x86=() +arch_x86+=('("x86_64/intel/haswell" "GenuineIntel" "avx2 fma")') # Intel Haswell, Broadwell +arch_x86+=('("x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f")') # Intel Skylake, Cascade Lake +arch_x86+=('("x86_64/amd/zen2" "AuthenticAMD" "avx2 fma")') # AMD Rome +arch_x86+=('("x86_64/amd/zen3" "AuthenticAMD" "avx2 fma vaes")') # AMD Milan, Milan-X + +# ARM CPU architecture specifications +arch_arm=() +arch_arm+=('("aarch64/arm/neoverse-n1" "ARM" "asimd")') # Ampere Altra +arch_arm+=('("aarch64/arm/neoverse-n1" "" "asimd")') # AWS Graviton2 +arch_arm+=('("aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm")') +arch_arm+=('("aarch64/arm/neoverse-v1" "" "asimd svei8mm")') # AWS Graviton3 + +# Power CPU architecture specifications +arch_power=() +arch_power+=('("ppc64le/power9le" "" "POWER9")') # IBM Power9 + +# CPU specification of host system +get_cpuinfo(){ + cpuinfo_pattern="^${1}\s*:" + #grep -i "$cpuinfo_pattern" /proc/cpuinfo | tail -n 1 | sed "s/$cpuinfo_pattern//" + grep -i "$cpuinfo_pattern" ${EESSI_PROC_CPUINFO:-/proc/cpuinfo} | tail -n 1 | sed "s/$cpuinfo_pattern//" +} -# current pathways implemented in EESSI 2021.12 pilot version -# x86_64/generic -# x86_64/intel/haswell -# x86_64/intel/skylake_avx512 -# x86_64/amd/zen2 -# x86_64/amd/zen3 -# aarch64/generic -# aarch64/graviton2 -# aarch64/graviton3 -# ppc64le/generic -# ppc64le/power9le +# Find best match +check_flags(){ + for flag in "$@"; do + [[ " ${CPU_FLAGS[*]} " == *" $flag "* ]] || return 1 + done + return 0 +} ARGUMENT=${1:-none} cpupath () { - # let the kernel tell base machine type + #MACHINE_TYPE=$(uname -m) MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} - PROC_CPUINFO=${EESSI_PROC_CPUINFO:-/proc/cpuinfo} - - # clean up any existing pointers to cpu features - unset $(env | grep EESSI_HAS | cut -f1 -d=) - unset EESSI_CPU_VENDOR - - # fallback path - CPU_PATH="${MACHINE_TYPE}/generic" - - if [ ${MACHINE_TYPE} == "aarch64" ]; then - CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) - [[ $CPUINFO_VENDOR_FLAG =~ "ARM" ]] && EESSI_CPU_VENDOR=arm - - if [ ${EESSI_CPU_VENDOR} == "arm" ]; then - CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') - else - CPU_FLAGS=$(grep -m 1 -i ^features ${PROC_CPUINFO} | sed 's/$/ /g') + echo cpu architecture seems to be $MACHINE_TYPE >&2 + [ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") + [ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") + [ "${MACHINE_TYPE}" == "ppc64le" ] && CPU_ARCH_SPEC=("${arch_power[@]}") + [[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit + + #CPU_VENDOR_TAG="vendor_id" + CPU_VENDOR_TAG="vendor[ _]id" + CPU_VENDOR=$(get_cpuinfo "$CPU_VENDOR_TAG") + CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) + echo "== CPU vendor of host system: $CPU_VENDOR" >&2 + + 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}" == "ppc64le" ] && CPU_FLAG_TAG='cpu' + + CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") + echo "== CPU flags of host system: $CPU_FLAGS" >&2 + + # Default to generic CPU + BEST_MATCH="generic" + + for arch in "${CPU_ARCH_SPEC[@]}"; do + eval "arch_spec=$arch" + if [ "${CPU_VENDOR}x" == "${arch_spec[1]}x" ]; then + check_flags ${arch_spec[2]} && BEST_MATCH=${arch_spec[0]} + echo "== got a match with $BEST_MATCH" >&2 fi + done - [[ $CPU_FLAGS =~ " asimd " ]] && EESSI_HAS_ASIMD=true - [[ $CPU_FLAGS =~ " svei8mm " ]] && EESSI_HAS_SVEI8MM=true - - # we will not return graviton2 as a result here, since then we get get graviton2 as a result while we're actually on a thunderx2, for example. - # We should break here with archspec, and symlink aarch64/arm/neoverse-n1 to aarch64/graviton2 in EESSI pilot 2021.12, - # and then the reverse in the next EESSI pilot (so it still works with archspec). - [[ ${EESSI_HAS_ASIMD} ]] && EESSI_CPU_TYPE=neoverse-n1 # Ampere Altra, AWS graviton2 - [[ ${EESSI_HAS_SVEI8MM} ]] && EESSI_CPU_TYPE=neoverse-v1 # AWS graviton3 - [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" - - echo ${CPU_PATH} - exit - fi - - if [ ${MACHINE_TYPE} == "ppc64le" ]; then - CPU_FLAGS=$(grep -m 1 -i ^cpu ${PROC_CPUINFO}) - [[ $CPU_FLAGS =~ " POWER9 " ]] && EESSI_HAS_POWER9=true - - [[ ${EESSI_HAS_POWER9} ]] && EESSI_CPU_TYPE=power9le # IBM Power9 - - [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_TYPE}" - echo ${CPU_PATH} - exit - fi - - if [ ${MACHINE_TYPE} == "x86_64" ]; then - # check for vendor info, if available, for x86_64 - CPUINFO_VENDOR_FLAG=$(grep -m 1 -i ^vendor ${PROC_CPUINFO}) - [[ $CPUINFO_VENDOR_FLAG =~ "GenuineIntel" ]] && EESSI_CPU_VENDOR=intel - [[ $CPUINFO_VENDOR_FLAG =~ "AuthenticAMD" ]] && EESSI_CPU_VENDOR=amd - - CPU_FLAGS=$(grep -m 1 -i ^flags ${PROC_CPUINFO} | sed 's/$/ /g') - [[ $CPU_FLAGS =~ " avx2 " ]] && EESSI_HAS_AVX2=true - [[ $CPU_FLAGS =~ " fma " ]] && EESSI_HAS_FMA=true - [[ $CPU_FLAGS =~ " avx512f " ]] && EESSI_HAS_AVX512F=true - [[ $CPU_FLAGS =~ " avx512vl " ]] && EESSI_HAS_AVX512VL=true - [[ $CPU_FLAGS =~ " avx512ifma " ]] && EESSI_HAS_AVX512IFMA=true - [[ $CPU_FLAGS =~ " avx512_vbmi2 " ]] && EESSI_HAS_AVX512_VBMI2=true - [[ $CPU_FLAGS =~ " avx512_vnni " ]] && EESSI_HAS_AVX512_VNNI=true - [[ $CPU_FLAGS =~ " avx512fp16 " ]] && EESSI_HAS_AVX512FP16=true - [[ $CPU_FLAGS =~ " vaes " ]] && EESSI_HAS_VAES=true - - if [ ${EESSI_CPU_VENDOR} == "intel" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=haswell # Intel Haswell, Broadwell - [[ ${EESSI_HAS_AVX512F} ]] && EESSI_CPU_TYPE=skylake_avx512 # Intel Skylake, Cascade Lake - # [[ ${HAS_AVX512IFMA} ]] && [[ ${HAS_AVX512_VBMI2} ]] && CPU_TYPE=icelake_avx512 - # [[ ${HAS_AVX512_VNNI} ]] && [[ ${HAS_AVX512VL} ]] && [[ ${HAS_AVX512FP16} ]] && CPU_TYPE=sapphire_rapids_avx512 - elif [ ${EESSI_CPU_VENDOR} == "amd" ]; then - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && EESSI_CPU_TYPE=zen2 # AMD Rome - [[ ${EESSI_HAS_AVX2} ]] && [[ ${EESSI_HAS_FMA} ]] && [[ ${EESSI_HAS_VAES} ]] && EESSI_CPU_TYPE=zen3 # AMD Milan, Milan-X - fi - - [[ ${EESSI_CPU_VENDOR} ]] && [[ $EESSI_CPU_TYPE ]] && CPU_PATH="${MACHINE_TYPE}/${EESSI_CPU_VENDOR}/${EESSI_CPU_TYPE}" - - echo ${CPU_PATH} - exit - fi - - echo "should not see this...something weird going on..." - echo "please mail output of lscpu to me..." + echo "Best match is $BEST_MATCH" >&2 + echo "$BEST_MATCH" } if [ ${ARGUMENT} == "none" ]; then - echo usage: $0 cpupath - exit + echo usage: $0 cpupath + exit elif [ ${ARGUMENT} == "cpupath" ]; then - echo $(cpupath) - exit + echo $(cpupath) + exit fi From 3eddc78e8f2527a0ce285f5244c8bbf0fdd6b960 Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Tue, 20 Sep 2022 11:11:51 +0200 Subject: [PATCH 54/90] change hardcoded bash --- init/eessi_archdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index ab7d96c986..298c88a955 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # x86_64 CPU architecture specifications arch_x86=() From 818ecade77631f09828fd14e224c2bbe032d5e3a Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 21 Sep 2022 12:16:33 +0200 Subject: [PATCH 55/90] move CPU arch specifications to separate spec files --- init/arch_specs/eessi_arch_arm.spec | 6 +++ init/arch_specs/eessi_arch_ppc.spec | 3 ++ init/arch_specs/eessi_arch_x86.spec | 6 +++ init/eessi_archdetect.sh | 60 ++++++++++++++++------------- 4 files changed, 49 insertions(+), 26 deletions(-) create mode 100755 init/arch_specs/eessi_arch_arm.spec create mode 100755 init/arch_specs/eessi_arch_ppc.spec create mode 100755 init/arch_specs/eessi_arch_x86.spec diff --git a/init/arch_specs/eessi_arch_arm.spec b/init/arch_specs/eessi_arch_arm.spec new file mode 100755 index 0000000000..92f32a76d8 --- /dev/null +++ b/init/arch_specs/eessi_arch_arm.spec @@ -0,0 +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 diff --git a/init/arch_specs/eessi_arch_ppc.spec b/init/arch_specs/eessi_arch_ppc.spec new file mode 100755 index 0000000000..a6cb922baf --- /dev/null +++ b/init/arch_specs/eessi_arch_ppc.spec @@ -0,0 +1,3 @@ +# x86_64 CPU architecture specifications +# Software path in EESSI | Vendor ID | List of defining CPU features +"ppc64le/power9le" "" "POWER9" # IBM Power9 diff --git a/init/arch_specs/eessi_arch_x86.spec b/init/arch_specs/eessi_arch_x86.spec new file mode 100755 index 0000000000..e165e6c96d --- /dev/null +++ b/init/arch_specs/eessi_arch_x86.spec @@ -0,0 +1,6 @@ +# x86_64 CPU architecture specifications +# Software path in EESSI | Vendor ID | List of defining CPU features +"x86_64/intel/haswell" "GenuineIntel" "avx2 fma" # Intel Haswell, Broadwell +"x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f" # Intel Skylake, Cascade Lake +"x86_64/amd/zen2" "AuthenticAMD" "avx2 fma" # AMD Rome +"x86_64/amd/zen3" "AuthenticAMD" "avx2 fma vaes" # AMD Milan, Milan-X diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index 298c88a955..d9e2737b6f 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,22 +1,22 @@ #!/usr/bin/env bash -# x86_64 CPU architecture specifications -arch_x86=() -arch_x86+=('("x86_64/intel/haswell" "GenuineIntel" "avx2 fma")') # Intel Haswell, Broadwell -arch_x86+=('("x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f")') # Intel Skylake, Cascade Lake -arch_x86+=('("x86_64/amd/zen2" "AuthenticAMD" "avx2 fma")') # AMD Rome -arch_x86+=('("x86_64/amd/zen3" "AuthenticAMD" "avx2 fma vaes")') # AMD Milan, Milan-X - -# ARM CPU architecture specifications -arch_arm=() -arch_arm+=('("aarch64/arm/neoverse-n1" "ARM" "asimd")') # Ampere Altra -arch_arm+=('("aarch64/arm/neoverse-n1" "" "asimd")') # AWS Graviton2 -arch_arm+=('("aarch64/arm/neoverse-v1" "ARM" "asimd svei8mm")') -arch_arm+=('("aarch64/arm/neoverse-v1" "" "asimd svei8mm")') # AWS Graviton3 - -# Power CPU architecture specifications -arch_power=() -arch_power+=('("ppc64le/power9le" "" "POWER9")') # IBM Power9 +# Supported CPU specifications +update_arch_specs(){ + # Add contents of given spec file into an array + # 1: array with CPU arch specs + # 2: spec file with the additional specs + + [ -z "$1" ] && echo "[ERROR] update_arch_specs: missing array in argument list" >&2 && exit 1 + local -n arch_specs=$1 + + [ ! -f "$2" ] && echo "[ERROR] update_arch_specs: spec file not found: $spec_file" >&2 && exit 1 + spec_file="$2" + while read spec_line; do + # format spec line as an array and append it to array with all CPU arch specs + arch_specs+=("(${spec_line})") + # remove comments from spec file + done < <(sed -E 's/(^|[\s\t])#.*$//g;/^\s*$/d' "$spec_file") +} # CPU specification of host system get_cpuinfo(){ @@ -35,14 +35,22 @@ check_flags(){ ARGUMENT=${1:-none} -cpupath () { - #MACHINE_TYPE=$(uname -m) - MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} - echo cpu architecture seems to be $MACHINE_TYPE >&2 - [ "${MACHINE_TYPE}" == "x86_64" ] && CPU_ARCH_SPEC=("${arch_x86[@]}") - [ "${MACHINE_TYPE}" == "aarch64" ] && CPU_ARCH_SPEC=("${arch_arm[@]}") - [ "${MACHINE_TYPE}" == "ppc64le" ] && CPU_ARCH_SPEC=("${arch_power[@]}") - [[ -z $CPU_ARCH_SPEC ]] && echo "ERROR: Unsupported CPU architecture $MACHINE_TYPE" && exit +cpupath(){ + # Return the best matching CPU architecture from a list of supported specifications for the host CPU + local CPU_ARCH_SPEC=() + + # Identify the host CPU architecture + local MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} + echo "[INFO] cpupath: Host CPU architecture identified as $MACHINE_TYPE" + + # Populate list of supported specs for this architecture + case $MACHINE_TYPE in + "x86_64") spec_file="eessi_arch_x86.spec";; + "aarch64") spec_file="eessi_arch_arm.spec";; + "ppc64le") spec_file="eessi_arch_ppc.spec";; + *) echo "[ERROR] cpupath: Unsupported CPU architecture $MACHINE_TYPE" >&2 && exit 1 + esac + update_arch_specs CPU_ARCH_SPEC "arch_specs/${spec_file}" #CPU_VENDOR_TAG="vendor_id" CPU_VENDOR_TAG="vendor[ _]id" @@ -78,6 +86,6 @@ if [ ${ARGUMENT} == "none" ]; then echo usage: $0 cpupath exit elif [ ${ARGUMENT} == "cpupath" ]; then - echo $(cpupath) + cpupath exit fi From 6726288a3b489c0673b39f52536be4942b089a26 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 21 Sep 2022 14:45:43 +0200 Subject: [PATCH 56/90] fix execution from any location in the file system --- init/arch_specs/eessi_arch_ppc.spec | 2 +- init/eessi_archdetect.sh | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/init/arch_specs/eessi_arch_ppc.spec b/init/arch_specs/eessi_arch_ppc.spec index a6cb922baf..0932925046 100755 --- a/init/arch_specs/eessi_arch_ppc.spec +++ b/init/arch_specs/eessi_arch_ppc.spec @@ -1,3 +1,3 @@ -# x86_64 CPU architecture specifications +# POWER CPU architecture specifications # Software path in EESSI | Vendor ID | List of defining CPU features "ppc64le/power9le" "" "POWER9" # IBM Power9 diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index d9e2737b6f..bb6ceff27f 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -9,8 +9,8 @@ update_arch_specs(){ [ -z "$1" ] && echo "[ERROR] update_arch_specs: missing array in argument list" >&2 && exit 1 local -n arch_specs=$1 - [ ! -f "$2" ] && echo "[ERROR] update_arch_specs: spec file not found: $spec_file" >&2 && exit 1 - spec_file="$2" + [ ! -f "$2" ] && echo "[ERROR] update_arch_specs: spec file not found: $2" >&2 && exit 1 + local spec_file="$2" while read spec_line; do # format spec line as an array and append it to array with all CPU arch specs arch_specs+=("(${spec_line})") @@ -45,12 +45,14 @@ cpupath(){ # Populate list of supported specs for this architecture case $MACHINE_TYPE in - "x86_64") spec_file="eessi_arch_x86.spec";; - "aarch64") spec_file="eessi_arch_arm.spec";; - "ppc64le") spec_file="eessi_arch_ppc.spec";; + "x86_64") local spec_file="eessi_arch_x86.spec";; + "aarch64") local spec_file="eessi_arch_arm.spec";; + "ppc64le") local spec_file="eessi_arch_ppc.spec";; *) echo "[ERROR] cpupath: Unsupported CPU architecture $MACHINE_TYPE" >&2 && exit 1 esac - update_arch_specs CPU_ARCH_SPEC "arch_specs/${spec_file}" + # 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}" #CPU_VENDOR_TAG="vendor_id" CPU_VENDOR_TAG="vendor[ _]id" From d4d9681d1d0b04419f3fec99917d223172342e29 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Wed, 21 Sep 2022 15:15:19 +0200 Subject: [PATCH 57/90] fix log messages ibeing printed in standard output --- init/eessi_archdetect.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index bb6ceff27f..d1b6417884 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -41,7 +41,7 @@ cpupath(){ # Identify the host CPU architecture local MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} - echo "[INFO] cpupath: Host CPU architecture identified as $MACHINE_TYPE" + echo "[INFO] cpupath: Host CPU architecture identified as $MACHINE_TYPE" >&2 # Populate list of supported specs for this architecture case $MACHINE_TYPE in From 50b46ca146bc2a421a4c6c1023913c7a304c3a84 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Mon, 26 Sep 2022 14:37:25 +0200 Subject: [PATCH 58/90] standarize log formatting by adding logging function --- init/eessi_archdetect.sh | 174 +++++++++++++++++++++++++-------------- 1 file changed, 111 insertions(+), 63 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index d1b6417884..dd29baecde 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,9 +1,32 @@ #!/usr/bin/env bash +# Logging +LOG_LEVEL="INFO" + +timestamp () { + date "+%Y-%m-%d %H:%M:%S" +} + +log () { + # Simple logger function + declare -A levels=([DEBUG]=0 [INFO]=1 [WARN]=2 [ERROR]=3) + msg_type="${1:-INFO}" + msg_body="${2:-'null'}" + + [ ${levels[$msg_type]} ] || log "ERROR" "Unknown log level $msg_type" + + # ignore messages below log level + [ ${levels[$msg_type]} -lt ${levels[$LOG_LEVEL]} ] && return 0 + # print log message to standard error + echo "$(timestamp) [$msg_type] $msg_body" >&2 + # exit after any error message + [ $msg_type == "ERROR" ] && exit 1 +} + # Supported CPU specifications update_arch_specs(){ # Add contents of given spec file into an array - # 1: array with CPU arch specs + # 1: name of array with CPU arch specs # 2: spec file with the additional specs [ -z "$1" ] && echo "[ERROR] update_arch_specs: missing array in argument list" >&2 && exit 1 @@ -20,74 +43,99 @@ update_arch_specs(){ # CPU specification of host system get_cpuinfo(){ - cpuinfo_pattern="^${1}\s*:" - #grep -i "$cpuinfo_pattern" /proc/cpuinfo | tail -n 1 | sed "s/$cpuinfo_pattern//" - grep -i "$cpuinfo_pattern" ${EESSI_PROC_CPUINFO:-/proc/cpuinfo} | tail -n 1 | sed "s/$cpuinfo_pattern//" + # Return the value from cpuinfo for the matching key + # 1: string with key pattern + + [ -z "$1" ] && log "ERROR" "get_cpuinfo: missing key pattern in argument list" + cpuinfo_pattern="^${1}\s*:\s*" + + # case insensitive match of key pattern and delete key pattern from result + grep -i "$cpuinfo_pattern" ${EESSI_PROC_CPUINFO:-/proc/cpuinfo} | tail -n 1 | sed "s/$cpuinfo_pattern//i" } -# Find best match -check_flags(){ - for flag in "$@"; do - [[ " ${CPU_FLAGS[*]} " == *" $flag "* ]] || return 1 +check_allinfirst(){ + # Return true if all given arguments after the first are found in the first one + # 1: reference string of space separated values + # 2,3..: each additional argument is a single value to be found in the reference string + + [ -z "$1" ] && log "ERROR" "check_allinfirst: missing argument with reference string" + reference="$1" + shift + + for candidate in "$@"; do + [[ " $reference " == *" $candidate "* ]] || return 1 done return 0 } -ARGUMENT=${1:-none} - cpupath(){ - # Return the best matching CPU architecture from a list of supported specifications for the host CPU - local CPU_ARCH_SPEC=() - - # Identify the host CPU architecture - local MACHINE_TYPE=${EESSI_MACHINE_TYPE:-$(uname -m)} - echo "[INFO] cpupath: Host CPU architecture identified as $MACHINE_TYPE" >&2 - - # 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";; - "ppc64le") local spec_file="eessi_arch_ppc.spec";; - *) echo "[ERROR] cpupath: Unsupported CPU architecture $MACHINE_TYPE" >&2 && exit 1 - 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}" - - #CPU_VENDOR_TAG="vendor_id" - CPU_VENDOR_TAG="vendor[ _]id" - CPU_VENDOR=$(get_cpuinfo "$CPU_VENDOR_TAG") - CPU_VENDOR=$(echo ${CPU_VENDOR#*:} | xargs echo -n) - echo "== CPU vendor of host system: $CPU_VENDOR" >&2 - - 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}" == "ppc64le" ] && CPU_FLAG_TAG='cpu' - - CPU_FLAGS=$(get_cpuinfo "$CPU_FLAG_TAG") - echo "== CPU flags of host system: $CPU_FLAGS" >&2 - - # Default to generic CPU - BEST_MATCH="generic" - - for arch in "${CPU_ARCH_SPEC[@]}"; do - eval "arch_spec=$arch" - if [ "${CPU_VENDOR}x" == "${arch_spec[1]}x" ]; then - check_flags ${arch_spec[2]} && BEST_MATCH=${arch_spec[0]} - echo "== got a match with $BEST_MATCH" >&2 - fi - done - - echo "Best match is $BEST_MATCH" >&2 - echo "$BEST_MATCH" + # Identify the best matching CPU architecture from a list of supported specifications for the host CPU + # Return the path to the installation files in EESSI of the best matching architecture + local cpu_arch_spec=() + + # Identify the host CPU architecture + local machine_type=${EESSI_MACHINE_TYPE:-$(uname -m)} + log "DEBUG" "cpupath: Host CPU architecture identified as '$machine_type'" + + # 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";; + "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}" == "ppc64le" ] && cpu_flag_tag='cpu' + + local cpu_flags=$(get_cpuinfo "$cpu_flag_tag") + log "DEBUG" "cpupath: CPU flags of host system: '$cpu_flags'" + + # Default to generic CPU + local best_arch_match="generic" + + # 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 + for arch in "${cpu_arch_spec[@]}"; do + eval "arch_spec=$arch" + 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" + fi + done + + log "INFO" "cpupath: best match for host CPU: $best_arch_match" + echo "$best_arch_match" } -if [ ${ARGUMENT} == "none" ]; then - echo usage: $0 cpupath - exit -elif [ ${ARGUMENT} == "cpupath" ]; then - cpupath - exit -fi +# Parse command line arguments +USAGE="Usage: eessi_archdetect.sh [-h][-d] " + +while getopts 'hd' OPTION; do + case "$OPTION" in + h) echo "$USAGE"; exit 0;; + d) LOG_LEVEL="DEBUG";; + ?) echo "$USAGE"; exit 1;; + esac +done +shift "$(($OPTIND -1))" + +ARGUMENT=${1:-none} + +case "$ARGUMENT" in + "cpupath") cpupath; exit;; + *) echo "$USAGE"; log "ERROR" "Missing argument";; +esac From c74bb8ee7eec93b06d011c7f5463a16ffbb74e27 Mon Sep 17 00:00:00 2001 From: Alex Domingo Date: Mon, 26 Sep 2022 14:52:44 +0200 Subject: [PATCH 59/90] add version tag and option to print it --- init/eessi_archdetect.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index dd29baecde..af63e36f3a 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +VERSION="1.0.0" # Logging LOG_LEVEL="INFO" @@ -124,10 +125,11 @@ cpupath(){ # Parse command line arguments USAGE="Usage: eessi_archdetect.sh [-h][-d] " -while getopts 'hd' OPTION; do +while getopts 'hdv' OPTION; do case "$OPTION" in h) echo "$USAGE"; exit 0;; d) LOG_LEVEL="DEBUG";; + v) echo "eessi_archdetect.sh v$VERSION"; exit 0;; ?) echo "$USAGE"; exit 1;; esac done From 806e1fbe0c0e982bf2b6c9e4b619711e155944bb Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Sun, 2 Oct 2022 06:46:23 +0200 Subject: [PATCH 60/90] be more specific on skylake_avx512 to avoid KNL confusion --- init/arch_specs/eessi_arch_x86.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/arch_specs/eessi_arch_x86.spec b/init/arch_specs/eessi_arch_x86.spec index e165e6c96d..8d01cb0c03 100755 --- a/init/arch_specs/eessi_arch_x86.spec +++ b/init/arch_specs/eessi_arch_x86.spec @@ -1,6 +1,6 @@ # x86_64 CPU architecture specifications # Software path in EESSI | Vendor ID | List of defining CPU features "x86_64/intel/haswell" "GenuineIntel" "avx2 fma" # Intel Haswell, Broadwell -"x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f" # Intel Skylake, Cascade Lake +"x86_64/intel/skylake_avx512" "GenuineIntel" "avx2 fma avx512f avx512bw avx512cd avx512dq avx512vl" # Intel Skylake, Cascade Lake "x86_64/amd/zen2" "AuthenticAMD" "avx2 fma" # AMD Rome "x86_64/amd/zen3" "AuthenticAMD" "avx2 fma vaes" # AMD Milan, Milan-X From f265eea3b6270cf0a281e041dc6bb65d411c59f1 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 7 Oct 2022 21:06:11 +0200 Subject: [PATCH 61/90] remove check for support for extended attributes from script for using build container --- build_container.sh | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/build_container.sh b/build_container.sh index 1fffde9c75..d7e7256b4e 100755 --- a/build_container.sh +++ b/build_container.sh @@ -18,22 +18,6 @@ fi # make sure specified temporary directory exists mkdir -p $EESSI_TMPDIR -# make sure that specified location has support for extended attributes, -# since that's required by CernVM-FS -command -v attr &> /dev/null -if [ $? -eq 0 ]; then - testfile=$(mktemp -p $EESSI_TMPDIR) - attr -s test -V test $testfile > /dev/null - if [ $? -ne 0 ]; then - echo "ERROR: $EESSI_TMPDIR does not support extended attributes!" >&2 - #exit 2 - else - rm $testfile - fi -else - echo "WARNING: 'attr' command not available, so can't check support for extended attributes..." >&2 -fi - echo "Using $EESSI_TMPDIR as parent for temporary directories..." # create temporary directories From 5fa6b53035b374e1edf2e4608c8ebb28b054ec01 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 15 Oct 2022 18:11:04 +0200 Subject: [PATCH 62/90] enhance install script to check exit code when installing EasyBuild --- EESSI-pilot-install-software.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 7312818a2c..5e3f4c8ee2 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -151,11 +151,17 @@ else export PATH=${EB_TMPDIR}/bin:$PATH export PYTHONPATH=$(ls -d ${EB_TMPDIR}/lib/python*/site-packages):$PYTHONPATH eb_install_out=${TMPDIR}/eb_install.out + ok_msg="Latest EasyBuild release installed, let's go!" + fail_msg="Installing latest EasyBuild release failed, that's not good... (output: ${eb_install_out})" eb --install-latest-eb-release &> ${eb_install_out} + check_exit_code $? "${ok_msg}" "${fail_msg}" eb --search EasyBuild-${REQ_EB_VERSION}.eb | grep EasyBuild-${REQ_EB_VERSION}.eb > /dev/null if [[ $? -eq 0 ]]; then + ok_msg="EasyBuild v${REQ_EB_VERSION} installed, alright!" + fail_msg="Installing EasyBuild v${REQ_EB_VERSION}, yikes! (output: ${eb_install_out})" eb EasyBuild-${REQ_EB_VERSION}.eb >> ${eb_install_out} 2>&1 + check_exit_code $? "${ok_msg}" "${fail_msg}" fi module avail easybuild/${REQ_EB_VERSION} &> ${ml_av_easybuild_out} From 6baa8e4edcd31b994d8d238229ba79ea84649f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Pe=C4=8Dar?= Date: Mon, 7 Nov 2022 12:01:48 +0100 Subject: [PATCH 63/90] add Nextflow --- EESSI-pilot-install-software.sh | 6 ++++++ eessi-2021.12.yml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 5e3f4c8ee2..8365a20981 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -356,6 +356,12 @@ fail_msg="Installation of WRF failed, that's unexpected..." OMPI_MCA_pml=ucx UCX_TLS=tcp $EB WRF-3.9.1.1-foss-2020a-dmpar.eb -r --include-easyblocks-from-pr 2648 check_exit_code $? "${ok_msg}" "${fail_msg}" +echo ">> Installing Nextflow 22.10.1..." +ok_msg="Nextflow installed, the work must flow..." +fail_msg="Installation of Nextflow failed, that's unexpected..." +$EB -r --from-pr 16531 +check_exit_code $? "${ok_msg}" "${fail_msg}" + ### add packages here echo ">> Creating/updating Lmod cache..." diff --git a/eessi-2021.12.yml b/eessi-2021.12.yml index f3ed9dd9c4..58101777ca 100644 --- a/eessi-2021.12.yml +++ b/eessi-2021.12.yml @@ -53,3 +53,7 @@ software: versions: '3.9.1.1': versionsuffix: -dmpar + Nextflow: + toolchains: + SYSTEM: + versions: '22.10.1' From 071067eb825ae161126bc66859e06b3165df9490 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jurij=20Pe=C4=8Dar?= Date: Mon, 7 Nov 2022 12:14:15 +0100 Subject: [PATCH 64/90] actually add .eb --- EESSI-pilot-install-software.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 8365a20981..dc50f7fae2 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -359,7 +359,7 @@ check_exit_code $? "${ok_msg}" "${fail_msg}" echo ">> Installing Nextflow 22.10.1..." ok_msg="Nextflow installed, the work must flow..." fail_msg="Installation of Nextflow failed, that's unexpected..." -$EB -r --from-pr 16531 +$EB -r --from-pr 16531 Nextflow-22.10.1.eb check_exit_code $? "${ok_msg}" "${fail_msg}" ### add packages here From b80be7a8f723323fb7a3662b0a4ef856f2bb573d Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 7 Nov 2022 19:52:34 +0100 Subject: [PATCH 65/90] use merged PRs to fix installation of GCCcore/10.3.0 with recent kernel headers + workaround for compiler bug affecting OpenBLAS on POWER --- EESSI-pilot-install-software.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 193f5600a1..7fdcbde6b6 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -344,7 +344,9 @@ check_exit_code $? "Swapped to EasyBuild/4.5.1" "Couldn't swap to EasyBuild/4.5. echo ">> Installing SciPy-bundle with foss/2021a..." ok_msg="SciPy-bundle with foss/2021a installed, welcome to the modern age" fail_msg="Installation of SciPy-bundle with foss/2021a failed, back to the stone age..." -$EB SciPy-bundle-2021.05-foss-2021a.eb -M +# use GCCcore easyconfig from https://github.com/easybuilders/easybuild-easyconfigs/pull/14454 +# which includes patch to fix installation with recent Linux kernel headers +$EB --from-pr 14454 GCCcore-10.3.0.eb --robot # use enhanced Perl easyblock from https://github.com/easybuilders/easybuild-easyblocks/pull/2640 # to avoid trouble when using long installation prefix (for example with EESSI pilot 2021.12 on skylake_avx512...) $EB Perl-5.32.1-GCCcore-10.3.0.eb --robot --include-easyblocks-from-pr 2640 @@ -354,6 +356,10 @@ $EB CMake-3.20.1-GCCcore-10.3.0.eb --robot --include-easyblocks-from-pr 2248 # use Rust easyconfig from https://github.com/easybuilders/easybuild-easyconfigs/pull/14584 # that includes patch to fix bootstrap problem when using alternate sysroot $EB --from-pr 14584 Rust-1.52.1-GCCcore-10.3.0.eb --robot +# use OpenBLAS easyconfig from https://github.com/easybuilders/easybuild-easyconfigs/pull/15885 +# which includes a patch to fix installation on POWER +$EB --from-pr 15885 OpenBLAS-0.3.15-GCC-10.3.0.eb --robot + $EB SciPy-bundle-2021.05-foss-2021a.eb -r --buildpath /dev/shm/$USER/easybuild_build check_exit_code $? "${ok_msg}" "${fail_msg}" From 65812efb82578b5cc584e0bd3ab9b16f4e00681f Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Mon, 7 Nov 2022 20:06:52 +0100 Subject: [PATCH 66/90] use updated EasyBuildMeta easyblock to install EasyBuild 4.5.1 --- EESSI-pilot-install-software.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index f23d60a328..983ff9d1bd 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -359,7 +359,7 @@ check_exit_code $? "${ok_msg}" "${fail_msg}" echo ">> Installing EasyBuild 4.5.1..." ok_msg="EasyBuild v4.5.1 installed" fail_msg="EasyBuild v4.5.1 failed to install" -$EB --from-pr 14545 +$EB --from-pr 14545 --include-easyblocks-from-pr 2805 check_exit_code $? "${ok_msg}" "${fail_msg}" LMOD_IGNORE_CACHE=1 module swap EasyBuild/4.5.1 From 2d77d74a2950496fbb63fca1a7112bd35779d1c8 Mon Sep 17 00:00:00 2001 From: Hugo Meiland <32266151+hmeiland@users.noreply.github.com> Date: Tue, 8 Nov 2022 06:41:05 +0100 Subject: [PATCH 67/90] Update init/eessi_environment_variables Co-authored-by: Kenneth Hoste --- init/eessi_environment_variables | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/eessi_environment_variables b/init/eessi_environment_variables index d32a1c8279..10ac1926f4 100644 --- a/init/eessi_environment_variables +++ b/init/eessi_environment_variables @@ -25,7 +25,7 @@ if [ -d $EESSI_PREFIX ]; then if [ -d $EESSI_EPREFIX ]; then # determine subdirectory in software layer - if [ -z $EESSI_USE_ARCHDETECT ]; then + if [ "$EESSI_USE_ARCHDETECT" == "1" ]; then # if archdetect is enabled, use internal code export EESSI_SOFTWARE_SUBDIR=$(${EESSI_INIT_DIR_PATH}/eessi_archdetect.sh cpupath) echo "archdetect says ${EESSI_SOFTWARE_SUBDIR}" >> $output From 83b283c66720942371f88ce987b932f94d26c8c5 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Tue, 8 Nov 2022 19:34:17 +0100 Subject: [PATCH 68/90] fix alphabetical sorting in eessi-2021.12.yml --- eessi-2021.12.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eessi-2021.12.yml b/eessi-2021.12.yml index 102349551b..977c0f9804 100644 --- a/eessi-2021.12.yml +++ b/eessi-2021.12.yml @@ -17,6 +17,10 @@ software: versions: '0.21.3': versionsuffix: -TensorFlow-2.3.1-Python-3.8.2 + Nextflow: + toolchains: + SYSTEM: + versions: '22.10.1' OpenFOAM: toolchains: foss-2020a: @@ -57,7 +61,3 @@ software: versions: '3.9.1.1': versionsuffix: -dmpar - Nextflow: - toolchains: - SYSTEM: - versions: '22.10.1' From 79a580475c2d0f5d9677d06ee7e61c2f9a2cb1ef Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Wed, 9 Nov 2022 12:15:29 +0100 Subject: [PATCH 69/90] take out nameref of update_arch_specs function to add/keep support for bash4 (centos7) --- init/eessi_archdetect.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index af63e36f3a..c901bdfa48 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -27,17 +27,13 @@ log () { # Supported CPU specifications update_arch_specs(){ # Add contents of given spec file into an array - # 1: name of array with CPU arch specs - # 2: spec file with the additional specs + # 1: spec file with the additional specs - [ -z "$1" ] && echo "[ERROR] update_arch_specs: missing array in argument list" >&2 && exit 1 - local -n arch_specs=$1 - - [ ! -f "$2" ] && echo "[ERROR] update_arch_specs: spec file not found: $2" >&2 && exit 1 - local spec_file="$2" + [ ! -f "$1" ] && echo "[ERROR] update_arch_specs: spec file not found: $1" >&2 && exit 1 + local spec_file="$1" while read spec_line; do # format spec line as an array and append it to array with all CPU arch specs - arch_specs+=("(${spec_line})") + cpu_arch_spec+=("(${spec_line})") # remove comments from spec file done < <(sed -E 's/(^|[\s\t])#.*$//g;/^\s*$/d' "$spec_file") } @@ -87,7 +83,7 @@ cpupath(){ 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}" + update_arch_specs "$base_dir/arch_specs/${spec_file}" # Identify the host CPU vendor local cpu_vendor_tag="vendor[ _]id" From 15b40770ee99aa75272dff9a335fb7e41f3598ee Mon Sep 17 00:00:00 2001 From: hugo meiland Date: Wed, 9 Nov 2022 12:44:43 +0100 Subject: [PATCH 70/90] adding test for override variable --- init/eessi_archdetect.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/eessi_archdetect.sh b/init/eessi_archdetect.sh index c901bdfa48..d2b6dacf04 100755 --- a/init/eessi_archdetect.sh +++ b/init/eessi_archdetect.sh @@ -66,6 +66,10 @@ check_allinfirst(){ } cpupath(){ + # If EESSI_SOFTWARE_SUBDIR_OVERRIDE is set, use it + log "DEBUG" "cpupath: Override variable set as '$EESI_SOFTWARE_SUBDIR_OVERRIDE' " + [ $EESI_SOFTWARE_SUBDIR_OVERRIDE ] && echo ${EESI_SOFTWARE_SUBDIR_OVERRIDE} && exit + # Identify the best matching CPU architecture from a list of supported specifications for the host CPU # Return the path to the installation files in EESSI of the best matching architecture local cpu_arch_spec=() From deb34a761a545609693966dc37a323ab75553fa6 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Wed, 9 Nov 2022 23:24:40 +0100 Subject: [PATCH 71/90] add OSU-Micro-Benchmarks/5.7.1-gompi-2021a to EESSI pilot 2021.12 --- EESSI-pilot-install-software.sh | 6 ++++++ eessi-2021.12.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index dc50f7fae2..63b5812b99 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -362,6 +362,12 @@ fail_msg="Installation of Nextflow failed, that's unexpected..." $EB -r --from-pr 16531 Nextflow-22.10.1.eb check_exit_code $? "${ok_msg}" "${fail_msg}" +echo ">> Installing OSU-Micro-Benchmarks/5.7.1-gompi-2021a..." +ok_msg="OSU-Micro-Benchmarks installed, yihaa!" +fail_msg="Installation of OSU-Micro-Benchmarks failed, that's unexpected..." +$EB OSU-Micro-Benchmarks-5.7.1-gompi-2021a.eb -r +check_exit_code $? "${ok_msg}" "${fail_msg}" + ### add packages here echo ">> Creating/updating Lmod cache..." diff --git a/eessi-2021.12.yml b/eessi-2021.12.yml index 58101777ca..04a9854b9c 100644 --- a/eessi-2021.12.yml +++ b/eessi-2021.12.yml @@ -27,6 +27,8 @@ software: toolchains: gompi-2020a: versions: ['5.6.3'] + gompi-2021a: + versions: ['5.7.1'] QuantumESPRESSO: toolchains: foss-2020a: From 85e2ed64554bb027d6201c5a782eb00fe36c9804 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 12 Nov 2022 17:29:44 +0100 Subject: [PATCH 72/90] enhance EasyBuild hooks to fix installation of MetaBAT in EESSI --- eb_hooks.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/eb_hooks.py b/eb_hooks.py index 653094266d..850b3da3b4 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -1,6 +1,7 @@ # Hooks to customize how EasyBuild installs software in EESSI # see https://docs.easybuild.io/en/latest/Hooks.html import os +import re from easybuild.tools.build_log import EasyBuildError, print_msg from easybuild.tools.config import build_option, update_build_option @@ -130,6 +131,23 @@ def pre_configure_hook(self, *args, **kwargs): PRE_CONFIGURE_HOOKS[self.name](self, *args, **kwargs) +def metabat_preconfigure(self, *args, **kwargs): + """ + Pre-configure hook for MetaBAT: + - take into account that zlib is a filtered dependency, + and that there's no libz.a in the EESSI compat layer + """ + if self.name == 'MetaBAT': + print("from metadata_preconfigure hook: %s" % self.cfg['configopts']) + configopts = self.cfg['configopts'] + regex = re.compile(r"\$EBROOTZLIB/lib/libz.a") + print(regex.search(configopts)) + self.cfg['configopts'] = regex.sub('$EPREFIX/usr/lib64/libz.so', configopts) + print(self.cfg['configopts']) + else: + raise EasyBuildError("MetaBAT-specific hook triggered for non-MetaBAT easyconfig?!") + + def wrf_preconfigure(self, *args, **kwargs): """ Pre-configure hook for WRF: @@ -144,6 +162,7 @@ def wrf_preconfigure(self, *args, **kwargs): else: raise EasyBuildError("WRF-specific hook triggered for non-WRF easyconfig?!") + PARSE_HOOKS = { 'CGAL': cgal_toolchainopts_precise, 'fontconfig': fontconfig_add_fonts, @@ -151,5 +170,6 @@ def wrf_preconfigure(self, *args, **kwargs): } PRE_CONFIGURE_HOOKS = { + 'MetaBAT': metabat_preconfigure, 'WRF': wrf_preconfigure, } From 0f83623924bc03a427d5c22fbd1f2ec6e0267d4a Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 2 Dec 2022 11:05:16 +0100 Subject: [PATCH 73/90] Update actions to avoid deprecation errors --- .github/workflows/tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 34bc06979e..a4dbd3cd4c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,16 +3,16 @@ name: Tests on: [push, pull_request] jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-22.04 strategy: matrix: python: [3.6, 3.7, 3.8, 3.9, '3.10'] fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v4 with: python-version: ${{matrix.python}} architecture: x64 From a7c8f161f8fbe1db2718a7a54b5be46bfd719ca8 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 2 Dec 2022 11:07:39 +0100 Subject: [PATCH 74/90] Update tests.yml --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a4dbd3cd4c..ae04e115c7 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: Tests on: [push, pull_request] jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-20.04 strategy: matrix: python: [3.6, 3.7, 3.8, 3.9, '3.10'] From 9b553faae00510c7ada8de12bb76cc36c9ef9741 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 2 Dec 2022 12:06:36 +0100 Subject: [PATCH 75/90] Update tests.yml --- .github/workflows/tests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ae04e115c7..c2aaeafbe2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -1,6 +1,8 @@ # documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions name: Tests on: [push, pull_request] +permissions: + contents: read # to fetch code (actions/checkout) jobs: build: runs-on: ubuntu-20.04 From d6eeda6cc5568b38306b0ef68b3de84fe10ab4fb Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 2 Dec 2022 12:08:31 +0100 Subject: [PATCH 76/90] Update tests_archdetect.yml --- .github/workflows/tests_archdetect.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 4fffce0dde..5732574ea2 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -1,6 +1,8 @@ # documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions name: Tests for eessi_archdetect.sh on: [push, pull_request] +permissions: + contents: read # to fetch code (actions/checkout) jobs: build: runs-on: ubuntu-20.04 From a6072f82917ccd65c9621c5e5e2d541d0fe7ce42 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 2 Dec 2022 12:08:47 +0100 Subject: [PATCH 77/90] Update tests_init.yml --- .github/workflows/tests_init.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests_init.yml b/.github/workflows/tests_init.yml index 027cc1a540..6df8b0a039 100644 --- a/.github/workflows/tests_init.yml +++ b/.github/workflows/tests_init.yml @@ -1,6 +1,8 @@ # documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions name: Tests for init scripts on: [push, pull_request] +permissions: + contents: read # to fetch code (actions/checkout) jobs: build: runs-on: ubuntu-18.04 From d10b2bfdf468834b6ffb3af6098f98b9f1a98468 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Fri, 2 Dec 2022 12:09:17 +0100 Subject: [PATCH 78/90] Update tests_scripts.yml --- .github/workflows/tests_scripts.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/tests_scripts.yml b/.github/workflows/tests_scripts.yml index ca8c2b930a..18fcd7b255 100644 --- a/.github/workflows/tests_scripts.yml +++ b/.github/workflows/tests_scripts.yml @@ -18,6 +18,8 @@ on: - run_in_compat_layer_env.sh - utils.sh - update_lmod_cache.sh +permissions: + contents: read # to fetch code (actions/checkout) jobs: build: runs-on: ubuntu-20.04 From 94147e35703648f82da5ed08a9d7540b504e021e Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 8 Dec 2022 16:22:33 +0100 Subject: [PATCH 79/90] Add CI security action --- .github/workflows/scorecards.yml | 75 ++++++++++++++++++++++++++ .github/workflows/tests.yml | 5 +- .github/workflows/tests_archdetect.yml | 3 +- .github/workflows/tests_init.yml | 7 +-- .github/workflows/tests_scripts.yml | 3 +- 5 files changed, 86 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/scorecards.yml diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml new file mode 100644 index 0000000000..ec018bd049 --- /dev/null +++ b/.github/workflows/scorecards.yml @@ -0,0 +1,75 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecards supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '25 15 * * 3' + push: + branches: [ "main" ] + pull_request: + branches: + - main + +# Declare default permissions as read only. +permissions: read-all + +jobs: + analysis: + name: Scorecards analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + + steps: + - name: "Checkout code" + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 + with: + persist-credentials: false + + - name: "Run analysis" + uses: ossf/scorecard-action@99c53751e09b9529366343771cc321ec74e9bd3d # v2.0.6 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecards on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + # repo_token: ${{ secrets.SCORECARD_TOKEN }} + + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@807578363a7869ca324a79039e6db9c843e0e100 # v2.1.27 + with: + sarif_file: results.sarif diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c2aaeafbe2..cc00685a40 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,10 +11,11 @@ jobs: python: [3.6, 3.7, 3.8, 3.9, '3.10'] fail-fast: false steps: - - uses: actions/checkout@v3 + - name: checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - name: set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0 with: python-version: ${{matrix.python}} architecture: x64 diff --git a/.github/workflows/tests_archdetect.yml b/.github/workflows/tests_archdetect.yml index 5732574ea2..618f6eb142 100644 --- a/.github/workflows/tests_archdetect.yml +++ b/.github/workflows/tests_archdetect.yml @@ -19,7 +19,8 @@ jobs: - aarch64/arm/neoverse-v1/AWS-awslinux-graviton3 fail-fast: false steps: - - uses: actions/checkout@v2 + - name: checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - name: test eessi_archdetect.sh run: | diff --git a/.github/workflows/tests_init.yml b/.github/workflows/tests_init.yml index 6df8b0a039..417b7851f1 100644 --- a/.github/workflows/tests_init.yml +++ b/.github/workflows/tests_init.yml @@ -5,16 +5,17 @@ permissions: contents: read # to fetch code (actions/checkout) jobs: build: - runs-on: ubuntu-18.04 + runs-on: ubuntu-20.04 strategy: matrix: python: [3.6, 3.7, 3.8, 3.9, '3.10'] fail-fast: false steps: - - uses: actions/checkout@v2 + - name: checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - name: set up Python - uses: actions/setup-python@v1 + uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0 with: python-version: ${{matrix.python}} architecture: x64 diff --git a/.github/workflows/tests_scripts.yml b/.github/workflows/tests_scripts.yml index 18fcd7b255..1a2b793750 100644 --- a/.github/workflows/tests_scripts.yml +++ b/.github/workflows/tests_scripts.yml @@ -24,7 +24,8 @@ jobs: build: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - name: checkout + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 # see https://github.com/apptainer/singularity/issues/5390#issuecomment-899111181 - name: install Singularity From d48fbdf78ed0a60da70660f23a5a8643b3ea7bfe Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Wed, 14 Dec 2022 11:04:03 +0100 Subject: [PATCH 80/90] remove debug print statements in eb_hooks.py --- eb_hooks.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/eb_hooks.py b/eb_hooks.py index 850b3da3b4..1877e27b44 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -138,12 +138,9 @@ def metabat_preconfigure(self, *args, **kwargs): and that there's no libz.a in the EESSI compat layer """ if self.name == 'MetaBAT': - print("from metadata_preconfigure hook: %s" % self.cfg['configopts']) configopts = self.cfg['configopts'] regex = re.compile(r"\$EBROOTZLIB/lib/libz.a") - print(regex.search(configopts)) self.cfg['configopts'] = regex.sub('$EPREFIX/usr/lib64/libz.so', configopts) - print(self.cfg['configopts']) else: raise EasyBuildError("MetaBAT-specific hook triggered for non-MetaBAT easyconfig?!") From edaae9db896a57d66babb2e4a7c516b6b1db0578 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Wed, 14 Dec 2022 15:44:51 +0100 Subject: [PATCH 81/90] Whoops --- eb_hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eb_hooks.py b/eb_hooks.py index 391cf8813b..df7742f999 100644 --- a/eb_hooks.py +++ b/eb_hooks.py @@ -163,7 +163,7 @@ def metabat_preconfigure(self, *args, **kwargs): regex = re.compile(r"\$EBROOTZLIB/lib/libz.a") self.cfg['configopts'] = regex.sub('$EPREFIX/usr/lib64/libz.so', configopts) else: - raise EasyBuildError("MetaBAT-specific hook triggered for non-MetaBAT easyconfig?!" + raise EasyBuildError("MetaBAT-specific hook triggered for non-MetaBAT easyconfig?!") def wrf_preconfigure(self, *args, **kwargs): From cec7938957a6ae7184368031684dfdce5eae9d41 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Thu, 15 Dec 2022 15:11:48 +0100 Subject: [PATCH 82/90] use correct OpenBLAS easyblock to install OpenBLAS/0.3.15-GCC-10.3.0 for */generic + ignore failing FlexiBLAS tests for ppc64le/generic --- EESSI-pilot-install-software.sh | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 2bc6876965..10311b7a15 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -224,10 +224,11 @@ ok_msg="Done with OpenBLAS!" fail_msg="Installation of OpenBLAS failed!" if [[ $GENERIC -eq 1 ]]; then echo_yellow ">> Using https://github.com/easybuilders/easybuild-easyblocks/pull/1946 to build generic OpenBLAS." - $EB --include-easyblocks-from-pr 1946 OpenBLAS-0.3.9-GCC-9.3.0.eb --robot + openblas_include_easyblocks_from_pr="--include-easyblocks-from-pr 1946" else - $EB OpenBLAS-0.3.9-GCC-9.3.0.eb --robot + openblas_include_easyblocks_from_pr='' fi +$EB $openblas_include_easyblocks_from_pr OpenBLAS-0.3.9-GCC-9.3.0.eb --robot check_exit_code $? "${ok_msg}" "${fail_msg}" echo ">> Installing OpenMPI..." @@ -389,9 +390,19 @@ $EB CMake-3.20.1-GCCcore-10.3.0.eb --robot --include-easyblocks-from-pr 2248 $EB --from-pr 14584 Rust-1.52.1-GCCcore-10.3.0.eb --robot # use OpenBLAS easyconfig from https://github.com/easybuilders/easybuild-easyconfigs/pull/15885 # which includes a patch to fix installation on POWER -$EB --from-pr 15885 OpenBLAS-0.3.15-GCC-10.3.0.eb --robot +$EB $openblas_include_easyblocks_from_pr --from-pr 15885 OpenBLAS-0.3.15-GCC-10.3.0.eb --robot +# ignore failing FlexiBLAS tests when building on POWER; +# some tests are failing due to a segmentation fault due to "invalid memory reference", +# see also https://github.com/easybuilders/easybuild-easyconfigs/pull/12476; +# using -fstack-protector-strong -fstack-clash-protection should fix that, +# but it doesn't for some reason when building for ppc64le/generic... +if [ "${EESSI_SOFTWARE_SUBDIR}" = "ppc64le/generic" ]; then + $EB FlexiBLAS-3.0.4-GCC-10.3.0.eb --ignore-test-failure +else + $EB FlexiBLAS-3.0.4-GCC-10.3.0.eb +fi -$EB SciPy-bundle-2021.05-foss-2021a.eb -r --buildpath /dev/shm/$USER/easybuild_build +$EB SciPy-bundle-2021.05-foss-2021a.eb --robot check_exit_code $? "${ok_msg}" "${fail_msg}" ### add packages here From d3ceed500c86852200e475ed74f2d95a3fddefcd Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 13 Jan 2023 21:45:01 +0100 Subject: [PATCH 83/90] flesh out script for checking on missing installations + test it in CI --- .github/workflows/test_eessi.yml | 41 ++++++++++++++++++++++++++++++++ EESSI-pilot-install-software.sh | 10 ++------ check_missing_installations.sh | 21 ++++++++++++++++ 3 files changed, 64 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/test_eessi.yml create mode 100755 check_missing_installations.sh diff --git a/.github/workflows/test_eessi.yml b/.github/workflows/test_eessi.yml new file mode 100644 index 0000000000..2b57eccc90 --- /dev/null +++ b/.github/workflows/test_eessi.yml @@ -0,0 +1,41 @@ +# documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions +name: Tests relying on having EESSI pilot repo mounted +on: [push, pull_request, workflow_dispatch] +jobs: + eessi_pilot_repo: + runs-on: ubuntu-20.04 + strategy: + fail-fast: false + matrix: + EESSI_VERSION: + - 2021.12 + EESSI_SOFTWARE_SUBDIR: + - aarch64/generic + - aarch64/graviton2 + - aarch64/graviton3 + - x86_64/amd/zen2 + - x86_64/amd/zen3 + - x86_64/intel/haswell + - x86_64/intel/skylake_avx512 + - x86_64/generic + steps: + - name: Check out software-layer repository + uses: actions/checkout@v2 + + - name: Mount EESSI CernVM-FS pilot repository + uses: cvmfs-contrib/github-action-cvmfs@main + with: + cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb + cvmfs_http_proxy: DIRECT + cvmfs_repositories: pilot.eessi-hpc.org + + - name: Test check_missing_installations.sh script + run: | + source /cvmfs/pilot.eessi-hpc.org/versions/${{matrix.EESSI_VERSION}}/init/bash + module load EasyBuild + eb --version + export EESSI_PREFIX=/cvmfs/pilot.eessi-hpc.org/versions/${{matrix.EESSI_VERSION}} + export EESSI_OS_TYPE=linux + export EESSI_SOFTWARE_SUBDIR=${{matrix.EESSI_SOFTWARE_SUBDIR}} + env | grep ^EESSI | sort + ./check_missing_installations.sh diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index d03c2bdce7..57c078f511 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -118,7 +118,7 @@ else fi echo ">> Configuring EasyBuild..." -source configure_easybuild +source $TOPDIR/configure_easybuild echo ">> Setting up \$MODULEPATH..." # make sure no modules are loaded @@ -421,13 +421,7 @@ fi $TOPDIR/update_lmod_cache.sh ${EPREFIX} ${EASYBUILD_INSTALLPATH} -echo ">> Checking for missing installations..." -ok_msg="No missing installations, party time!" -fail_msg="On no, some installations are still missing, how did that happen?!" -eb_missing_out=$TMPDIR/eb_missing.out -$EB --easystack eessi-${EESSI_PILOT_VERSION}.yml --experimental --missing --robot $EASYBUILD_PREFIX/ebfiles_repo | tee ${eb_missing_out} -grep "No missing modules" ${eb_missing_out} > /dev/null -check_exit_code $? "${ok_msg}" "${fail_msg}" +$TOPDIR/check_missing_installations.sh echo ">> Cleaning up ${TMPDIR}..." rm -r ${TMPDIR} diff --git a/check_missing_installations.sh b/check_missing_installations.sh new file mode 100755 index 0000000000..9675397164 --- /dev/null +++ b/check_missing_installations.sh @@ -0,0 +1,21 @@ +#!/bin/bash +# +# Script to check for missing installations in EESSI pilot software stack (version 2021.12) + +TOPDIR=$(dirname $(realpath $0)) + +TMPDIR=$(mktemp -d) + +source $TOPDIR/utils.sh + +source $TOPDIR/configure_easybuild + +echo ">> Checking for missing installations in ${EASYBUILD_INSTALLPATH}..." +ok_msg="No missing installations, party time!" +fail_msg="On no, some installations are still missing, how did that happen?!" +eb_missing_out=$TMPDIR/eb_missing.out +# we need to use --from-pr to pull in some easyconfigs that are not available in EasyBuild version being used +# PR #16531: Nextflow-22.10.1.eb +${EB:-eb} --from-pr 16531 --easystack eessi-${EESSI_PILOT_VERSION}.yml --experimental --missing | tee ${eb_missing_out} +grep "No missing modules" ${eb_missing_out} > /dev/null +check_exit_code $? "${ok_msg}" "${fail_msg}" From cc15fd577a811529941ef80ae89797c685d95686 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Fri, 13 Jan 2023 22:17:53 +0100 Subject: [PATCH 84/90] fix issues in CI workflow raised by OSSF scorecard --- .github/workflows/test_eessi.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_eessi.yml b/.github/workflows/test_eessi.yml index 2b57eccc90..92b1f71cad 100644 --- a/.github/workflows/test_eessi.yml +++ b/.github/workflows/test_eessi.yml @@ -1,6 +1,8 @@ # documentation: https://help.github.com/en/articles/workflow-syntax-for-github-actions name: Tests relying on having EESSI pilot repo mounted on: [push, pull_request, workflow_dispatch] +permissions: + contents: read # to fetch code (actions/checkout) jobs: eessi_pilot_repo: runs-on: ubuntu-20.04 @@ -20,10 +22,10 @@ jobs: - x86_64/generic steps: - name: Check out software-layer repository - uses: actions/checkout@v2 + uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 - name: Mount EESSI CernVM-FS pilot repository - uses: cvmfs-contrib/github-action-cvmfs@main + uses: cvmfs-contrib/github-action-cvmfs@d4641d0d591c9a5c3be23835ced2fb648b44c04b # v3.1 with: cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb cvmfs_http_proxy: DIRECT From a7909eee1a768c4f7a3723386eb561a71716f35d Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 14 Jan 2023 08:20:50 +0100 Subject: [PATCH 85/90] add license header + reuse $TMPDIR if set + make sure that $EESSI_PILOT_VERSION is set in check_missing_installations.sh --- check_missing_installations.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/check_missing_installations.sh b/check_missing_installations.sh index 9675397164..cfddb0ee14 100755 --- a/check_missing_installations.sh +++ b/check_missing_installations.sh @@ -1,10 +1,21 @@ #!/bin/bash # # Script to check for missing installations in EESSI pilot software stack (version 2021.12) +# +# author: Kenneth Hoste (@boegel) +# +# license: GPLv2 +# TOPDIR=$(dirname $(realpath $0)) -TMPDIR=$(mktemp -d) +if [ -z ${EESSI_PILOT_VERSION} ]; then + echo "ERROR: \${EESSI_PILOT_VERSION} must be set to run $0!" >&2 + exit 1 +fi + +# reuse existing $TMPDIR if set, create a new tmpdir if $TMPDIR is unset +TMPDIR=${TMPDIR:-$(mktemp -d)} source $TOPDIR/utils.sh From 5c940744415fa9688bbd4a9e64c2ae146469f348 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 14 Jan 2023 14:40:43 +0100 Subject: [PATCH 86/90] rename $TMPDIR to $LOCAL_TMPDIR in check_missing_installations.sh, since $TMPDIR is a common environment variable (picked up by mktemp, etc.) --- check_missing_installations.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/check_missing_installations.sh b/check_missing_installations.sh index cfddb0ee14..30f9cc6ff7 100755 --- a/check_missing_installations.sh +++ b/check_missing_installations.sh @@ -14,8 +14,7 @@ if [ -z ${EESSI_PILOT_VERSION} ]; then exit 1 fi -# reuse existing $TMPDIR if set, create a new tmpdir if $TMPDIR is unset -TMPDIR=${TMPDIR:-$(mktemp -d)} +LOCAL_TMPDIR=$(mktemp -d) source $TOPDIR/utils.sh @@ -24,7 +23,7 @@ source $TOPDIR/configure_easybuild echo ">> Checking for missing installations in ${EASYBUILD_INSTALLPATH}..." ok_msg="No missing installations, party time!" fail_msg="On no, some installations are still missing, how did that happen?!" -eb_missing_out=$TMPDIR/eb_missing.out +eb_missing_out=$LOCAL_TMPDIR/eb_missing.out # we need to use --from-pr to pull in some easyconfigs that are not available in EasyBuild version being used # PR #16531: Nextflow-22.10.1.eb ${EB:-eb} --from-pr 16531 --easystack eessi-${EESSI_PILOT_VERSION}.yml --experimental --missing | tee ${eb_missing_out} From 61d8e8fd8b61ee3e14cdb268ee0956f0d16a1ce1 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 14 Jan 2023 21:01:03 +0100 Subject: [PATCH 87/90] use newer build container (Debian 11 w/ fuse-overlayfs 1.9) --- build_container.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_container.sh b/build_container.sh index d7e7256b4e..f8e9c6bf59 100755 --- a/build_container.sh +++ b/build_container.sh @@ -1,6 +1,6 @@ #!/bin/bash -BUILD_CONTAINER="docker://ghcr.io/eessi/build-node:debian10" +BUILD_CONTAINER="docker://ghcr.io/eessi/build-node:debian11" if [ $# -lt 2 ]; then echo "Usage: $0 " >&2 From f66397ef6aa7ca60ea20ce4b73aed8ba29dd2898 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 14 Jan 2023 21:16:43 +0100 Subject: [PATCH 88/90] install Apptainer in CI workflow used to test build_container.sh script --- .github/workflows/tests_scripts.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests_scripts.yml b/.github/workflows/tests_scripts.yml index 1a2b793750..9c4975c381 100644 --- a/.github/workflows/tests_scripts.yml +++ b/.github/workflows/tests_scripts.yml @@ -28,14 +28,16 @@ jobs: uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0 # see https://github.com/apptainer/singularity/issues/5390#issuecomment-899111181 - - name: install Singularity + - name: install Apptainer run: | sudo apt-get install alien alien --version - singularity_rpm=$(curl --silent -L https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/ | grep singularity | sed 's/.*\(singularity[0-9._a-z-]*.rpm\).*/\1/g') - curl -OL https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/s/$singularity_rpm - sudo alien -d $singularity_rpm - sudo apt install ./singularity*.deb + apptainer_rpm=$(curl --silent -L https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/a/ | grep 'apptainer-[0-9]' | sed 's/.*\(apptainer[0-9._a-z-]*.rpm\).*/\1/g') + curl -OL https://dl.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/a/$apptainer_rpm + sudo alien -d $apptainer_rpm + sudo apt install ./apptainer*.deb + apptainer --version + # also check whether 'singularity' command is still provided by Apptainer installation singularity --version - name: test install_software_layer.sh script From 8fbae4a6acc5c4c97286ab885a73f8156a675abf Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 14 Jan 2023 22:08:38 +0100 Subject: [PATCH 89/90] don't blindly overwrite $EESSI_SOFTWARE_SUBDIR_OVERRIDE in EESSI-pilot-install-software.sh --- EESSI-pilot-install-software.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/EESSI-pilot-install-software.sh b/EESSI-pilot-install-software.sh index 57c078f511..2c7622b45a 100755 --- a/EESSI-pilot-install-software.sh +++ b/EESSI-pilot-install-software.sh @@ -92,7 +92,12 @@ if [[ "$EASYBUILD_OPTARCH" == "GENERIC" ]]; then fi echo ">> Determining software subdirectory to use for current build host..." -export EESSI_SOFTWARE_SUBDIR_OVERRIDE=$(python3 $TOPDIR/eessi_software_subdir.py $DETECTION_PARAMETERS) +if [ -z $EESSI_SOFTWARE_SUBDIR_OVERRIDE ]; then + export EESSI_SOFTWARE_SUBDIR_OVERRIDE=$(python3 $TOPDIR/eessi_software_subdir.py $DETECTION_PARAMETERS) + echo ">> Determined \$EESSI_SOFTWARE_SUBDIR_OVERRIDE via 'eessi_software_subdir.py $DETECTION_PARAMETERS' script" +else + echo ">> Picking up pre-defined \$EESSI_SOFTWARE_SUBDIR_OVERRIDE: ${EESSI_SOFTWARE_SUBDIR_OVERRIDE}" +fi # Set all the EESSI environment variables (respecting $EESSI_SOFTWARE_SUBDIR_OVERRIDE) # $EESSI_SILENT - don't print any messages From 9778c10f3f392f3a8ac9625ff1eeb9327aa2f3e3 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Sat, 14 Jan 2023 22:38:50 +0100 Subject: [PATCH 90/90] pass down $EESSI_SOFTWARE_SUBDIR_OVERRIDE into build container and Prefix environment --- build_container.sh | 7 +++++++ run_in_compat_layer_env.sh | 10 ++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build_container.sh b/build_container.sh index f8e9c6bf59..bddd3dfffc 100755 --- a/build_container.sh +++ b/build_container.sh @@ -43,6 +43,13 @@ fi export EESSI_PILOT_READONLY="container:cvmfs2 pilot.eessi-hpc.org /cvmfs_ro/pilot.eessi-hpc.org" export EESSI_PILOT_WRITABLE_OVERLAY="container:fuse-overlayfs -o lowerdir=/cvmfs_ro/pilot.eessi-hpc.org -o upperdir=$EESSI_TMPDIR/overlay-upper -o workdir=$EESSI_TMPDIR/overlay-work /cvmfs/pilot.eessi-hpc.org" +# pass $EESSI_SOFTWARE_SUBDIR_OVERRIDE into build container (if set) +if [ ! -z ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} ]; then + export SINGULARITYENV_EESSI_SOFTWARE_SUBDIR_OVERRIDE=${EESSI_SOFTWARE_SUBDIR_OVERRIDE} + # also specify via $APPTAINERENV_* (future proof, cfr. https://apptainer.org/docs/user/latest/singularity_compatibility.html#singularity-environment-variable-compatibility) + export APPTAINERENV_EESSI_SOFTWARE_SUBDIR_OVERRIDE=${EESSI_SOFTWARE_SUBDIR_OVERRIDE} +fi + if [ "$SHELL_OR_RUN" == "shell" ]; then # start shell in Singularity container, with EESSI repository mounted with writable overlay echo "Starting Singularity build container..." diff --git a/run_in_compat_layer_env.sh b/run_in_compat_layer_env.sh index 118aac65d5..561a311588 100755 --- a/run_in_compat_layer_env.sh +++ b/run_in_compat_layer_env.sh @@ -8,5 +8,11 @@ if [ ! -d ${EESSI_COMPAT_LAYER_DIR} ]; then echo "ERROR: ${EESSI_COMPAT_LAYER_DIR} does not exist!" >&2 exit 1 fi -echo "Running '$@' in EESSI ${EESSI_PILOT_VERSION} compatibility layer environment..." -${EESSI_COMPAT_LAYER_DIR}/startprefix <<< "$@" + +INPUT=$(echo "$@") +if [ ! -z ${EESSI_SOFTWARE_SUBDIR_OVERRIDE} ]; then + INPUT="export EESSI_SOFTWARE_SUBDIR_OVERRIDE=${EESSI_SOFTWARE_SUBDIR_OVERRIDE}; ${INPUT}" +fi + +echo "Running '${INPUT}' in EESSI ${EESSI_PILOT_VERSION} compatibility layer environment..." +${EESSI_COMPAT_LAYER_DIR}/startprefix <<< "${INPUT}"