|
1 | | -name: Intel Linux Build and Test |
| 1 | +name: Intel oneAPI Linux Build and Test |
2 | 2 | on: [push, pull_request, workflow_dispatch] |
3 | 3 |
|
4 | | -# Use custom shell with -l so .bash_profile is sourced which loads intel/oneapi/setvars.sh |
5 | | -# without having to do it in manually every step |
6 | | -defaults: |
7 | | - run: |
8 | | - shell: bash -leo pipefail {0} |
9 | | - |
10 | | -# Set I_MPI_CC/F90 so IntelLLVM is used. |
11 | | -env: |
12 | | - cache_key: intel |
13 | | - CC: mpiicx |
14 | | - FC: mpiifx |
15 | | - CXX: mpiicpx |
16 | | - I_MPI_CC: icx |
17 | | - I_MPI_F90: ifx |
18 | | - I_MPI_CXX: icpx |
19 | | - |
20 | | -# The jobs are split into: |
21 | | -# 1. a dependency build step (setup), and |
22 | | -# 2. a UFS-utils build and test step (ufs_utils) |
23 | | -# The setup is run once and the environment is cached, |
24 | | -# so each subsequent build and test of UFS-utils can reuse the cached |
25 | | -# dependencies to save time (and compute). |
26 | | - |
27 | 4 | jobs: |
28 | | - setup: |
| 5 | + ufs_utils-oneapi: |
29 | 6 | runs-on: ubuntu-24.04 |
| 7 | + # Dependencies are preinstalled in a container image. |
| 8 | + # For available images, see https://github.com/orgs/NOAA-EMC/packages?tab=packages&q=ufs-utils. |
| 9 | + # See https://github.com/NOAA-EMC/ci-common-build-cache/#using-container-images for further container usage instructions. |
| 10 | + container: ghcr.io/noaa-emc/ci-common-build-cache/ufs-utils-ubuntu-24.04-oneapi-2025.3-intel-oneapi-mpi-2021.17@sha256:93fb43fdd2e74e1a4081b52bbf5a1afd244d4e48219fa2c7f06fdcddb609697e |
30 | 11 |
|
31 | 12 | steps: |
32 | | - - name: checkout # this is to get the ci/spack.yaml file |
33 | | - uses: actions/checkout@v3 |
34 | | - with: |
35 | | - path: ufs_utils |
36 | | - |
37 | | - # Cache spack, compiler and dependencies |
38 | | - - name: cache-env |
39 | | - id: cache-env |
40 | | - uses: actions/cache@v3 |
41 | | - with: |
42 | | - path: | |
43 | | - spack |
44 | | - ~/.spack |
45 | | - /opt/intel |
46 | | - key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} |
47 | | - |
48 | | - - name: install-intel-compilers |
49 | | - run: | |
50 | | - wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB |
51 | | - sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB |
52 | | - echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list |
53 | | - sudo apt-get update |
54 | | - sudo apt-get install intel-oneapi-mpi-devel intel-oneapi-openmp-2024.1 intel-oneapi-compiler-fortran-2024.1 intel-oneapi-compiler-dpcpp-cpp-2024.1 |
55 | | - echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile |
56 | | -
|
57 | | - # Install dependencies using Spack |
58 | | - - name: install-dependencies-with-spack |
59 | | - if: steps.cache-env.outputs.cache-hit != 'true' |
60 | | - run: | |
61 | | - sudo mv /usr/local /usr/local_mv |
62 | | - git clone -c feature.manyFiles=true https://github.com/spack/spack.git |
63 | | - source spack/share/spack/setup-env.sh |
64 | | - sed "s/\[oneapi, gcc@10:10, apple-clang@14\]/\[oneapi\]/g" ufs_utils/ci/spack.yaml > spack_ci.yaml |
65 | | - spack env create ufs_utils-env spack_ci.yaml |
66 | | - spack env activate ufs_utils-env |
67 | | - spack compiler find |
68 | | - sudo apt install cmake |
69 | | - spack external find --not-buildable gmake |
70 | | - spack external find |
71 | | - spack config add "packages:all:prefer:['%oneapi']" |
72 | | - spack config add "packages:fortran:require:'intel-oneapi-compilers'" |
73 | | - spack config add "packages:mpi:require:intel-oneapi-mpi" |
74 | | - spack config add "packages:mpi:buildable:false" |
75 | | - spack config add "packages:mpi:require:intel-oneapi-mpi" |
76 | | - intel_mpi_version=$(basename $(realpath /opt/intel/oneapi/mpi/latest)) |
77 | | - sed -i "s|^ packages:| packages:\n intel-oneapi-mpi:\n buildable: false\n externals:\n - spec: intel-oneapi-mpi@${intel_mpi_version}\n prefix: /opt/intel/oneapi|" $SPACK_ENV/spack.yaml |
78 | | - spack config add "packages:python:require:'@3.11'" |
79 | | - cat $SPACK_ENV/spack.yaml |
80 | | - spack concretize |
81 | | - spack install --dirty --show-log-on-error --fail-fast |
82 | | - spack clean --all |
83 | | -
|
84 | | - ufs_utils: |
85 | | - needs: setup |
86 | | - runs-on: ubuntu-24.04 |
87 | | - |
88 | | - steps: |
89 | | - - name: install-intel |
90 | | - run: | |
91 | | - echo "source /opt/intel/oneapi/setvars.sh" >> ~/.bash_profile |
92 | | -
|
93 | 13 | - name: checkout |
94 | 14 | uses: actions/checkout@v3 |
95 | 15 | with: |
96 | 16 | path: ufs_utils |
97 | 17 | submodules: recursive |
98 | 18 |
|
99 | | - - name: cache-env |
100 | | - id: cache-env |
101 | | - uses: actions/cache@v3 |
102 | | - with: |
103 | | - path: | |
104 | | - spack |
105 | | - ~/.spack |
106 | | - /opt/intel |
107 | | - key: spack-${{ runner.os }}-${{ env.cache_key }}-${{ hashFiles('ufs_utils/ci/spack.yaml') }} |
| 19 | + - name: "Install Intel compilers & MPI" |
| 20 | + uses: NOAA-EMC/ci-install-intel-toolkit@develop |
| 21 | + with: # Match versions to container configuration |
| 22 | + install-classic: false |
| 23 | + oneapi-version: 2025.3 |
| 24 | + install-mpi: true |
| 25 | + mpi-version: 2021.17 |
| 26 | + mpi-wrapper-setup: oneapi |
| 27 | + compiler-setup: oneapi |
| 28 | + configure-gcc: false |
108 | 29 |
|
109 | 30 | - name: build |
| 31 | + shell: bash |
110 | 32 | run: | |
111 | | - source spack/share/spack/setup-env.sh |
112 | | - spack env activate ufs_utils-env |
113 | | - export CC=mpiicx |
114 | | - export FC=mpiifx |
115 | | - cd ufs_utils |
116 | | - mkdir -p build && cd build |
117 | | - cmake -DCMAKE_INSTALL_PREFIX=../install .. |
118 | | - make -j2 VERBOSE=1 |
119 | | - make install |
120 | | -
|
121 | | - - name: ctest |
122 | | - run: | |
123 | | - source spack/share/spack/setup-env.sh |
124 | | - spack env activate ufs_utils-env |
125 | | - cd ufs_utils |
126 | | - cd build |
127 | | - ctest --verbose --rerun-failed --output-on-failure |
| 33 | + . /entrypoint.sh |
| 34 | + spack uninstall --force --yes-to-all gcc-runtime intel-oneapi-runtime # prevents CMake config warnings |
| 35 | + ############################ |
| 36 | + ## Modify Spack installation, if needed |
| 37 | + ## |
| 38 | + ## For `swap-package` custom Spack command documentation, |
| 39 | + ## see https://github.com/NOAA-EMC/spack-helpers#modify-package-spec-swap-package. |
| 40 | + ## To request a package addition or update , create an issue or PR at |
| 41 | + ## https://github.com/NOAA-EMC/ci-common-build-cache/. |
| 42 | + ## |
| 43 | + ## Configure a different version/build options for a package: |
| 44 | + #spack swap-package foo@1.2.3 |
| 45 | + ## Configure an additional package not already in Spack: |
| 46 | + #spack add bar@4.5.6 |
| 47 | + ## Concretize environment and run the installation: |
| 48 | + #spack concretize --fresh |
| 49 | + #spack install --only-concrete |
| 50 | + ############################ |
| 51 | + cmake -S ufs_utils -B build -DCMAKE_INSTALL_PREFIX=install |
| 52 | + cmake --build build --parallel 4 --verbose |
| 53 | + cmake --install build |
| 54 | + ctest --test-dir build --parallel 4 --output-on-failure |
0 commit comments