|
28 | 28 | Summary: OpenHPC compatibility package for Intel(R) oneAPI HPC Toolkit
|
29 | 29 | Name: %{pname}%{PROJ_DELIM}
|
30 | 30 | Version: 2024.0
|
31 |
| -Release: %{?dist}.1 |
| 31 | +Release: %{?dist}.2 |
32 | 32 | License: Apache-2.0
|
33 | 33 | URL: https://github.com/openhpc/ohpc
|
34 | 34 | Group: %{PROJ_NAME}/compiler-families
|
35 | 35 | BuildArch: x86_64
|
36 | 36 | AutoReq: no
|
37 | 37 | Source1: mod_generator.sh
|
38 | 38 | Source2: oneAPI.repo
|
| 39 | +Source3: ohpc-update-modules-intel |
39 | 40 |
|
40 | 41 |
|
41 | 42 | #!BuildIgnore: post-build-checks
|
@@ -70,13 +71,28 @@ install -D -m644 %{SOURCE2} -t %{buildroot}%{repodir}/
|
70 | 71 | # Mod generator for PSXE support
|
71 | 72 | install -D -m755 %{SOURCE1} %{buildroot}/%{OHPC_ADMIN}/compat/modulegen/mod_generator.sh
|
72 | 73 |
|
| 74 | +# Mod generator for oneAPI support |
| 75 | +sed -e 's/@@oneapi_manifest@@/%{oneapi_manifes}/' \ |
| 76 | + -e 's/@@OHPC_MODULEDEPS@@/%{OHPC_MODULEDEPS}/' \ |
| 77 | + -e 's/@@OHPC_MODULES@@/%{OHPC_MODULES}/' \ |
| 78 | + -e 's/@@exact_deps@@/%{exact_deps}/' \ |
| 79 | + -e 's/@@exact_intel_ver@@/%{exact_intel_ver}/' \ |
| 80 | + -e 's/@@exact_intel_ver_module@@/%{exact_intel_ver_module}/' \ |
| 81 | + -e 's/@@exact_mkl_ver@@/%{exact_mkl_ver}/' %{SOURCE3} > ohpc-update-modules-intel |
| 82 | +install -D -m755 ohpc-update-modules-intel %{buildroot}/%{OHPC_BIN}/ohpc-update-modules-intel |
| 83 | + |
73 | 84 | # Module directories
|
74 | 85 | mkdir -p %{buildroot}/%{OHPC_MODULEDEPS}/oneapi
|
75 | 86 | mkdir -p %{buildroot}/%{OHPC_MODULES}/intel
|
76 | 87 | mkdir -p %{buildroot}/%{OHPC_MODULEDEPS}/gnu/mkl
|
77 | 88 | mkdir -p %{buildroot}/%{OHPC_MODULEDEPS}/intel
|
78 | 89 |
|
79 | 90 |
|
| 91 | +# Regenerate module files when components are added or removed |
| 92 | +%transfiletriggerin -- /opt/intel/oneapi |
| 93 | +%{OHPC_BIN}/ohpc-update-modules-intel |
| 94 | + |
| 95 | + |
80 | 96 | %pre -p /bin/bash
|
81 | 97 | if ! [ -f /opt/intel/oneapi/modulefiles-setup.sh ]; then
|
82 | 98 | echo " "
|
|
87 | 103 |
|
88 | 104 |
|
89 | 105 | %post -p /bin/bash
|
90 |
| -# Do not overwrite existing files |
91 |
| -# Write the new file as rpmnew |
92 |
| -testfile () { |
93 |
| - if [ -e $1 ]; then |
94 |
| - echo "$1.rpmnew" |
95 |
| - else |
96 |
| - echo "$1" |
97 |
| - fi |
98 |
| -} |
99 |
| - |
100 |
| -rm -f %{oneapi_manifest} |
| 106 | +%{OHPC_BIN}/ohpc-update-modules-intel |
101 | 107 |
|
102 |
| -# Regenerate the oneAPI modules directory |
103 |
| -echo "Generating new oneAPI modulefiles" |
104 |
| -/opt/intel/oneapi/modulefiles-setup.sh --ignore-latest --force --output-dir=%{OHPC_MODULEDEPS}/oneapi/ > /dev/null |
105 |
| -if [ ! -d %{OHPC_MODULEDEPS}/oneapi/compiler ]; then |
106 |
| - echo "ERROR: Failed to create oneAPI module directory" |
107 |
| - exit 1 |
108 |
| -fi |
109 | 108 |
|
110 |
| -# Set system defaults for default OBS oneAPI modules |
111 |
| -for tool in %{exact_deps}; do |
112 |
| - filename=%{OHPC_MODULEDEPS}/oneapi/${tool%%/*}/.version |
113 |
| - echo "#%Module1.0" > ${filename} |
114 |
| - echo "set ModulesVersion \"${tool##*/}\"" >> ${filename} |
115 |
| -done |
116 |
| - |
117 |
| -# Create an OpenHPC module file for each version found in compilers |
118 |
| -echo "Creating OpenHPC-style modulefiles for local oneAPI compiler installation(s)." |
119 |
| -for compilers in %{OHPC_MODULEDEPS}/oneapi/compiler/2*; do |
120 |
| - ver=$(basename "$compilers") |
121 |
| - # Skip 2023.2.0 due to errors that can hang installer |
122 |
| - if [ "$ver" = "2023.2.0" ]; then |
123 |
| - echo "--> Skipping version=2023.2.0 : environment module format error" |
124 |
| - continue |
125 |
| - fi |
126 |
| - # For the default, also specify the MKL version |
127 |
| - if [ "$ver" = "%{exact_intel_ver}" ]; then |
128 |
| - mklver="mkl/%{exact_mkl_ver}" |
| 109 | +%preun -p /bin/bash |
| 110 | +if [ $1 -eq 0 ]; then |
| 111 | + # Check current files against the manifest |
| 112 | + # Remove files that match and backup files that don't |
| 113 | + if [ -s %{oneapi_manifest} ]; then |
| 114 | + echo "Removing module files" |
| 115 | + while IFS= read -r line; do |
| 116 | + f=${line%:*} |
| 117 | + s=${line#*:} |
| 118 | + if [ "${s: -2}" = "OK" ]; then |
| 119 | + rm -f $f |
| 120 | + elif [ -f $f ]; then |
| 121 | + mv -T -f $f $f.rpmsave |
| 122 | + fi |
| 123 | + done <<< $(md5sum --check %{oneapi_manifest}) |
129 | 124 | else
|
130 |
| - mklver="mkl" |
| 125 | + # Don't touch any generated files if there's no manifest |
| 126 | + # On upgrade, expect lots of modulefiles created as .rpmnew |
| 127 | + echo "WARNING: Manifest not found. Previously generated" |
| 128 | + echo " modulefiles will not be removed or moved." |
131 | 129 | fi
|
132 |
| - echo "--> Installing modulefile for version=${ver}" |
133 |
| - # Do not overwrite existing files |
134 |
| - # Write the new file as rpmnew |
135 |
| - modname=$(testfile %{OHPC_MODULES}/intel/$ver) |
136 |
| - |
137 |
| - cat << EOF > ${modname} |
138 |
| -#%Module1.0##################################################################### |
139 |
| - |
140 |
| -set version "$ver" |
141 |
| - |
142 |
| -proc ModulesHelp { } { |
143 |
| -global version |
144 |
| -puts stderr "\nThis module loads the oneAPI compiler environment.\n" |
145 |
| -puts stderr "\nSee the man pages for icc, icpc, and ifort for detailed information" |
146 |
| -puts stderr "on available compiler options and command-line syntax." |
147 |
| -puts stderr "\nVersion \$version\n" |
148 |
| -} |
149 |
| - |
150 |
| -module-whatis "Name: Intel(R) Compiler" |
151 |
| -module-whatis "Version: \$version" |
152 |
| -module-whatis "Category: compiler, runtime support" |
153 |
| -module-whatis "Description: Intel(R) Compiler Family (C/C++/Fortran for x86_64)" |
154 |
| -module-whatis "URL: http://software.intel.com/en-us/articles/intel-compilers/" |
155 |
| - |
156 |
| -# update module path hierarchy |
157 |
| -prepend-path MODULEPATH %{OHPC_MODULEDEPS}/intel |
158 |
| -prepend-path MODULEPATH %{OHPC_MODULEDEPS}/oneapi |
159 |
| - |
160 |
| -# Assume no PAC device; allow override on each node |
161 |
| -if { ![info exists ::env(ACL_SKIP_BSP_CONF)] } { |
162 |
| - setenv ACL_SKIP_BSP_CONF 1 |
163 |
| -} |
164 |
| - |
165 |
| -module load "oclfpga" |
166 |
| -module load "tbb" |
167 |
| -module load "compiler-rt" |
168 |
| -module load "compiler/\$version" |
169 |
| -module load "$mklver" |
170 |
| - |
171 |
| -family "compiler" |
172 |
| -EOF |
173 |
| - |
174 |
| - md5sum ${modname} >> %{oneapi_manifest} |
175 |
| - |
176 |
| - # Provide standalone module for use with GNU toolchain |
177 |
| - modname=$(testfile %{OHPC_MODULEDEPS}/gnu/mkl/$ver) |
178 |
| - |
179 |
| - cat << EOF > ${modname} |
180 |
| -#%Module1.0##################################################################### |
181 |
| - |
182 |
| -set version "$ver" |
183 |
| - |
184 |
| -proc ModulesHelp { } { |
185 |
| -global version |
186 |
| -puts stderr "\nConfigures oneAPI MKL environment\n" |
187 |
| -puts stderr "\$version\n" |
188 |
| -} |
189 |
| - |
190 |
| -module-whatis "Name: Intel(R) Math Kernel Library" |
191 |
| -module-whatis "Version: \$version" |
192 |
| -module-whatis "Category: library, runtime support" |
193 |
| -module-whatis "Description: Intel(R) Math Kernel Library for C/C++ and Fortran" |
194 |
| -module-whatis "URL: https://software.intel.com/en-us/en-us/intel-mkl" |
195 |
| - |
196 |
| -prepend-path MODULEPATH %{OHPC_MODULEDEPS}/oneapi |
197 |
| -module load "$mklver" |
198 |
| -EOF |
199 |
| - |
200 |
| - md5sum ${modname} >> %{oneapi_manifest} |
201 |
| -done |
202 |
| - |
203 |
| -# Set default version to match that used to build OpenHPC packages |
204 |
| -modname=$(testfile %{OHPC_MODULES}/intel/.version) |
205 |
| - |
206 |
| -cat << EOF > ${modname} |
207 |
| -#%Module1.0##################################################################### |
208 |
| -set ModulesVersion "%{exact_intel_ver_module}" |
209 |
| -EOF |
210 |
| - |
211 |
| -md5sum ${modname} >> %{oneapi_manifest} |
212 |
| - |
213 |
| - |
214 |
| -%preun -p /bin/bash |
215 |
| -# Check current files against the manifest |
216 |
| -# Remove files that match and backup files that don't |
217 |
| -if [ -s %{oneapi_manifest} ]; then |
218 |
| - echo "Removing module files" |
219 |
| - while IFS= read -r line; do |
220 |
| - f=${line%:*} |
221 |
| - s=${line#*:} |
222 |
| - if [ "${s: -2}" = "OK" ]; then |
223 |
| - rm -f $f |
224 |
| - elif [ -f $f ]; then |
225 |
| - mv -T -f $f $f.rpmsave |
226 |
| - fi |
227 |
| - done <<< $(md5sum --check %{oneapi_manifest}) |
228 |
| -else |
229 |
| - # Don't touch any generated files if there's no manifest |
230 |
| - # On upgrade, expect lots of modulefiles created as .rpmnew |
231 |
| - echo "WARNING: Manifest not found. Previously generated" |
232 |
| - echo " modulefiles will not be removed or moved." |
| 130 | + # Remove the generated oneAPI module links, remove directories if empty |
| 131 | + echo "Removing oneAPI module directory" |
| 132 | + find %{OHPC_MODULEDEPS}/oneapi -type l -delete || true |
| 133 | + find %{OHPC_MODULEDEPS}/oneapi/* -empty -type d -delete || true |
233 | 134 | fi
|
234 |
| -# Remove the generated oneAPI module links, remove directories if empty |
235 |
| -echo "Removing oneAPI module directory" |
236 |
| -find %{OHPC_MODULEDEPS}/oneapi -type l -delete || true |
237 |
| -find %{OHPC_MODULEDEPS}/oneapi/* -empty -type d -delete || true |
238 | 135 |
|
239 | 136 |
|
240 | 137 | %files
|
| 138 | +%{OHPC_BIN}/ohpc-update-modules-intel |
241 | 139 | %dir %{OHPC_MODULES}/intel
|
242 | 140 | %dir %{OHPC_MODULEDEPS}/oneapi
|
243 | 141 | %dir %{OHPC_MODULEDEPS}/intel
|
|
0 commit comments