|
| 1 | +name: ubuntu-ci-c6a-x86_64-oneapi-ifx-build |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +defaults: |
| 11 | + run: |
| 12 | + shell: bash |
| 13 | + |
| 14 | +jobs: |
| 15 | + ubuntu-ci-c6a-x86_64-oneapi-ifx-build: |
| 16 | + runs-on: [ubuntu-ci-c6a-x86_64] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: cleanup |
| 20 | + run: | |
| 21 | + pwd |
| 22 | + ls -lart |
| 23 | + set +e |
| 24 | + find ./* -type d -exec chmod u+xw {} \; |
| 25 | + set -e |
| 26 | + rm -fr * |
| 27 | +
|
| 28 | + - name: checkout |
| 29 | + uses: actions/checkout@v4 |
| 30 | + with: |
| 31 | + submodules: true |
| 32 | + |
| 33 | + - name: prepare-directories |
| 34 | + run: | |
| 35 | + mkdir -p /home/ubuntu/spack-stack/build-cache/ |
| 36 | + mkdir -p /home/ubuntu/spack-stack/source-cache/ |
| 37 | +
|
| 38 | + - name: create-buildcache |
| 39 | + run: | |
| 40 | + # Get day of week to decide whether to use build caches or not |
| 41 | + DOW=$(date +%u) |
| 42 | + # Monday is 1 ... Sunday is 7 |
| 43 | + if [[ $DOW == 7 ]]; then |
| 44 | + export USE_BINARY_CACHE=false |
| 45 | + echo "Ignore existing binary cache for creating buildcache environment" |
| 46 | + else |
| 47 | + export USE_BINARY_CACHE=true |
| 48 | + echo "Use existing binary cache for creating buildcache environment" |
| 49 | + fi |
| 50 | +
|
| 51 | + # Set up spack-stack |
| 52 | + source ./setup.sh |
| 53 | + export ENVNAME=ue-oneapi-ifx-2024.2.0-buildcache |
| 54 | + export ENVDIR=$PWD/envs/${ENVNAME} |
| 55 | + spack stack create env --site linux.default --template unified-dev --name ${ENVNAME} --compiler oneapi |
| 56 | + spack env activate ${ENVDIR} |
| 57 | + export SPACK_SYSTEM_CONFIG_PATH="${ENVDIR}/site" |
| 58 | +
|
| 59 | + # Find external packages |
| 60 | + spack external find --scope system \ |
| 61 | + --exclude bison --exclude openssl \ |
| 62 | + --exclude curl --exclude python \ |
| 63 | + --exclude gmake |
| 64 | + spack external find --scope system sed |
| 65 | + spack external find --scope system perl |
| 66 | + spack external find --scope system wget |
| 67 | + spack external find --scope system texlive |
| 68 | + spack external find --scope system mysql |
| 69 | +
|
| 70 | + # Find compilers |
| 71 | + spack compiler find --scope system |
| 72 | +
|
| 73 | + # For Intel oneAPI |
| 74 | + echo "" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 75 | + echo "- compiler:" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 76 | + echo " spec: [email protected]" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 77 | + echo " paths:" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 78 | + echo " cc: /opt/intel/oneapi/compiler/2024.2/bin/icx" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 79 | + echo " cxx: /opt/intel/oneapi/compiler/2024.2/bin/icpx" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 80 | + echo " f77: /opt/intel/oneapi/compiler/2024.2/bin/ifx" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 81 | + echo " fc: /opt/intel/oneapi/compiler/2024.2/bin/ifx" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 82 | + echo " flags: {}" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 83 | + echo " operating_system: ubuntu22.04" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 84 | + echo " target: x86_64" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 85 | + echo " modules: []" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 86 | + echo " environment: {}" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 87 | + echo " extra_rpaths: []" >> ${SPACK_SYSTEM_CONFIG_PATH}/compilers.yaml |
| 88 | +
|
| 89 | + # Need to find external Intel MPI and annotate with the |
| 90 | + # correct compiler, no way to do that with spack commands. |
| 91 | + echo "" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 92 | + echo " intel-oneapi-mpi:" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 93 | + echo " buildable: false" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 94 | + echo " externals:" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 95 | + echo " - spec: [email protected]%[email protected]" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 96 | + echo " prefix: /opt/intel/oneapi" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 97 | +
|
| 98 | + # Add external Intel MKL and oneAPI runtime |
| 99 | + echo "" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 100 | + echo " intel-oneapi-mkl:" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 101 | + echo " externals:" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 102 | + echo " - spec: [email protected]%[email protected]" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 103 | + echo " prefix: /opt/intel/oneapi" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 104 | + echo " intel-oneapi-runtime:" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 105 | + echo " externals:" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 106 | + echo " - spec: [email protected]%[email protected]" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 107 | + echo " prefix: /opt/intel/oneapi" >> ${SPACK_SYSTEM_CONFIG_PATH}/packages.yaml |
| 108 | +
|
| 109 | + export -n SPACK_SYSTEM_CONFIG_PATH |
| 110 | +
|
| 111 | + # For buildcaches |
| 112 | + spack config add config:install_tree:padded_length:200 |
| 113 | +
|
| 114 | + # Set compiler and MPI specs |
| 115 | + spack config add "packages:all:providers:mpi:[[email protected]]" |
| 116 | + spack config add "packages:all:compiler:[[email protected],[email protected]]" |
| 117 | +
|
| 118 | + # Add additional variants for MET packages, different from config/common/packages.yaml |
| 119 | + spack config add "packages:met:variants:+python +grib2 +graphics +lidar2nc +modis" |
| 120 | +
|
| 121 | + # Switch providers for blas, lapack, fftw-api |
| 122 | + spack config add "packages:all:providers:mpi:[intel-oneapi-mpi]" |
| 123 | + spack config add "packages:all:providers:blas:[intel-oneapi-mkl]" |
| 124 | + spack config add "packages:all:providers:fftw-api:[intel-oneapi-mkl]" |
| 125 | + spack config add "packages:all:providers:lapack:[intel-oneapi-mkl]" |
| 126 | + spack config add "packages:ectrans:require:'+mkl ~fftw'" |
| 127 | + spack config add "packages:gsibec:require:'+mkl'" |
| 128 | + spack config add "packages:py-numpy:require:['^intel-oneapi-mkl']" |
| 129 | +
|
| 130 | + # Pin gmake to avoid duplicate packages (excluded gmake from spack external find above) |
| 131 | + spack config add "packages:gmake:require:'@:4.2'" |
| 132 | +
|
| 133 | + # Remove wgrib2 from all virtual packages, since it doesn't build with oneAPI |
| 134 | + sed -i 's/depends_on("wgrib2")/#depends_on("wgrib2")/g' `grep -lRie wgrib2 spack-ext/` |
| 135 | +
|
| 136 | + # Don't generate ecflow module when using external package |
| 137 | + spack config add "modules:default:tcl:exclude:[ecflow]" |
| 138 | +
|
| 139 | + # Concretize and check for duplicates |
| 140 | + spack concretize 2>&1 | tee log.concretize.oneapi-ifx-2024.2.0-buildcache |
| 141 | + ${SPACK_STACK_DIR}/util/show_duplicate_packages.py -d log.concretize.oneapi-ifx-2024.2.0-buildcache -i fms -i crtm -i esmf -i mapl |
| 142 | +
|
| 143 | + # Add and update source cache |
| 144 | + spack mirror add local-source file:///home/ubuntu/spack-stack/source-cache/ |
| 145 | + spack mirror create -a -d /home/ubuntu/spack-stack/source-cache/ |
| 146 | +
|
| 147 | + # Add binary cache if requested |
| 148 | + if [ "$USE_BINARY_CACHE" = true ] ; then |
| 149 | + set +e |
| 150 | + spack mirror add local-binary file:///home/ubuntu/spack-stack/build-cache/ |
| 151 | + spack buildcache update-index local-binary || (echo "No valid binary cache found, proceed without" && spack mirror rm local-binary) |
| 152 | + set +e |
| 153 | + echo "Packages in spack binary cache:" |
| 154 | + spack buildcache list |
| 155 | + fi |
| 156 | +
|
| 157 | + # Break installation up in pieces and create build caches in between |
| 158 | + # This allows us to "spin up" builds that altogether take longer than |
| 159 | + # six hours, and/or fail later in the build process. |
| 160 | +
|
| 161 | + # base-env |
| 162 | + echo "base-env ..." |
| 163 | + spack install --fail-fast --source --no-check-signature base-env 2>&1 | tee log.install.oneapi-ifx-2024.2.0-buildcache.base-env |
| 164 | + spack buildcache create -u /home/ubuntu/spack-stack/build-cache/ base-env |
| 165 | +
|
| 166 | + # jedi-base-env |
| 167 | + echo "jedi-base-env ..." |
| 168 | + spack install --fail-fast --source --no-check-signature jedi-base-env 2>&1 | tee log.install.oneapi-ifx-2024.2.0-buildcache.jedi-base-env |
| 169 | + spack buildcache create -u /home/ubuntu/spack-stack/build-cache/ jedi-base-env |
| 170 | +
|
| 171 | + # jedi-ufs-env |
| 172 | + echo "jedi-ufs-env ..." |
| 173 | + spack install --fail-fast --source --no-check-signature jedi-ufs-env 2>&1 | tee log.install.oneapi-ifx-2024.2.0-buildcache.jedi-ufs-env |
| 174 | + spack buildcache create -u /home/ubuntu/spack-stack/build-cache/ jedi-ufs-env |
| 175 | +
|
| 176 | + # the rest |
| 177 | + echo "unified-env ..." |
| 178 | + spack install --fail-fast --source --no-check-signature 2>&1 | tee log.install.oneapi-ifx-2024.2.0-buildcache.unified-env |
| 179 | + spack buildcache create -u /home/ubuntu/spack-stack/build-cache/ |
| 180 | +
|
| 181 | + # Remove binary cache for next round of concretization |
| 182 | + if [ "$USE_BINARY_CACHE" = true ] ; then |
| 183 | + spack mirror rm local-binary |
| 184 | + fi |
| 185 | +
|
| 186 | + # Remove buildcache config settings |
| 187 | + spack config remove config:install_tree:padded_length |
| 188 | +
|
| 189 | + # Next steps: synchronize source and build cache to a central/combined mirror? |
| 190 | +
|
| 191 | + # Cleanup |
| 192 | + spack clean -a |
| 193 | + spack env deactivate |
| 194 | +
|
| 195 | + - name: create-env |
| 196 | + run: | |
| 197 | + # Set up spack-stack |
| 198 | + source ./setup.sh |
| 199 | + export BUILDCACHE_ENVNAME=ue-oneapi-ifx-2024.2.0-buildcache |
| 200 | + export BUILDCACHE_ENVDIR=$PWD/envs/${BUILDCACHE_ENVNAME} |
| 201 | + export ENVNAME=ue-oneapi-ifx-2024.2.0 |
| 202 | + export ENVDIR=$PWD/envs/${ENVNAME} |
| 203 | + rsync -av --exclude='install' --exclude='spack.lock' --exclude='.spack_db' ${BUILDCACHE_ENVDIR}/ ${ENVDIR}/ |
| 204 | + spack env activate ${ENVDIR} |
| 205 | +
|
| 206 | + # Concretize and check for duplicates |
| 207 | + spack concretize --force 2>&1 | tee log.concretize.oneapi-ifx-2024.2.0 |
| 208 | + ${SPACK_STACK_DIR}/util/show_duplicate_packages.py -d log.concretize.oneapi-ifx-2024.2.0 -i fms -i crtm -i esmf -i mapl |
| 209 | +
|
| 210 | + # Add binary cache back in |
| 211 | + spack mirror add local-binary file:///home/ubuntu/spack-stack/build-cache/ |
| 212 | + echo "Packages in combined spack build caches:" |
| 213 | + spack buildcache list |
| 214 | +
|
| 215 | + # Install from cache |
| 216 | + spack install --fail-fast --source --no-check-signature 2>&1 | tee log.install.oneapi-ifx-2024.2.0.unified-env |
| 217 | +
|
| 218 | + # Check shared libraries |
| 219 | + ${SPACK_STACK_DIR}/util/ldd_check.py $SPACK_ENV 2>&1 | tee log.ldd_check |
| 220 | +
|
| 221 | + # Create modules |
| 222 | + spack clean -a |
| 223 | + spack module tcl refresh -y |
| 224 | + spack stack setup-meta-modules |
| 225 | + spack env deactivate |
| 226 | +
|
| 227 | + - name: test-env |
| 228 | + run: | |
| 229 | + source /etc/profile.d/modules.sh |
| 230 | + module use /home/ubuntu/spack-stack/modulefiles |
| 231 | +
|
| 232 | + export ENVNAME=ue-oneapi-ifx-2024.2.0 |
| 233 | + export ENVDIR=$PWD/envs/${ENVNAME} |
| 234 | + ls -l ${ENVDIR}/install/modulefiles/Core |
| 235 | +
|
| 236 | + module use ${ENVDIR}/install/modulefiles/Core |
| 237 | + module load stack-oneapi/2024.2.0 |
| 238 | + module load stack-intel-oneapi-mpi/2021.13 |
| 239 | + module load stack-python/3.11.7 |
| 240 | + module available |
| 241 | +
|
| 242 | + module load jedi-ufs-env |
| 243 | + module load ewok-env |
| 244 | + module load soca-env |
| 245 | + module list |
0 commit comments