|
|
@ -21,15 +21,20 @@ intel_key_url='https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-P
|
|
|
|
Usage () {
|
|
|
|
Usage () {
|
|
|
|
cat >&2 <<EOF
|
|
|
|
cat >&2 <<EOF
|
|
|
|
Usage: $0 [-s] [<MKL-package>]
|
|
|
|
Usage: $0 [-s] [<MKL-package>]
|
|
|
|
|
|
|
|
|
|
|
|
Checks if MKL is present on the system, and/or attempts to install it.
|
|
|
|
Checks if MKL is present on the system, and/or attempts to install it.
|
|
|
|
|
|
|
|
|
|
|
|
If <MKL-package> is not provided, ${default_package} will be installed.
|
|
|
|
If <MKL-package> is not provided, ${default_package} will be installed.
|
|
|
|
|
|
|
|
|
|
|
|
Intel packages are installed under the /opt/intel directory. You should be root
|
|
|
|
Intel packages are installed under the /opt/intel directory. You should be root
|
|
|
|
to install MKL into this directory; run this script using the sudo command.
|
|
|
|
to install MKL into this directory; run this script using the sudo command.
|
|
|
|
|
|
|
|
|
|
|
|
Options:
|
|
|
|
Options:
|
|
|
|
-s - Skip check for MKL being already present.
|
|
|
|
-s - Skip check for MKL being already present.
|
|
|
|
-p <suse|redhat|debian|fedora|arch> -- Force type of package management. Use only
|
|
|
|
-p <suse|redhat|debian|fedora|arch> -- Force type of package management. Use only
|
|
|
|
if automatic detection fails, as instructed.
|
|
|
|
if automatic detection fails, as instructed.
|
|
|
|
-h - Show this message.
|
|
|
|
-h - Show this message.
|
|
|
|
|
|
|
|
|
|
|
|
Environment:
|
|
|
|
Environment:
|
|
|
|
CC The C compiler to use for MKL check. If not set, uses 'cc'.
|
|
|
|
CC The C compiler to use for MKL check. If not set, uses 'cc'.
|
|
|
|
EOF
|
|
|
|
EOF
|
|
|
@ -64,6 +69,7 @@ package=${1:-$default_package}
|
|
|
|
# Check that we are actually on Linux, otherwise give a helpful reference.
|
|
|
|
# Check that we are actually on Linux, otherwise give a helpful reference.
|
|
|
|
[[ $(uname) == Linux ]] || Fatal "\
|
|
|
|
[[ $(uname) == Linux ]] || Fatal "\
|
|
|
|
This script can be used on Linux only, and your system is $(uname).
|
|
|
|
This script can be used on Linux only, and your system is $(uname).
|
|
|
|
|
|
|
|
|
|
|
|
Installer packages for Mac and Windows are available for download from Intel:
|
|
|
|
Installer packages for Mac and Windows are available for download from Intel:
|
|
|
|
https://software.intel.com/mkl/choose-download"
|
|
|
|
https://software.intel.com/mkl/choose-download"
|
|
|
|
|
|
|
|
|
|
|
@ -72,6 +78,7 @@ if [[ ! $skip_cc ]]; then
|
|
|
|
: ${CC:=cc}
|
|
|
|
: ${CC:=cc}
|
|
|
|
Have "$CC" || Fatal "\
|
|
|
|
Have "$CC" || Fatal "\
|
|
|
|
C compiler $CC not found.
|
|
|
|
C compiler $CC not found.
|
|
|
|
|
|
|
|
|
|
|
|
You can skip the check for MKL presence by invoking this script with the '-s'
|
|
|
|
You can skip the check for MKL presence by invoking this script with the '-s'
|
|
|
|
option to this script, but you will need a functional compiler anyway, so we
|
|
|
|
option to this script, but you will need a functional compiler anyway, so we
|
|
|
|
recommend that you install it first."
|
|
|
|
recommend that you install it first."
|
|
|
@ -81,18 +88,22 @@ if [[ ! $skip_cc ]]; then
|
|
|
|
__INTEL_MKL__.__INTEL_MKL_MINOR__.__INTEL_MKL_UPDATE__' 2>/dev/null |
|
|
|
|
__INTEL_MKL__.__INTEL_MKL_MINOR__.__INTEL_MKL_UPDATE__' 2>/dev/null |
|
|
|
|
tail -n 1 ) || mkl_version=
|
|
|
|
tail -n 1 ) || mkl_version=
|
|
|
|
mkl_version=${mkl_version// /}
|
|
|
|
mkl_version=${mkl_version// /}
|
|
|
|
|
|
|
|
|
|
|
|
[[ $mkl_version ]] && Fatal "\
|
|
|
|
[[ $mkl_version ]] && Fatal "\
|
|
|
|
MKL version $mkl_version is already installed.
|
|
|
|
MKL version $mkl_version is already installed.
|
|
|
|
|
|
|
|
|
|
|
|
You can skip the check for MKL presence by invoking this script with the '-s'
|
|
|
|
You can skip the check for MKL presence by invoking this script with the '-s'
|
|
|
|
option and proceed with automated installation, but we highly discourage
|
|
|
|
option and proceed with automated installation, but we highly discourage
|
|
|
|
this. This script will register Intel repositories with your system, and it
|
|
|
|
this. This script will register Intel repositories with your system, and it
|
|
|
|
seems that they have been already registered, or MKL has been installed some
|
|
|
|
seems that they have been already registered, or MKL has been installed some
|
|
|
|
other way.
|
|
|
|
other way.
|
|
|
|
|
|
|
|
|
|
|
|
You should use your package manager to check which MKL package is already
|
|
|
|
You should use your package manager to check which MKL package is already
|
|
|
|
installed. Note that Intel packages register the latest installed version of
|
|
|
|
installed. Note that Intel packages register the latest installed version of
|
|
|
|
the library as the default. If your installed version is older than
|
|
|
|
the library as the default. If your installed version is older than
|
|
|
|
$package, it makes sense to upgrade."
|
|
|
|
$package, it makes sense to upgrade."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Try to determine which package manager the distro uses, unless overridden.
|
|
|
|
# Try to determine which package manager the distro uses, unless overridden.
|
|
|
|
if [[ ! $distro ]]; then
|
|
|
|
if [[ ! $distro ]]; then
|
|
|
|
dist_vars=$(cat /etc/os-release 2>/dev/null)
|
|
|
|
dist_vars=$(cat /etc/os-release 2>/dev/null)
|
|
|
@ -104,6 +115,7 @@ if [[ ! $distro ]]; then
|
|
|
|
redhat|suse|fedora|debian|arch) distro=$rune; break;;
|
|
|
|
redhat|suse|fedora|debian|arch) distro=$rune; break;;
|
|
|
|
esac
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Certain old distributions do not have /etc/os-release. We are unlikely to
|
|
|
|
# Certain old distributions do not have /etc/os-release. We are unlikely to
|
|
|
|
# encounter these in the wild, but just in case.
|
|
|
|
# encounter these in the wild, but just in case.
|
|
|
|
# NOTE: Do not try to guess Fedora specifically here! Fedora 20 and below
|
|
|
|
# NOTE: Do not try to guess Fedora specifically here! Fedora 20 and below
|
|
|
@ -112,29 +124,38 @@ if [[ ! $distro ]]; then
|
|
|
|
[[ ! $distro && -f /etc/SuSE-release ]] && distro=suse
|
|
|
|
[[ ! $distro && -f /etc/SuSE-release ]] && distro=suse
|
|
|
|
[[ ! $distro && -f /etc/debian_release ]] && distro=debian
|
|
|
|
[[ ! $distro && -f /etc/debian_release ]] && distro=debian
|
|
|
|
[[ ! $distro && -f /etc/arch-release ]] && distro=arch
|
|
|
|
[[ ! $distro && -f /etc/arch-release ]] && distro=arch
|
|
|
|
|
|
|
|
|
|
|
|
[[ ! $distro ]] && Fatal "\
|
|
|
|
[[ ! $distro ]] && Fatal "\
|
|
|
|
Unable to determine package management style.
|
|
|
|
Unable to determine package management style.
|
|
|
|
|
|
|
|
|
|
|
|
Invoke this script with the option '-p <style>', where <style> can be:
|
|
|
|
Invoke this script with the option '-p <style>', where <style> can be:
|
|
|
|
redhat -- RedHat-like, uses yum and rpm for package management.
|
|
|
|
redhat -- RedHat-like, uses yum and rpm for package management.
|
|
|
|
fedora -- Fedora 22+, also RedHat-like, but uses dnf instead of yum.
|
|
|
|
fedora -- Fedora 22+, also RedHat-like, but uses dnf instead of yum.
|
|
|
|
suse -- SUSE-like, uses zypper and rpm.
|
|
|
|
suse -- SUSE-like, uses zypper and rpm.
|
|
|
|
debian -- Debian-like, uses apt and dpkg.
|
|
|
|
debian -- Debian-like, uses apt and dpkg.
|
|
|
|
arch -- Archlinux, uses pacman.
|
|
|
|
arch -- Archlinux, uses pacman.
|
|
|
|
|
|
|
|
|
|
|
|
We do not currently support other package management systems. Check the Intel's
|
|
|
|
We do not currently support other package management systems. Check the Intel's
|
|
|
|
documentation at https://software.intel.com/mkl/choose-download for other
|
|
|
|
documentation at https://software.intel.com/mkl/choose-download for other
|
|
|
|
install options."
|
|
|
|
install options."
|
|
|
|
|
|
|
|
|
|
|
|
echo >&2 "$0: Your system is using ${distro}-style package management."
|
|
|
|
echo >&2 "$0: Your system is using ${distro}-style package management."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Check for root.
|
|
|
|
# Check for root.
|
|
|
|
if [[ "$(id -u)" -ne 0 ]]; then
|
|
|
|
if [[ "$(id -u)" -ne 0 ]]; then
|
|
|
|
echo >&2 "$0: You must be root to install MKL.
|
|
|
|
echo >&2 "$0: You must be root to install MKL.
|
|
|
|
|
|
|
|
|
|
|
|
Restart this script using the 'sudo' command, as:
|
|
|
|
Restart this script using the 'sudo' command, as:
|
|
|
|
|
|
|
|
|
|
|
|
sudo $0 -sp $distro $package
|
|
|
|
sudo $0 -sp $distro $package
|
|
|
|
|
|
|
|
|
|
|
|
We recommend adding the '-sp $distro' options to skip the MKL and distro
|
|
|
|
We recommend adding the '-sp $distro' options to skip the MKL and distro
|
|
|
|
detection, since this has already been done. This minimizes the number of
|
|
|
|
detection, since this has already been done. This minimizes the number of
|
|
|
|
programs invoked with the root privileges to keep your system safe from
|
|
|
|
programs invoked with the root privileges to keep your system safe from
|
|
|
|
unexpected or erroneous changes. Also, if you are setting the CC environment
|
|
|
|
unexpected or erroneous changes. Also, if you are setting the CC environment
|
|
|
|
variable, sudo might not allow it to propagate to the command that it invokes."
|
|
|
|
variable, sudo might not allow it to propagate to the command that it invokes."
|
|
|
|
|
|
|
|
|
|
|
|
if [ -t 0 ]; then
|
|
|
|
if [ -t 0 ]; then
|
|
|
|
echo; read -ep "Run the above sudo command now? [Y/n]:"
|
|
|
|
echo; read -ep "Run the above sudo command now? [Y/n]:"
|
|
|
|
case $REPLY in
|
|
|
|
case $REPLY in
|
|
|
@ -143,6 +164,7 @@ if [[ "$(id -u)" -ne 0 ]]; then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
exit 0
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# The install variants, each in a function to simplify error reporting.
|
|
|
|
# The install variants, each in a function to simplify error reporting.
|
|
|
|
# Each one invokes a subshell with a 'set -x' to to show system-modifying
|
|
|
|
# Each one invokes a subshell with a 'set -x' to to show system-modifying
|
|
|
|
# commands it runs. The subshells simply limit the scope of this diagnostics
|
|
|
|
# commands it runs. The subshells simply limit the scope of this diagnostics
|
|
|
@ -155,6 +177,7 @@ Install_redhat () {
|
|
|
|
yum-config-manager --add-repo "$yum_repo" &&
|
|
|
|
yum-config-manager --add-repo "$yum_repo" &&
|
|
|
|
yum -y install "$package" )
|
|
|
|
yum -y install "$package" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Install_fedora () {
|
|
|
|
Install_fedora () {
|
|
|
|
( set -x
|
|
|
|
( set -x
|
|
|
|
rpm --import $intel_key_url
|
|
|
|
rpm --import $intel_key_url
|
|
|
@ -162,6 +185,7 @@ Install_fedora () {
|
|
|
|
dnf config-manager --add-repo "$yum_repo" &&
|
|
|
|
dnf config-manager --add-repo "$yum_repo" &&
|
|
|
|
dnf -y install "$package" )
|
|
|
|
dnf -y install "$package" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Install_suse () {
|
|
|
|
Install_suse () {
|
|
|
|
# zypper bug until libzypp-17.6.4: '--gpg-auto-import-keys' is ignored.
|
|
|
|
# zypper bug until libzypp-17.6.4: '--gpg-auto-import-keys' is ignored.
|
|
|
|
# See https://github.com/openSUSE/zypper/issues/144#issuecomment-418685933
|
|
|
|
# See https://github.com/openSUSE/zypper/issues/144#issuecomment-418685933
|
|
|
@ -173,20 +197,24 @@ Install_suse () {
|
|
|
|
zypper --gpg-auto-import-keys --no-gpg-checks \
|
|
|
|
zypper --gpg-auto-import-keys --no-gpg-checks \
|
|
|
|
--non-interactive install "$package" )
|
|
|
|
--non-interactive install "$package" )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Install_debian () {
|
|
|
|
Install_debian () {
|
|
|
|
local keyring='/usr/share/keyrings/intel-sw-products.gpg' \
|
|
|
|
local keyring='/usr/share/keyrings/intel-sw-products.gpg' \
|
|
|
|
sources_d='/etc/apt/sources.list.d' \
|
|
|
|
sources_d='/etc/apt/sources.list.d' \
|
|
|
|
trusted_d='/etc/apt/trusted.gpg.d' \
|
|
|
|
trusted_d='/etc/apt/trusted.gpg.d' \
|
|
|
|
apt_maj= apt_min= apt_ver=
|
|
|
|
apt_maj= apt_min= apt_ver=
|
|
|
|
|
|
|
|
|
|
|
|
# apt before 1.2 does not understand the signed-by option, and always
|
|
|
|
# apt before 1.2 does not understand the signed-by option, and always
|
|
|
|
# look for the keyring in their trusted.gpg.d directory. This is not
|
|
|
|
# look for the keyring in their trusted.gpg.d directory. This is not
|
|
|
|
# considered a good security practice any more. If apt is old, add a link
|
|
|
|
# considered a good security practice any more. If apt is old, add a link
|
|
|
|
# to the keyring file and remind the user to delete it when apt is upgraded.
|
|
|
|
# to the keyring file and remind the user to delete it when apt is upgraded.
|
|
|
|
IFS=' .' builtin read _ apt_maj apt_min _ < <(apt-get --version)
|
|
|
|
IFS=' .' builtin read _ apt_maj apt_min _ < <(apt-get --version)
|
|
|
|
apt_ver=$(builtin printf '%03d%03d' $apt_maj $apt_min)
|
|
|
|
apt_ver=$(builtin printf '%03d%03d' $apt_maj $apt_min)
|
|
|
|
|
|
|
|
|
|
|
|
# Get alternative location of /etc/apt/sources.list.d, if so configured.
|
|
|
|
# Get alternative location of /etc/apt/sources.list.d, if so configured.
|
|
|
|
eval $(apt-config shell sources_d Dir::Etc::sourceparts/f \
|
|
|
|
eval $(apt-config shell sources_d Dir::Etc::sourceparts/f \
|
|
|
|
trusted_d Dir::Etc::trustedparts/f)
|
|
|
|
trusted_d Dir::Etc::trustedparts/f)
|
|
|
|
|
|
|
|
|
|
|
|
# apt is much more involved to configure than other package managers, as fas
|
|
|
|
# apt is much more involved to configure than other package managers, as fas
|
|
|
|
# as third-party security keys go.
|
|
|
|
# as third-party security keys go.
|
|
|
|
( set -x;
|
|
|
|
( set -x;
|
|
|
@ -195,30 +223,37 @@ Install_debian () {
|
|
|
|
wget -qO- $intel_key_url | apt-key --keyring $keyring add - &&
|
|
|
|
wget -qO- $intel_key_url | apt-key --keyring $keyring add - &&
|
|
|
|
echo "deb [signed-by=${keyring}] $apt_repo all main" \
|
|
|
|
echo "deb [signed-by=${keyring}] $apt_repo all main" \
|
|
|
|
> "$sources_d/intel-mkl.list" ) || return 1
|
|
|
|
> "$sources_d/intel-mkl.list" ) || return 1
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $apt_ver < '001002' ]]; then
|
|
|
|
if [[ $apt_ver < '001002' ]]; then
|
|
|
|
( set -x; ln -s "$keyring" "${trusted_d}/" ) || return 1
|
|
|
|
( set -x; ln -s "$keyring" "${trusted_d}/" ) || return 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
( set +x
|
|
|
|
( set +x
|
|
|
|
apt-get update &&
|
|
|
|
apt-get update &&
|
|
|
|
apt-get install -y "$package" ) || return 1
|
|
|
|
apt-get install -y "$package" ) || return 1
|
|
|
|
|
|
|
|
|
|
|
|
# Print the message after the large install, so the user may notice. I hope...
|
|
|
|
# Print the message after the large install, so the user may notice. I hope...
|
|
|
|
if [[ $apt_ver < '001002' ]]; then
|
|
|
|
if [[ $apt_ver < '001002' ]]; then
|
|
|
|
echo >&2 "$0: Your apt-get version is earlier than 1.2.
|
|
|
|
echo >&2 "$0: Your apt-get version is earlier than 1.2.
|
|
|
|
|
|
|
|
|
|
|
|
This version does not understand individual repositories signing keys, and
|
|
|
|
This version does not understand individual repositories signing keys, and
|
|
|
|
trusts all keys in $trusted_d. We have created a link
|
|
|
|
trusts all keys in $trusted_d. We have created a link
|
|
|
|
$trusted_d/$(basename $keyring) pointing to the file
|
|
|
|
$trusted_d/$(basename $keyring) pointing to the file
|
|
|
|
$keyring. If/when you upgrade your system to
|
|
|
|
$keyring. If/when you upgrade your system to
|
|
|
|
a higher version of apt, removing this link will help make it more secure.
|
|
|
|
a higher version of apt, removing this link will help make it more secure.
|
|
|
|
|
|
|
|
|
|
|
|
This is not considered a severe security issue, but separating keyrings is the
|
|
|
|
This is not considered a severe security issue, but separating keyrings is the
|
|
|
|
current recommended security practice."
|
|
|
|
current recommended security practice."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Install_arch () {
|
|
|
|
Install_arch () {
|
|
|
|
( set -x
|
|
|
|
( set -x
|
|
|
|
echo y | pacman -Syu intel-mkl && # In pacman we don't specify the version
|
|
|
|
echo y | pacman -Syu intel-mkl && # In pacman we don't specify the version
|
|
|
|
pacman -Q --info intel-mkl | grep -v None
|
|
|
|
pacman -Q --info intel-mkl | grep -v None
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Register MKL .so libraries with the ld.so.
|
|
|
|
# Register MKL .so libraries with the ld.so.
|
|
|
|
ConfigLdSo() {
|
|
|
|
ConfigLdSo() {
|
|
|
|
[ -d /etc/ld.so.conf.d ] || return 0
|
|
|
|
[ -d /etc/ld.so.conf.d ] || return 0
|
|
|
@ -230,11 +265,13 @@ ConfigLdSo() {
|
|
|
|
/opt/intel/mkl/lib/intel64"
|
|
|
|
/opt/intel/mkl/lib/intel64"
|
|
|
|
ldconfig )
|
|
|
|
ldconfig )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Invoke installation.
|
|
|
|
# Invoke installation.
|
|
|
|
if Install_${distro} && ConfigLdSo; then
|
|
|
|
if Install_${distro} && ConfigLdSo; then
|
|
|
|
echo >&2 "$0: MKL package $package was successfully installed"
|
|
|
|
echo >&2 "$0: MKL package $package was successfully installed"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
Fatal "MKL package $package installation FAILED.
|
|
|
|
Fatal "MKL package $package installation FAILED.
|
|
|
|
|
|
|
|
|
|
|
|
Please open an issue with us at https://github.com/kaldi-asr/kaldi/ if you
|
|
|
|
Please open an issue with us at https://github.com/kaldi-asr/kaldi/ if you
|
|
|
|
believe this is a bug."
|
|
|
|
believe this is a bug."
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|