-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
143 lines (137 loc) · 5.76 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# This action.yml provides a GitHub Action for installing Intel Classic and
# oneAPI compilers.
# Alex Richert, April 2024
name: 'Install Intel compilers'
description: 'Installs Intel compilers through "apt" for Ubuntu runners'
inputs:
install-classic:
description: 'Install Intel Classic compilers (icc/icpc/ifort)'
default: true
classic-version:
description: 'Set Intel Classic version'
default: '2023.2.1'
install-oneapi:
description: 'Install Intel oneAPI compilers (icx/icpx/ifx)'
default: true
oneapi-version:
description: 'Set Intel oneAPI version'
default: '2023.2.1'
install-mpi:
description: 'Install Intel MPI libraries'
default: false
mpi-version:
description: 'Set Intel MPI version'
default: '2021.10.0'
mpi-wrapper-setup:
description: 'Choose whether to use "oneapi" or "classic" MPI wrapper, or "none"'
default: 'none'
install-openmp:
description: 'Install Intel OpenMP libraries'
default: false
openmp-version:
description: 'Set Intel OpenMP library version'
default: '2023.2.1'
install-mkl:
description: 'Install Intel MKL'
default: false
mkl-version:
description: 'Set Intel MKL version'
default: '2023.2.0'
env-update:
description: 'Apply environment modifications to $GITHUB_ENV'
default: true
cache:
description: 'Cache to repository cache with actions/cache'
default: true
shell:
default: bash
compiler-setup:
description: 'Set CC, CXX, FC as part of environment setup ("env-update"); choose "oneapi" or "classic"'
default: ''
runs:
using: "composite"
steps:
- name: "Cache setup"
id: intel-cache
uses: actions/cache@v4
if: ${{ inputs.cache }}
with:
path: /opt/intel
key: intel-${{ inputs.install-classic }}-${{ inputs.classic-version }}-${{ inputs.install-oneapi }}-${{ inputs.oneapi-version }}-${{ inputs.install-mpi }}-${{ inputs.mpi-version }}-${{ inputs.install-openmp }}-${{ inputs.openmp-version }}-${{ inputs.install-mkl }}-${{ inputs.mkl-version }}
- name: "Install Intel compilers"
if: steps.intel-cache.outputs.cache-hit != 'true'
shell: ${{ inputs.shell }}
run: |
cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
rm GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt-get update
if [ ${{ inputs.install-classic }} == true ]; then
COMPONENTS+=" intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic"
if [ ! -z ${{ inputs.classic-version }} ]; then
COMPONENTS+=-${{ inputs.classic-version }}
fi
COMPONENTS+=" intel-oneapi-compiler-fortran"
if [ ! -z ${{ inputs.classic-version }} ]; then
COMPONENTS+=-${{ inputs.classic-version }}
fi
fi
if [ ${{ inputs.install-oneapi }} == true ]; then
COMPONENTS+=" intel-oneapi-compiler-dpcpp-cpp"
if [ ! -z ${{ inputs.oneapi-version }} ]; then
COMPONENTS+=-${{ inputs.oneapi-version }}
fi
COMPONENTS+=" intel-oneapi-compiler-fortran"
if [ ! -z ${{ inputs.oneapi-version }} ]; then
COMPONENTS+=-${{ inputs.oneapi-version }}
fi
fi
if [ ${{ inputs.install-mpi }} == true ]; then
COMPONENTS+=" intel-oneapi-mpi-devel"
if [ ! -z ${{ inputs.mpi-version }} ]; then
COMPONENTS+=-${{ inputs.mpi-version }}
fi
fi
if [ ${{ inputs.install-openmp }} == true ]; then
COMPONENTS+=" intel-oneapi-openmp"
if [ ! -z ${{ inputs.openmp-version }} ]; then
COMPONENTS+=-${{ inputs.openmp-version }}
fi
fi
if [ ${{ inputs.install-mkl }} == true ]; then
COMPONENTS+=" intel-oneapi-mkl-devel"
if [ ! -z ${{ inputs.mkl-version }} ]; then
COMPONENTS+=-${{ inputs.mkl-version }}
fi
fi
# Run the installation
echo "COMPONENTS: $COMPONENTS"
sudo apt-get install --no-install-recommends --no-install-suggests $COMPONENTS
- name: "Modify environment to use Intel compilers"
if: ${{ inputs.env-update }}
shell: ${{ inputs.shell }}
run: |
# Inject environment changes into $GITHUB_ENV
echo 'Updating $GITHUB_ENV'
bash -c "env > /tmp/before.txt"
bash -c ". /opt/intel/oneapi/setvars.sh && env > /tmp/after.txt"
diff --unchanged-line-format= --old-line-format= --new-line-format='%L' /tmp/before.txt /tmp/after.txt > /tmp/update.txt || true
cat /tmp/update.txt |& tee -a $GITHUB_ENV
if [ "${{ inputs.compiler-setup }}" == "oneapi" ]; then
echo -e "CC=icx\nCXX=icpx\nFC=ifx" >> $GITHUB_ENV
elif [ "${{ inputs.compiler-setup }}" == "classic" ]; then
echo -e "CC=icc\nCXX=icpc\nFC=ifort" >> $GITHUB_ENV
fi
if [ "${{ inputs.mpi-wrapper-setup }}" == "oneapi" ]; then
echo -e "CC=mpiicx\nCXX=mpiicpx\nFC=mpiifx" >> $GITHUB_ENV
echo -e "I_MPI_CC=icx\nI_MPI_CXX=icpx\nI_MPI_FC=ifx\nI_MPI_F77=ifx" >> $GITHUB_ENV
elif [ "${{ inputs.mpi-wrapper-setup }}" == "classic" ]; then
echo -e "CC=mpiicc\nCXX=mpiicpc\nFC=mpiifort" >> $GITHUB_ENV
echo -e "I_MPI_CC=icc\nI_MPI_CXX=icpc\nI_MPI_FC=ifort\nI_MPI_F77=ifort" >> $GITHUB_ENV
fi
echo "CI_INTEL_CLASSIC_VERSION=${{ inputs.classic-version }}" >> $GITHUB_ENV
echo "CI_INTEL_ONEAPI_VERSION=${{ inputs.oneapi-version }}" >> $GITHUB_ENV
echo "CI_INTEL_MPI_VERSION=${{ inputs.mpi-version }}" >> $GITHUB_ENV
echo "CI_INTEL_MKL_VERSION=${{ inputs.mkl-version }}" >> $GITHUB_ENV