-
Notifications
You must be signed in to change notification settings - Fork 2
/
install_oneapi_macos.sh
executable file
·51 lines (43 loc) · 1.95 KB
/
install_oneapi_macos.sh
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
#!/bin/bash
# This script installs the Fortran compilers provided in Intel OneAPI.
# See https://github.com/oneapi-src/oneapi-ci
# https://github.com/oneapi-src/oneapi-ci/blob/master/scripts/install_macos.sh
#
# Usage: sudo bash install_oneapi_macos.sh
#
# Zaikun Zhang (www.zhangzk.net), January 9, 2023
# URL for the offline installer of Intel OneAPI Fortran compiler. To get the latest URL, search for
# "Intel Fortran Compiler Classic for macOS" at
# https://www.intel.com/content/www/us/en/developer/articles/tool/oneapi-standalone-components.html
# and take the URL for the "Offline" installer.
# Default version: 2023.2.0 (updated on 20231015)
URL="https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2fbce033-15f4-4e13-8d14-f5a2016541ce/m_fortran-compiler-classic_p_2023.2.0.49001_offline.dmg"
if [[ $# -ge 1 ]] ; then
if [[ $1 = "2022" ]] ; then
URL="https://registrationcenter-download.intel.com/akdlm/irc_nas/18977/m_HPCKit_p_2022.3.1.15344_offline.dmg"
fi
if [[ $1 = "2021" ]] ; then
URL="https://registrationcenter-download.intel.com/akdlm/irc_nas/18242/m_HPCKit_p_2021.4.0.3389_offline.dmg"
fi
fi
# Component to install.
COMPONENTS=intel.oneapi.mac.ifort-compiler
# Download the installer. curl is included by default in macOS.
cd "$TMPDIR" || exit 42
curl --output webimage.dmg --url "$URL" --retry 5 --retry-delay 5
hdiutil attach webimage.dmg
# Install the compiler.
/Volumes/"$(basename "$URL" .dmg)"/bootstrapper.app/Contents/MacOS/bootstrapper -s --action install --components="$COMPONENTS" --eula=accept --log-dir=.
installer_exit_code=$?
# Run the script that sets the environment variables.
source /opt/intel/oneapi/setvars.sh
# Show the result of the installation.
echo "The latest ifort installed is:"
ifort --version
echo "The path to ifort is:"
command -v ifort
# Remove the installer
rm webimage.dmg
hdiutil detach /Volumes/"$(basename "$URL" .dmg)" -quiet
# Exit with the installer exit code.
exit $installer_exit_code