Giter Site home page Giter Site logo

mkl4deb's Introduction

Please note: This is an inactive repository preserved as a starting point in case someone want to revisit or study the script. Please see the appendix below -- you likely want the MKL now included in your distro instead of following this by now rather old script.

MKL for .deb-based systems: An easy recipe

This post describes how to easily install the Intel Math Kernel Library (MKL) on a Debian or Ubuntu system. Very good basic documentation is provided by Intel at their site. The discussion here is more narrow as it focusses just on the Math Kernel Library (MKL).

The tl;dr version: Use this script which contains the commands described here.

First Step: Set up apt

We download the GnuPG key first and add it to the keyring:

cd /tmp
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

To add all Intel products we would run first command, but here we focus just on the MKL. The website above lists other suboptions (TBB, DAAL, MPI, ...)

## all products:
#wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list

## just MKL
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'

We then update our lists of what is available in the repositories.

apt-get update
As a personal aside, I still use the awesome `wajig` frontend to `dpkg`, `apt` and more by [Graham Williams](https://togaware.com/about/graham-williams/) (of [rattle](https://cran.r-project.org/package=rattle) fame). Among other tricks, `wajig` keeps state and therefore "knows" what packages are new. Here, we see _a lot_:
edd@rob:/tmp$ wajig update
Hit:1 http://us.archive.ubuntu.com/ubuntu artful InRelease
Ign:2 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://us.archive.ubuntu.com/ubuntu artful-updates InRelease
Hit:4 https://download.docker.com/linux/ubuntu artful InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu artful-backports InRelease
Ign:6 https://cloud.r-project.org/bin/linux/ubuntu artful/ InRelease
Hit:7 https://cloud.r-project.org/bin/linux/ubuntu artful/ Release
Hit:8 http://security.ubuntu.com/ubuntu artful-security InRelease
Hit:9 https://apt.repos.intel.com/mkl all InRelease
Hit:10 http://dl.google.com/linux/chrome/deb stable Release
Hit:12 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Reading package lists... Done
This is 367 up on the previous count with 367 new packages.
edd@rob:/tmp$ wajig new
Package                  Description
========================-===================================================
intel-mkl-gnu-f-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-gnu-f-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-cluster-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-gnu-c-196      Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-cluster-c-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-f-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-cluster-rt-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-gnu-239        Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-openmp-l-ps-libs-32bit-jp-174 OpenMP for Intel(R) Compilers 17.0 Update 2 for Linux*
intel-mkl-doc-ps-2018    Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-pgi-rt-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-ss-tbb-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-mic-cluster-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-openmp-l-ps-libs-jp-196 OpenMP for Intel(R) Compilers 17.0 Update 4 for Linux*
intel-mkl-ps-mic-rt-174  Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-openmp-l-ps-libs-jp-239 OpenMP for Intel(R) Compilers 17.0 Update 5 for Linux*
intel-mkl-common-f-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-f95-mic-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-common-64bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-f95-common-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-psxe-common-2018.2-046 Intel(R) Parallel Studio XE 2018 Update 2 for Linux*
intel-mkl-ps-mic-cluster-rt-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-cluster-64bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-f95-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-cluster-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-gnu-rt-196     Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-tbb-libs-2018.0-128 Intel(R) Threading Building Blocks 2018 for Linux*
intel-comp-l-all-vars-196 Intel(R) Compilers 17.0 Update 4 for Linux*
intel-mkl-common-ps-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-pgi-f-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-f95-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-gnu-rt-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-openmp-18.0.0-128  OpenMP for Intel(R) Compilers 18.0 for Linux*
intel-mkl-common-c-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-ps-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-f95-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-f95-mic-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-common-c-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-cluster-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-doc-f-jp    Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-f-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-32bit-2018.1-038 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-common-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-openmp-l-all-196   OpenMP for Intel(R) Compilers 17.0 Update 4 for Linux*
intel-mkl-pgi-rt-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-common-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-comp-nomcu-vars-18.0.0-128 Intel(R) Compilers 18.0 for Linux*
intel-mkl-common-c-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-f-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-common-c-64bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-32bit-174  Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-common-ps-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-cluster-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-gnu-f-rt-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-cluster-f-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-common-c-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-ss-tbb-196  Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-tbb-libs-32bit-2018.0-128 Intel(R) Threading Building Blocks 2018 for Linux*
intel-mkl-gnu-c-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-tbb-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-tbb-libs-2018.1-163 Intel(R) Threading Building Blocks 2018 Update 1 for Linux*
intel-mkl-ps-common-f-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-ss-tbb-rt-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-196            Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-pgi-196     Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-psxe-2018.2-046 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-doc-c          Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-f95-196     Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-cluster-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-tbb-libs-174       Intel(R) Threading Building Blocks 2017 Update 4 for Linux*
intel-comp-l-all-vars-174 Intel(R) Compilers 17.0 Update 2 for Linux*
intel-mkl-gnu-f-rt-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-gnu-rt-174     Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-openmp-l-ps-libs-32bit-jp-196 OpenMP for Intel(R) Compilers 17.0 Update 4 for Linux*
intel-mkl-gnu-f-rt-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-openmp-18.0.1-163  OpenMP for Intel(R) Compilers 18.0 Update 1 for Linux*
intel-mkl-ps-cluster-64bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-c-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-pgi-rt-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-2018.2-046     Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-gnu-rt-239     Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-rt-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-comp-l-all-vars-18.0.0-128 Intel(R) Compilers 18.0 for Linux*
intel-mkl-ps-common-jp-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-openmp-32bit-18.0.0-128 OpenMP for Intel(R) Compilers 18.0 for Linux*
intel-mkl-f95-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-core-ps-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-gnu-f-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-tbb-mic-rt-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-psxe-2018.1-038 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-gnu-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-mic-174     Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-64bit-2017.4-061 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-f95-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-mic-rt-jp-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-196        Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-psxe-common-doc-2018 Intel(R) Parallel Studio XE 2018 Update 2 for Linux*
intel-mkl-ps-tbb-mic-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-c-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-core-c-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-cluster-rt-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-rt-jp-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-core-c-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-ss-tbb-rt-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-core-f-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-psxe-050       Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-64bit-2018.2-046 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-tbb-rt-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-ss-tbb-rt-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-doc-f       Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-c-174      Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-f95-common-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-rt-jp-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-gnu-f-rt-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-pgi-f-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-tbb-libs-32bit-2018.1-163 Intel(R) Threading Building Blocks 2018 Update 1 for Linux*
intel-mkl-common-c-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-gnu-rt-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-64bit-2018.0-033 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-mic-c-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-ss-tbb-239  Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-64bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-openmp-32bit-18.0.2-199 OpenMP for Intel(R) Compilers 18.0 Update 2 for Linux*
intel-mkl-ps-rt-jp-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-f-rt-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-common-jp-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-tbb-mic-rt-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-psxe-common-061    Intel(R) Parallel Studio XE 2017 Update 5 for Linux*
intel-mkl-gnu-rt-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-common-f-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-mic-cluster-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-common-f-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-tbb-libs-196       Intel(R) Threading Building Blocks 2017 Update 6 for Linux*
intel-mkl-cluster-rt-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-cluster-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-pgi-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-ss-tbb-rt-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-openmp-l-all-174   OpenMP for Intel(R) Compilers 17.0 Update 2 for Linux*
intel-mkl-tbb-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-pgi-c-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-64bit-2018.1-038 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-f95-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-gnu-c-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-239            Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-pgi-rt-174  Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-cluster-f-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-f95-common-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-f-64bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-cluster-common-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-cluster-f-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-common-jp-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-openmp-l-all-32bit-196 OpenMP for Intel(R) Compilers 17.0 Update 4 for Linux*
intel-mkl-tbb-rt-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-psxe-common-056    Intel(R) Parallel Studio XE 2017 Update 4 for Linux*
intel-mkl-32bit-2018.0-033 Intel(R) Math Kernel Library 2018 for Linux*
intel-comp-l-all-vars-18.0.2-199 Intel(R) Compilers 18.0 Update 2 for Linux*
intel-mkl-common-ps-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-core-rt-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-pgi-c-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-common-c-ps-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-gnu-f-rt-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-f95-common-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-openmp-l-all-239   OpenMP for Intel(R) Compilers 17.0 Update 5 for Linux*
intel-mkl-174            Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-f-rt-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-tbb-libs-239       Intel(R) Threading Building Blocks 2017 Update 8 for Linux*
intel-mkl-common-f-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-common-f-64bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-cluster-common-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-comp-nomcu-vars-18.0.2-199 Intel(R) Compilers 18.0 Update 2 for Linux*
intel-mkl-32bit-196      Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-gnu-f-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-ps-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-common-196     Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-rt-174         Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-rt-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-common-f-64bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-cluster-rt-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-cluster-c-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-gnu-rt-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-doc         Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-rt-32bit-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-openmp-l-ps-libs-174 OpenMP for Intel(R) Compilers 17.0 Update 2 for Linux*
intel-mkl-ps-cluster-rt-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-common-64bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-c-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-pgi-c-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-gnu-f-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-pgi-f-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-f-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-core-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-common-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-pgi-c-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-rt-jp-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-common-c-64bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-gnu-f-rt-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-pgi-c-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-f-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-32bit-239      Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-rt-jp-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-mic-239     Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-tbb-libs-2018.2-199 Intel(R) Threading Building Blocks 2018 Update 2 for Linux*
intel-mkl-f95-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-openmp-l-ps-libs-239 OpenMP for Intel(R) Compilers 17.0 Update 5 for Linux*
intel-mkl-rt-239         Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-core-c-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-openmp-l-all-32bit-174 OpenMP for Intel(R) Compilers 17.0 Update 2 for Linux*
intel-mkl-ps-pgi-239     Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-f-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-gnu-f-rt-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-tbb-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-rt-32bit-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-mic-196     Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-gnu-f-rt-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-32bit-239  Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-174  Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-common-c-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-f-rt-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-f95-common-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-mic-f-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-196  Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-ps-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-cluster-64bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-64bit-2017.3-056 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-ss-tbb-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-32bit-2017.4-061 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-tbb-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-64bit-2017.2-050 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-mic-rt-196  Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-cluster-c-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-c-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-gnu-f-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-gnu-c-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-rt-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-core-rt-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-common-239     Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-2017.3-056     Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-tbb-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-pgi-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-pgi-f-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-common-c-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-tbb-rt-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-openmp-l-all-32bit-239 OpenMP for Intel(R) Compilers 17.0 Update 5 for Linux*
intel-mkl-rt-196         Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-cluster-f-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-2017.4-061     Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-common-c-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-c-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-psxe-common-doc    Intel(R) Parallel Studio XE 2017 Update 5 for Linux*
intel-tbb-libs-32bit-2018.2-199 Intel(R) Threading Building Blocks 2018 Update 2 for Linux*
intel-mkl-2017.2-050     Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-tbb-mic-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-2018.1-038     Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-gnu-c-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-ps-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-tbb-mic-rt-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-tbb-rt-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-cluster-f-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-psxe-061       Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-ss-tbb-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-mic-rt-jp-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-common-c-ps-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-doc-jp      Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-core-rt-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-common-f-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-c-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-cluster-rt-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-mic-rt-239  Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-openmp-l-ps-libs-196 OpenMP for Intel(R) Compilers 17.0 Update 4 for Linux*
intel-mkl-common-c-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-32bit-196  Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-openmp-18.0.2-199  OpenMP for Intel(R) Compilers 18.0 Update 2 for Linux*
intel-mkl-ps-common-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-rt-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-openmp-32bit-18.0.1-163 OpenMP for Intel(R) Compilers 18.0 Update 1 for Linux*
intel-mkl-ps-pgi-174     Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-comp-l-all-vars-239 Intel(R) Compilers 17.0 Update 5 for Linux*
intel-mkl-ps-mic-c-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-f-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-ss-tbb-174  Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-f-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-mic-c-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-mic-rt-jp-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-psxe-common-2018.0-033 Intel(R) Parallel Studio XE 2018 for Linux*
intel-mkl-ps-f95-mic-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-common-c-64bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-psxe-056       Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-rt-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-core-c-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-common-c-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-comp-l-all-vars-18.0.1-163 Intel(R) Compilers 18.0 Update 1 for Linux*
intel-mkl-psxe-2018.0-033 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-f95-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-openmp-l-ps-libs-jp-174 OpenMP for Intel(R) Compilers 17.0 Update 2 for Linux*
intel-mkl-tbb-rt-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-mic-f-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-2018.0-033     Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-ps-f95-239     Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-doc            Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-common-c-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-common-f-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-gnu-f-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-cluster-c-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-common-c-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-tbb-mic-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-sta-common-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-32bit-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-core-f-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-32bit-2018.2-046 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-mic-f-196   Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-c-239      Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-doc-c-jp    Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-rt-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-doc-2018       Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-pgi-c-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-core-rt-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-common-239  Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-f95-common-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-gnu-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-cluster-c-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-mic-cluster-rt-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-cluster-f-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-pgi-f-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-common-c-ps-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-cluster-common-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-32bit-2017.3-056 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-core-rt-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-gnu-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-eula-174       Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-ss-tbb-rt-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-pgi-rt-196  Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-gnu-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-psxe-common-2018.1-038 Intel(R) Parallel Studio XE 2018 Update 1 for Linux*
intel-mkl-pgi-f-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-core-ps-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-common-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-rt-jp-239   Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-ps-pgi-rt-239  Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-32bit-2017.2-050 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-f-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-pgi-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-tbb-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-comp-nomcu-vars-18.0.1-163 Intel(R) Compilers 18.0 Update 1 for Linux*
intel-mkl-common-f-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-tbb-rt-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-common-174     Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-gnu-c-32bit-2018.2-199 Intel(R) Math Kernel Library 2018 Update 2 for Linux*
intel-mkl-ps-mic-cluster-rt-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-f95-174     Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-core-2018.1-163 Intel(R) Math Kernel Library 2018 Update 1 for Linux*
intel-mkl-ps-gnu-f-32bit-196 Intel(R) Math Kernel Library 2017 Update 3 for Linux*
intel-mkl-ps-f95-32bit-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-ps-mic-cluster-174 Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-psxe-common-050    Intel(R) Parallel Studio XE 2017 Update 2 for Linux*
intel-mkl-cluster-c-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-rt-32bit-174   Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-mkl-32bit-174      Intel(R) Math Kernel Library 2017 Update 2 for Linux*
intel-openmp-l-ps-libs-32bit-jp-239 OpenMP for Intel(R) Compilers 17.0 Update 5 for Linux*
intel-mkl-ps-ss-tbb-rt-32bit-239 Intel(R) Math Kernel Library 2017 Update 4 for Linux*
intel-mkl-gnu-f-rt-32bit-2018.0-128 Intel(R) Math Kernel Library 2018 for Linux*
intel-mkl-gnu-174        Intel(R) Math Kernel Library 2017 Update 2 for Linux*
edd@rob:/tmp$

Install MKL

Now that we have everything set up, installing the MKL is as simple as:

apt-get install intel-mkl-64bit-2018.2-046

This picks the 64-bit only variant of the (currently) most recent builds.

There is a slight cost: a 500mb download of 39 packages which install to 1.9 gb! Other than that it is easy: one command! Compare that with the days of yore when we fetched shar archives of NETLIB...

Integrate MKL

One the key advantages of a Debian or Ubuntu system is the overall integration providing a raft of useful features. One of these is the seamless and automatic selection of alternatives. By declaring a particular set of BLAS and LAPACK libraries the default, all application linked against this interface will use the default. Better still, users can switch between these as well.

So here we can make the MKL default for BLAS and LAPACK:

## update alternatives
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so     \
                    libblas.so-x86_64-linux-gnu      /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so.3   \
                    libblas.so.3-x86_64-linux-gnu    /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so   \
                    liblapack.so-x86_64-linux-gnu    /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so.3 \
                    liblapack.so.3-x86_64-linux-gnu  /opt/intel/mkl/lib/intel64/libmkl_rt.so 50

Next, we have to tell the dyanmic linker about two directories use by the MKL, and have it update its cache:

echo "/opt/intel/lib/intel64"     >  /etc/ld.so.conf.d/mkl.conf
echo "/opt/intel/mkl/lib/intel64" >> /etc/ld.so.conf.d/mkl.conf
ldconfig

Set An Environment Variable

As discussed in issue ticket #2, mixing Intel OpenMP and GNU OpenMP run-times in one application can lead to issues.

Since most of the open-source performance libraries use GNU OpenMP it is safer to make the MKL library also use GNU OpenMP as well by setting MKL_THREADING_LAYER=GNU in either /etc/environment or your local per-user settings.

Here we use the file in /etc:

echo "MKL_THREADING_LAYER=GNU" >> /etc/environment

Thanks to Evarist Fomenko from Intel's Novosibirsk office for help with this point.

Use the MKL

Now the MKL is 'known' and the default. If we start R, its sessionInfo() shows the MKL:

Matrix products: default                            
BLAS/LAPACK: /opt/intel/compilers_and_libraries_2018.2.199/linux/mkl/lib/intel64_lin/libmkl_rt.so

Benchmarks

# Vanilla r-base Rocker with default reference BLAS
> n <- 1e3 ; X <- matrix(rnorm(n*n),n,n);  system.time(svd(X))
   user  system elapsed
  2.239   0.004   2.266
>

# OpenBlas added to r-base Rocker
>  n <- 1e3 ; X <- matrix(rnorm(n*n),n,n);  system.time(svd(X))
   user  system elapsed
  1.367   2.297   0.353
>

# MKL added to r-base Rocker
> n <- 1e3 ; X <- matrix(rnorm(n*n),n,n)  
> system.time(svd(X))                               
   user  system elapsed                             
  1.772   0.056   0.350                             
>  

So just R (with reference BLAS) is slow. (Using Docker is done here to have clean comparisons while not altering the outer host system; impact of running Docker on Linux should be minimal.) Adding OpenBLAS helps quite a bit already by offering multi-core processing -- the, and MKL does not yet improve materially over OpenBLAS. Now, this of course was not any serious benchmarking---we just ran one SVD. More to do as time permits...

Removal, if needed

Another rather nice benefit of the package management is that clean removal is also possible:

root@c9f8062fbd93:/tmp# apt-get autoremove intel-mkl-64bit-2018.2-046
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  intel-comp-l-all-vars-18.0.2-199 intel-comp-nomcu-vars-18.0.2-199 intel-mkl-64bit-2018.2-046
  intel-mkl-cluster-2018.2-199 intel-mkl-cluster-c-2018.2-199 intel-mkl-cluster-common-2018.2-199
  intel-mkl-cluster-f-2018.2-199 intel-mkl-cluster-rt-2018.2-199 intel-mkl-common-2018.2-199
  intel-mkl-common-c-2018.2-199 intel-mkl-common-c-ps-2018.2-199 intel-mkl-common-f-2018.2-199
  intel-mkl-common-ps-2018.2-199 intel-mkl-core-2018.2-199 intel-mkl-core-c-2018.2-199
  intel-mkl-core-f-2018.2-199 intel-mkl-core-ps-2018.2-199 intel-mkl-core-rt-2018.2-199
  intel-mkl-doc-2018 intel-mkl-doc-ps-2018 intel-mkl-f95-2018.2-199 intel-mkl-f95-common-2018.2-199
  intel-mkl-gnu-2018.2-199 intel-mkl-gnu-c-2018.2-199 intel-mkl-gnu-f-2018.2-199 intel-mkl-gnu-f-rt-2018.2-199
  intel-mkl-gnu-rt-2018.2-199 intel-mkl-pgi-2018.2-199 intel-mkl-pgi-c-2018.2-199 intel-mkl-pgi-f-2018.2-199
  intel-mkl-pgi-rt-2018.2-199 intel-mkl-psxe-2018.2-046 intel-mkl-tbb-2018.2-199 intel-mkl-tbb-rt-2018.2-199
  intel-openmp-18.0.2-199 intel-psxe-common-2018.2-046 intel-psxe-common-doc-2018 intel-tbb-libs-2018.2-199
  intel-tbb-libs-32bit-2018.2-199 libisl15
0 upgraded, 0 newly installed, 40 to remove and 0 not upgraded.
After this operation, 1,904 kB disk space will be freed.
Do you want to continue? [Y/n] n                    
Abort.                                              
root@c9f8062fbd93:/tmp#  

where we said 'no' just to illustrate the option.

As a second step, you want to also update the alternatives setting via

update-alternatives --remove libblas.so-x86_64-linux-gnu     \
                             /opt/intel/mkl/lib/intel64/libmkl_rt.so
update-alternatives --remove libblas.so.3-x86_64-linux-gnu   \
                             /opt/intel/mkl/lib/intel64/libmkl_rt.so
update-alternatives --remove liblapack.so-x86_64-linux-gnu   \
                             /opt/intel/mkl/lib/intel64/libmkl_rt.so
update-alternatives --remove liblapack.so.3-x86_64-linux-gnu \
                             /opt/intel/mkl/lib/intel64/libmkl_rt.so

Summary

Package management systems are fabulous. Kudos to Intel for supporting apt (and also yum in case you are on an rpm-based system). We can install the MKL with just a few commands (which we regrouped in this script).

The MKL has a serious footprint with an installed size of just under 2gb. But for those doing extended amounts of numerical analysis, installing this library may well be worth it.

Appendix

2021 Update: The post and script were originally written in 2018, and while they have been updated, things do sometimes change. So these days for example Ubuntu has (meta-)package intel-mkl starting from release 20.04 ("focal") and never---so there you can just say sudo apt install intel-mkl.

mkl4deb's People

Contributors

eddelbuettel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mkl4deb's Issues

segmentation fault

I'm getting a segmentation fault when trying to link a recent version of MKL on a recent version of rocker. I'm not sure if this is an issue with the sylabs remote builder or with the script itself and unfortunately I dont have easy access to ubuntu/debian machine with root to try locally. Can you advise? Here's my singularity .def file:

Bootstrap: docker
From: rocker/geospatial:4.1.0
Stage: build

############################################
%post
############################################

##intel mkl###
apt update
apt install -y gnupg2

wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -O - > key_stored2file
apt-key add key_stored2file
rm key_stored2file
echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list
apt update
apt install -y intel-oneapi-mkl-2021.1.1

/opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so

update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so     \
                    libblas.so-x86_64-linux-gnu      /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so.3   \
                    libblas.so.3-x86_64-linux-gnu    /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so   \
                    liblapack.so-x86_64-linux-gnu    /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so.3 \
                    liblapack.so.3-x86_64-linux-gnu  /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so 50

echo "/opt/intel/lib/intel64"     >  /etc/ld.so.conf.d/mkl.conf
echo "/opt/intel/mkl/lib/intel64" >> /etc/ld.so.conf.d/mkl.conf
ldconfig

echo "MKL_THREADING_LAYER=GNU" >> /etc/environment

Build Log with segmentation fault error
 singularity build --remote mkl.sif mkl.def
INFO:    Access Token Verified!
INFO:    Token stored in /root/.singularity/remote.yaml
INFO:    Remote "default" now in use.
INFO:    Starting build...
Getting image source signatures
Copying blob sha256:16ec32c2132b43494832a05f2b02f7a822479f8250c173d0ab27b3de78b2f058
Copying blob sha256:e031c1a9f2f8981caa2c98eccc68a7f37f276578570815a2a750f1a9a7a26a2b
Copying blob sha256:a70855d85b62f4445418b3403977c218af39b555b9d024b0e34d854b43461a73
Copying blob sha256:ee8d56356e0a287731be50c207130a0960ec541c009ac15613f895f2f2d5278e
Copying blob sha256:5d3c6fe2adc613012e5716756b9ad873b0e98761c70c1f2bbe0c0ab3c92359b4
Copying blob sha256:fc0654371b2f0535df2bda795325c8f2b561f13186a133469562b9685abc6768
Copying blob sha256:8d80cde37ed7f3a04b27909799a1e1c73fe9fafbc38699ecbc7c82d36559d6fd
Copying blob sha256:4cfc1cf5c9b8960e2c477c2273d72febaf6003d9efe46601d484f2876e1193f3
Copying config sha256:7088bb9885c96e3651bac5b55ab97ad5a39f912a837acc7fc72d261107125a21
Writing manifest to image destination
Storing signatures
2021/07/31 16:06:19  info unpack layer: sha256:16ec32c2132b43494832a05f2b02f7a822479f8250c173d0ab27b3de78b2f058
2021/07/31 16:06:20  info unpack layer: sha256:e031c1a9f2f8981caa2c98eccc68a7f37f276578570815a2a750f1a9a7a26a2b
2021/07/31 16:06:20  info unpack layer: sha256:a70855d85b62f4445418b3403977c218af39b555b9d024b0e34d854b43461a73
2021/07/31 16:06:29  info unpack layer: sha256:ee8d56356e0a287731be50c207130a0960ec541c009ac15613f895f2f2d5278e
2021/07/31 16:06:43  info unpack layer: sha256:5d3c6fe2adc613012e5716756b9ad873b0e98761c70c1f2bbe0c0ab3c92359b4
2021/07/31 16:06:43  info unpack layer: sha256:fc0654371b2f0535df2bda795325c8f2b561f13186a133469562b9685abc6768
2021/07/31 16:06:51  info unpack layer: sha256:8d80cde37ed7f3a04b27909799a1e1c73fe9fafbc38699ecbc7c82d36559d6fd
2021/07/31 16:07:10  info unpack layer: sha256:4cfc1cf5c9b8960e2c477c2273d72febaf6003d9efe46601d484f2876e1193f3
INFO:    Running post scriptlet
+ apt update

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [989 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [785 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [432 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [30.6 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:10 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1,275 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [478 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,055 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [33.1 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,421 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [6,319 B]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [2,668 B]
Fetched 18.7 MB in 2s (7,519 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
+ apt install -y gnupg2

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
Suggested packages:
  dbus-user-session libpam-systemd pinentry-gnome3 tor parcimonie xloadimage
  scdaemon pinentry-doc
The following NEW packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gnupg2 gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
0 upgraded, 15 newly installed, 0 to remove and 2 not upgraded.
Need to get 2,541 kB of archives.
After this operation, 7,541 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libassuan0 amd64 2.5.3-7ubuntu2 [35.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpgconf amd64 2.2.19-3ubuntu2.1 [124 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libksba8 amd64 1.3.5-2 [92.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libnpth0 amd64 1.6-1 [7,736 B]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 dirmngr amd64 2.2.19-3ubuntu2.1 [329 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gnupg-l10n all 2.2.19-3ubuntu2.1 [51.7 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gnupg-utils amd64 2.2.19-3ubuntu2.1 [480 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg amd64 2.2.19-3ubuntu2.1 [483 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 pinentry-curses amd64 1.1.0-3build1 [36.3 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-agent amd64 2.2.19-3ubuntu2.1 [232 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-wks-client amd64 2.2.19-3ubuntu2.1 [97.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-wks-server amd64 2.2.19-3ubuntu2.1 [90.3 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpgsm amd64 2.2.19-3ubuntu2.1 [217 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gnupg all 2.2.19-3ubuntu2.1 [259 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 gnupg2 all 2.2.19-3ubuntu2.1 [4,584 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 2,541 kB in 1s (3,110 kB/s)
Selecting previously unselected package libassuan0:amd64.
(Reading database ... 58960 files and directories currently installed.)
Preparing to unpack .../00-libassuan0_2.5.3-7ubuntu2_amd64.deb ...
Unpacking libassuan0:amd64 (2.5.3-7ubuntu2) ...
Selecting previously unselected package gpgconf.
Preparing to unpack .../01-gpgconf_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpgconf (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package libksba8:amd64.
Preparing to unpack .../02-libksba8_1.3.5-2_amd64.deb ...
Unpacking libksba8:amd64 (1.3.5-2) ...
Selecting previously unselected package libnpth0:amd64.
Preparing to unpack .../03-libnpth0_1.6-1_amd64.deb ...
Unpacking libnpth0:amd64 (1.6-1) ...
Selecting previously unselected package dirmngr.
Preparing to unpack .../04-dirmngr_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking dirmngr (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg-l10n.
Preparing to unpack .../05-gnupg-l10n_2.2.19-3ubuntu2.1_all.deb ...
Unpacking gnupg-l10n (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg-utils.
Preparing to unpack .../06-gnupg-utils_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gnupg-utils (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpg.
Preparing to unpack .../07-gpg_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package pinentry-curses.
Preparing to unpack .../08-pinentry-curses_1.1.0-3build1_amd64.deb ...
Unpacking pinentry-curses (1.1.0-3build1) ...
Selecting previously unselected package gpg-agent.
Preparing to unpack .../09-gpg-agent_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg-agent (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpg-wks-client.
Preparing to unpack .../10-gpg-wks-client_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg-wks-client (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpg-wks-server.
Preparing to unpack .../11-gpg-wks-server_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg-wks-server (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpgsm.
Preparing to unpack .../12-gpgsm_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpgsm (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg.
Preparing to unpack .../13-gnupg_2.2.19-3ubuntu2.1_all.deb ...
Unpacking gnupg (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg2.
Preparing to unpack .../14-gnupg2_2.2.19-3ubuntu2.1_all.deb ...
Unpacking gnupg2 (2.2.19-3ubuntu2.1) ...
Setting up libksba8:amd64 (1.3.5-2) ...
Setting up libnpth0:amd64 (1.6-1) ...
Setting up libassuan0:amd64 (2.5.3-7ubuntu2) ...
Setting up gnupg-l10n (2.2.19-3ubuntu2.1) ...
Setting up gpgconf (2.2.19-3ubuntu2.1) ...
Setting up gpg (2.2.19-3ubuntu2.1) ...
Setting up gnupg-utils (2.2.19-3ubuntu2.1) ...
Setting up pinentry-curses (1.1.0-3build1) ...
Setting up gpg-agent (2.2.19-3ubuntu2.1) ...
Setting up gpgsm (2.2.19-3ubuntu2.1) ...
Setting up dirmngr (2.2.19-3ubuntu2.1) ...
Setting up gpg-wks-server (2.2.19-3ubuntu2.1) ...
Setting up gpg-wks-client (2.2.19-3ubuntu2.1) ...
Setting up gnupg (2.2.19-3ubuntu2.1) ...
Setting up gnupg2 (2.2.19-3ubuntu2.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
+ wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB -O -
--2021-07-31 16:07:37--  https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB
Resolving apt.repos.intel.com (apt.repos.intel.com)... 184.84.65.68, 2600:1408:8400:5ac::4b23, 2600:1408:8400:58d::4b23
Connecting to apt.repos.intel.com (apt.repos.intel.com)|184.84.65.68|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3796 (3.7K) [binary/octet-stream]
Saving to: โ€˜STDOUTโ€™

     0K ...                                                   100%  525M=0s

2021-07-31 16:07:38 (525 MB/s) - written to stdout [3796/3796]

+ apt-key add key_stored2file
Warning: apt-key output should not be parsed (stdout is not a terminal)
OK
+ rm key_stored2file
deb https://apt.repos.intel.com/oneapi all main
+ + tee /etc/apt/sources.list.d/oneAPI.list
echo deb https://apt.repos.intel.com/oneapi all main
+ apt update

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Hit:1 http://security.ubuntu.com/ubuntu focal-security InRelease
Get:2 https://apt.repos.intel.com/oneapi all InRelease [4,390 B]
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:5 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Get:6 https://apt.repos.intel.com/oneapi all/main all Packages [16.4 kB]
Get:7 https://apt.repos.intel.com/oneapi all/main amd64 Packages [84.6 kB]
Fetched 105 kB in 0s (238 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
+ apt install -y intel-oneapi-mkl-2021.1.1

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  intel-oneapi-common-licensing intel-oneapi-common-licensing-2021.3.0
  intel-oneapi-common-vars intel-oneapi-compiler-dpcpp-cpp-runtime
  intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0
  intel-oneapi-compiler-shared-common-runtime-2021.3.0
  intel-oneapi-compiler-shared-runtime-2021.3.0 intel-oneapi-condaindex
  intel-oneapi-mkl-common-2021.1.1 intel-oneapi-openmp-2021.3.0
  intel-oneapi-openmp-common-2021.3.0 intel-oneapi-tbb
  intel-oneapi-tbb-2021.3.0 intel-oneapi-tbb-common-2021.3.0
The following NEW packages will be installed:
  intel-oneapi-common-licensing intel-oneapi-common-licensing-2021.3.0
  intel-oneapi-common-vars intel-oneapi-compiler-dpcpp-cpp-runtime
  intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0
  intel-oneapi-compiler-shared-common-runtime-2021.3.0
  intel-oneapi-compiler-shared-runtime-2021.3.0 intel-oneapi-condaindex
  intel-oneapi-mkl-2021.1.1 intel-oneapi-mkl-common-2021.1.1
  intel-oneapi-openmp-2021.3.0 intel-oneapi-openmp-common-2021.3.0
  intel-oneapi-tbb intel-oneapi-tbb-2021.3.0 intel-oneapi-tbb-common-2021.3.0
0 upgraded, 15 newly installed, 0 to remove and 2 not upgraded.
Need to get 473 MB of archives.
After this operation, 2,442 MB of additional disk space will be used.
Get:1 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-common-licensing-2021.3.0 all 2021.3.0-261 [35.6 kB]
Get:2 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-common-licensing all 2021.3.0-261 [2,298 B]
Get:3 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-common-vars all 2021.3.0-261 [13.0 kB]
Get:4 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-compiler-shared-common-runtime-2021.3.0 all 2021.3.0-3350 [14.6 MB]
Get:5 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-condaindex amd64 2021.3.0-159 [675 kB]
Get:6 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-openmp-common-2021.3.0 all 2021.3.0-3350 [16.0 kB]
Get:7 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-openmp-2021.3.0 amd64 2021.3.0-3350 [120 MB]
Get:8 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-compiler-shared-runtime-2021.3.0 amd64 2021.3.0-3350 [5,851 kB]
Get:9 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-tbb-common-2021.3.0 all 2021.3.0-511 [21.5 kB]
Get:10 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-tbb-2021.3.0 amd64 2021.3.0-511 [2,167 kB]
Get:11 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0 amd64 2021.3.0-3350 [129 MB]
Get:12 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-compiler-dpcpp-cpp-runtime amd64 2021.3.0-3350 [2,818 B]
Get:13 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-mkl-common-2021.1.1 all 2021.1.1-52 [18.6 kB]
Get:14 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-tbb amd64 2021.3.0-511 [1,840 B]
Get:15 https://apt.repos.intel.com/oneapi all/main amd64 intel-oneapi-mkl-2021.1.1 amd64 2021.1.1-52 [200 MB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 473 MB in 19s (24.3 MB/s)
Selecting previously unselected package intel-oneapi-common-licensing-2021.3.0.
(Reading database ... 59173 files and directories currently installed.)
Preparing to unpack .../00-intel-oneapi-common-licensing-2021.3.0_2021.3.0-261_all.deb ...
Unpacking intel-oneapi-common-licensing-2021.3.0 (2021.3.0-261) ...
Selecting previously unselected package intel-oneapi-common-licensing.
Preparing to unpack .../01-intel-oneapi-common-licensing_2021.3.0-261_all.deb ...
Unpacking intel-oneapi-common-licensing (2021.3.0-261) ...
Selecting previously unselected package intel-oneapi-common-vars.
Preparing to unpack .../02-intel-oneapi-common-vars_2021.3.0-261_all.deb ...
Unpacking intel-oneapi-common-vars (2021.3.0-261) ...
Selecting previously unselected package intel-oneapi-compiler-shared-common-runtime-2021.3.0.
Preparing to unpack .../03-intel-oneapi-compiler-shared-common-runtime-2021.3.0_2021.3.0-3350_all.deb ...
Unpacking intel-oneapi-compiler-shared-common-runtime-2021.3.0 (2021.3.0-3350) ...
Selecting previously unselected package intel-oneapi-condaindex.
Preparing to unpack .../04-intel-oneapi-condaindex_2021.3.0-159_amd64.deb ...
Unpacking intel-oneapi-condaindex (2021.3.0-159) ...
Selecting previously unselected package intel-oneapi-openmp-common-2021.3.0.
Preparing to unpack .../05-intel-oneapi-openmp-common-2021.3.0_2021.3.0-3350_all.deb ...
Unpacking intel-oneapi-openmp-common-2021.3.0 (2021.3.0-3350) ...
Selecting previously unselected package intel-oneapi-openmp-2021.3.0.
Preparing to unpack .../06-intel-oneapi-openmp-2021.3.0_2021.3.0-3350_amd64.deb ...
Unpacking intel-oneapi-openmp-2021.3.0 (2021.3.0-3350) ...
Selecting previously unselected package intel-oneapi-compiler-shared-runtime-2021.3.0.
Preparing to unpack .../07-intel-oneapi-compiler-shared-runtime-2021.3.0_2021.3.0-3350_amd64.deb ...
Unpacking intel-oneapi-compiler-shared-runtime-2021.3.0 (2021.3.0-3350) ...
Selecting previously unselected package intel-oneapi-tbb-common-2021.3.0.
Preparing to unpack .../08-intel-oneapi-tbb-common-2021.3.0_2021.3.0-511_all.deb ...
Unpacking intel-oneapi-tbb-common-2021.3.0 (2021.3.0-511) ...
Selecting previously unselected package intel-oneapi-tbb-2021.3.0.
Preparing to unpack .../09-intel-oneapi-tbb-2021.3.0_2021.3.0-511_amd64.deb ...
Unpacking intel-oneapi-tbb-2021.3.0 (2021.3.0-511) ...
Selecting previously unselected package intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0.
Preparing to unpack .../10-intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0_2021.3.0-3350_amd64.deb ...
Unpacking intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0 (2021.3.0-3350) ...
Selecting previously unselected package intel-oneapi-compiler-dpcpp-cpp-runtime.
Preparing to unpack .../11-intel-oneapi-compiler-dpcpp-cpp-runtime_2021.3.0-3350_amd64.deb ...
Unpacking intel-oneapi-compiler-dpcpp-cpp-runtime (2021.3.0-3350) ...
Selecting previously unselected package intel-oneapi-mkl-common-2021.1.1.
Preparing to unpack .../12-intel-oneapi-mkl-common-2021.1.1_2021.1.1-52_all.deb ...
Unpacking intel-oneapi-mkl-common-2021.1.1 (2021.1.1-52) ...
Selecting previously unselected package intel-oneapi-tbb.
Preparing to unpack .../13-intel-oneapi-tbb_2021.3.0-511_amd64.deb ...
Unpacking intel-oneapi-tbb (2021.3.0-511) ...
Selecting previously unselected package intel-oneapi-mkl-2021.1.1.
Preparing to unpack .../14-intel-oneapi-mkl-2021.1.1_2021.1.1-52_amd64.deb ...
Unpacking intel-oneapi-mkl-2021.1.1 (2021.1.1-52) ...
Setting up intel-oneapi-common-licensing-2021.3.0 (2021.3.0-261) ...
Setting up intel-oneapi-condaindex (2021.3.0-159) ...
Setting up intel-oneapi-common-vars (2021.3.0-261) ...
Setting up intel-oneapi-openmp-common-2021.3.0 (2021.3.0-3350) ...
Setting up intel-oneapi-common-licensing (2021.3.0-261) ...
Setting up intel-oneapi-mkl-common-2021.1.1 (2021.1.1-52) ...
Setting up intel-oneapi-compiler-shared-common-runtime-2021.3.0 (2021.3.0-3350) ...
Setting up intel-oneapi-tbb-common-2021.3.0 (2021.3.0-511) ...
Setting up intel-oneapi-openmp-2021.3.0 (2021.3.0-3350) ...
Setting up intel-oneapi-tbb-2021.3.0 (2021.3.0-511) ...
Setting up intel-oneapi-tbb (2021.3.0-511) ...
Setting up intel-oneapi-compiler-shared-runtime-2021.3.0 (2021.3.0-3350) ...
Setting up intel-oneapi-compiler-dpcpp-cpp-runtime-2021.3.0 (2021.3.0-3350) ...
Setting up intel-oneapi-compiler-dpcpp-cpp-runtime (2021.3.0-3350) ...
Setting up intel-oneapi-mkl-2021.1.1 (2021.1.1-52) ...
+ /opt/intel/oneapi/mkl/latest/lib/intel64/libmkl_rt.so
Segmentation fault
FATAL:   While performing build: while running engine: exit status 139
FATAL:   While performing build: build image size <= 0

The script should be part of a Debian package

As I recall there was some prior discussion on the debian-science list list.

Of course, this can only go into non-free and may only support amd64 and at best a few other architectures, so in general it will be a bit of a second-class citizen. But it would still be nice to have. If anybody has time or energy ...

Not working on Ubuntu 20.04

I think the update alternatives is wrong. But don't know how to fix it:
After following the steps I end up with:

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

apt install intel-mkl in a non-interactive session

Trying to use apt install intel-mkl is hanging at a prompt in a non-interactive (singularity) build session. Here's my def file. any idea how to get around this prompt?

Bootstrap: docker
From: rocker/geospatial:4.1.0
Stage: build

############################################
%post
############################################

##intel mkl###
apt update
apt install -y gnupg2

apt install -y intel-mkl
singularity build --remote mkl.sif mkl.def
INFO:    Access Token Verified!
INFO:    Token stored in /root/.singularity/remote.yaml
INFO:    Remote "default" now in use.
INFO:    Starting build...
Getting image source signatures
Copying blob sha256:16ec32c2132b43494832a05f2b02f7a822479f8250c173d0ab27b3de78b2f058
Copying blob sha256:e031c1a9f2f8981caa2c98eccc68a7f37f276578570815a2a750f1a9a7a26a2b
Copying blob sha256:a70855d85b62f4445418b3403977c218af39b555b9d024b0e34d854b43461a73
Copying blob sha256:ee8d56356e0a287731be50c207130a0960ec541c009ac15613f895f2f2d5278e
Copying blob sha256:5d3c6fe2adc613012e5716756b9ad873b0e98761c70c1f2bbe0c0ab3c92359b4
Copying blob sha256:fc0654371b2f0535df2bda795325c8f2b561f13186a133469562b9685abc6768
Copying blob sha256:8d80cde37ed7f3a04b27909799a1e1c73fe9fafbc38699ecbc7c82d36559d6fd
Copying blob sha256:4cfc1cf5c9b8960e2c477c2273d72febaf6003d9efe46601d484f2876e1193f3
Copying config sha256:7088bb9885c96e3651bac5b55ab97ad5a39f912a837acc7fc72d261107125a21
Writing manifest to image destination
Storing signatures
2021/07/31 16:21:36  info unpack layer: sha256:16ec32c2132b43494832a05f2b02f7a822479f8250c173d0ab27b3de78b2f058
2021/07/31 16:21:38  info unpack layer: sha256:e031c1a9f2f8981caa2c98eccc68a7f37f276578570815a2a750f1a9a7a26a2b
2021/07/31 16:21:38  info unpack layer: sha256:a70855d85b62f4445418b3403977c218af39b555b9d024b0e34d854b43461a73
2021/07/31 16:21:47  info unpack layer: sha256:ee8d56356e0a287731be50c207130a0960ec541c009ac15613f895f2f2d5278e
2021/07/31 16:22:01  info unpack layer: sha256:5d3c6fe2adc613012e5716756b9ad873b0e98761c70c1f2bbe0c0ab3c92359b4
2021/07/31 16:22:01  info unpack layer: sha256:fc0654371b2f0535df2bda795325c8f2b561f13186a133469562b9685abc6768
2021/07/31 16:22:13  info unpack layer: sha256:8d80cde37ed7f3a04b27909799a1e1c73fe9fafbc38699ecbc7c82d36559d6fd
2021/07/31 16:22:33  info unpack layer: sha256:4cfc1cf5c9b8960e2c477c2273d72febaf6003d9efe46601d484f2876e1193f3
INFO:    Running post scriptlet
+ apt update

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Get:1 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:3 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 Packages [30.6 kB]
Get:4 http://security.ubuntu.com/ubuntu focal-security/universe amd64 Packages [785 kB]
Get:5 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages [989 kB]
Get:6 http://security.ubuntu.com/ubuntu focal-security/restricted amd64 Packages [432 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/restricted amd64 Packages [33.4 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 Packages [177 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages [11.3 MB]
Get:12 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages [1,275 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [1,055 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,421 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 Packages [33.1 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/restricted amd64 Packages [478 kB]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 Packages [2,668 B]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 Packages [6,319 B]
Fetched 18.7 MB in 2s (7,595 kB/s)
Reading package lists...
Building dependency tree...
Reading state information...
2 packages can be upgraded. Run 'apt list --upgradable' to see them.
+ apt install -y gnupg2

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
Suggested packages:
  dbus-user-session libpam-systemd pinentry-gnome3 tor parcimonie xloadimage
  scdaemon pinentry-doc
The following NEW packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gnupg2 gpg gpg-agent gpg-wks-client
  gpg-wks-server gpgconf gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
0 upgraded, 15 newly installed, 0 to remove and 2 not upgraded.
Need to get 2,541 kB of archives.
After this operation, 7,541 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libassuan0 amd64 2.5.3-7ubuntu2 [35.7 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpgconf amd64 2.2.19-3ubuntu2.1 [124 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/main amd64 libksba8 amd64 1.3.5-2 [92.6 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libnpth0 amd64 1.6-1 [7,736 B]
Get:5 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 dirmngr amd64 2.2.19-3ubuntu2.1 [329 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gnupg-l10n all 2.2.19-3ubuntu2.1 [51.7 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gnupg-utils amd64 2.2.19-3ubuntu2.1 [480 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg amd64 2.2.19-3ubuntu2.1 [483 kB]
Get:9 http://archive.ubuntu.com/ubuntu focal/main amd64 pinentry-curses amd64 1.1.0-3build1 [36.3 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-agent amd64 2.2.19-3ubuntu2.1 [232 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-wks-client amd64 2.2.19-3ubuntu2.1 [97.6 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpg-wks-server amd64 2.2.19-3ubuntu2.1 [90.3 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gpgsm amd64 2.2.19-3ubuntu2.1 [217 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 gnupg all 2.2.19-3ubuntu2.1 [259 kB]
Get:15 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 gnupg2 all 2.2.19-3ubuntu2.1 [4,584 B]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 2,541 kB in 1s (3,109 kB/s)
Selecting previously unselected package libassuan0:amd64.
(Reading database ... 58960 files and directories currently installed.)
Preparing to unpack .../00-libassuan0_2.5.3-7ubuntu2_amd64.deb ...
Unpacking libassuan0:amd64 (2.5.3-7ubuntu2) ...
Selecting previously unselected package gpgconf.
Preparing to unpack .../01-gpgconf_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpgconf (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package libksba8:amd64.
Preparing to unpack .../02-libksba8_1.3.5-2_amd64.deb ...
Unpacking libksba8:amd64 (1.3.5-2) ...
Selecting previously unselected package libnpth0:amd64.
Preparing to unpack .../03-libnpth0_1.6-1_amd64.deb ...
Unpacking libnpth0:amd64 (1.6-1) ...
Selecting previously unselected package dirmngr.
Preparing to unpack .../04-dirmngr_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking dirmngr (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg-l10n.
Preparing to unpack .../05-gnupg-l10n_2.2.19-3ubuntu2.1_all.deb ...
Unpacking gnupg-l10n (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg-utils.
Preparing to unpack .../06-gnupg-utils_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gnupg-utils (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpg.
Preparing to unpack .../07-gpg_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package pinentry-curses.
Preparing to unpack .../08-pinentry-curses_1.1.0-3build1_amd64.deb ...
Unpacking pinentry-curses (1.1.0-3build1) ...
Selecting previously unselected package gpg-agent.
Preparing to unpack .../09-gpg-agent_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg-agent (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpg-wks-client.
Preparing to unpack .../10-gpg-wks-client_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg-wks-client (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpg-wks-server.
Preparing to unpack .../11-gpg-wks-server_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpg-wks-server (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gpgsm.
Preparing to unpack .../12-gpgsm_2.2.19-3ubuntu2.1_amd64.deb ...
Unpacking gpgsm (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg.
Preparing to unpack .../13-gnupg_2.2.19-3ubuntu2.1_all.deb ...
Unpacking gnupg (2.2.19-3ubuntu2.1) ...
Selecting previously unselected package gnupg2.
Preparing to unpack .../14-gnupg2_2.2.19-3ubuntu2.1_all.deb ...
Unpacking gnupg2 (2.2.19-3ubuntu2.1) ...
Setting up libksba8:amd64 (1.3.5-2) ...
Setting up libnpth0:amd64 (1.6-1) ...
Setting up libassuan0:amd64 (2.5.3-7ubuntu2) ...
Setting up gnupg-l10n (2.2.19-3ubuntu2.1) ...
Setting up gpgconf (2.2.19-3ubuntu2.1) ...
Setting up gpg (2.2.19-3ubuntu2.1) ...
Setting up gnupg-utils (2.2.19-3ubuntu2.1) ...
Setting up pinentry-curses (1.1.0-3build1) ...
Setting up gpg-agent (2.2.19-3ubuntu2.1) ...
Setting up gpgsm (2.2.19-3ubuntu2.1) ...
Setting up dirmngr (2.2.19-3ubuntu2.1) ...
Setting up gpg-wks-server (2.2.19-3ubuntu2.1) ...
Setting up gpg-wks-client (2.2.19-3ubuntu2.1) ...
Setting up gnupg (2.2.19-3ubuntu2.1) ...
Setting up gnupg2 (2.2.19-3ubuntu2.1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
+ apt install -y intel-mkl

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...
Building dependency tree...
Reading state information...
The following additional packages will be installed:
  gcc-7-base gcc-8-base libasan4 libcilkrts5 libgcc-7-dev libmkl-avx
  libmkl-avx2 libmkl-avx512 libmkl-avx512-mic libmkl-computational-dev
  libmkl-core libmkl-def libmkl-dev libmkl-gf-ilp64 libmkl-gf-lp64
  libmkl-gnu-thread libmkl-intel-ilp64 libmkl-intel-lp64 libmkl-intel-thread
  libmkl-interface-dev libmkl-locale libmkl-mc libmkl-mc3
  libmkl-meta-computational libmkl-meta-interface libmkl-meta-threading
  libmkl-pgi-thread libmkl-rt libmkl-sequential libmkl-tbb-thread
  libmkl-threading-dev libmkl-vml-avx libmkl-vml-avx2 libmkl-vml-avx512
  libmkl-vml-avx512-mic libmkl-vml-cmpt libmkl-vml-def libmkl-vml-mc
  libmkl-vml-mc2 libmkl-vml-mc3 libmpx2 libomp-10-dev libomp-dev libomp5-10
  libtbb-dev libtbb2 libubsan0
Suggested packages:
  intel-mkl-doc libomp-10-doc libtbb-doc
The following NEW packages will be installed:
  gcc-7-base gcc-8-base intel-mkl libasan4 libcilkrts5 libgcc-7-dev libmkl-avx
  libmkl-avx2 libmkl-avx512 libmkl-avx512-mic libmkl-computational-dev
  libmkl-core libmkl-def libmkl-dev libmkl-gf-ilp64 libmkl-gf-lp64
  libmkl-gnu-thread libmkl-intel-ilp64 libmkl-intel-lp64 libmkl-intel-thread
  libmkl-interface-dev libmkl-locale libmkl-mc libmkl-mc3
  libmkl-meta-computational libmkl-meta-interface libmkl-meta-threading
  libmkl-pgi-thread libmkl-rt libmkl-sequential libmkl-tbb-thread
  libmkl-threading-dev libmkl-vml-avx libmkl-vml-avx2 libmkl-vml-avx512
  libmkl-vml-avx512-mic libmkl-vml-cmpt libmkl-vml-def libmkl-vml-mc
  libmkl-vml-mc2 libmkl-vml-mc3 libmpx2 libomp-10-dev libomp-dev libomp5-10
  libtbb-dev libtbb2 libubsan0
0 upgraded, 48 newly installed, 0 to remove and 2 not upgraded.
Need to get 274 MB of archives.
After this operation, 1,733 MB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 gcc-7-base amd64 7.5.0-6ubuntu2 [18.5 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 gcc-8-base amd64 8.4.0-3ubuntu2 [18.7 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-locale amd64 2020.0.166-1 [25.8 kB]
Get:4 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-intel-lp64 amd64 2020.0.166-1 [1,504 kB]
Get:5 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-intel-ilp64 amd64 2020.0.166-1 [1,357 kB]
Get:6 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-gf-lp64 amd64 2020.0.166-1 [1,508 kB]
Get:7 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-gf-ilp64 amd64 2020.0.166-1 [1,370 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-meta-interface amd64 2020.0.166-1 [7,416 B]
Get:9 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-intel-thread amd64 2020.0.166-1 [6,662 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-gnu-thread amd64 2020.0.166-1 [3,888 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-sequential amd64 2020.0.166-1 [3,991 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-tbb-thread amd64 2020.0.166-1 [4,642 kB]
Get:13 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-pgi-thread amd64 2020.0.166-1 [5,231 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-meta-threading amd64 2020.0.166-1 [7,424 B]
Get:15 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-avx amd64 2020.0.166-1 [12.5 MB]
Get:16 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-avx2 amd64 2020.0.166-1 [11.0 MB]
Get:17 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-avx512 amd64 2020.0.166-1 [11.6 MB]
Get:18 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-avx512-mic amd64 2020.0.166-1 [12.5 MB]
Get:19 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-def amd64 2020.0.166-1 [8,785 kB]
Get:20 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-def amd64 2020.0.166-1 [1,816 kB]
Get:21 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-core amd64 2020.0.166-1 [14.0 MB]
Get:22 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-mc amd64 2020.0.166-1 [10.2 MB]
Get:23 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-mc3 amd64 2020.0.166-1 [10.5 MB]
Get:24 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-avx amd64 2020.0.166-1 [3,017 kB]
Get:25 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-avx2 amd64 2020.0.166-1 [2,845 kB]
Get:26 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-avx512 amd64 2020.0.166-1 [2,806 kB]
Get:27 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-avx512-mic amd64 2020.0.166-1 [3,189 kB]
Get:28 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-cmpt amd64 2020.0.166-1 [1,738 kB]
Get:29 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-mc amd64 2020.0.166-1 [2,714 kB]
Get:30 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-mc2 amd64 2020.0.166-1 [2,711 kB]
Get:31 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-vml-mc3 amd64 2020.0.166-1 [2,720 kB]
Get:32 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-meta-computational amd64 2020.0.166-1 [7,468 B]
Get:33 http://archive.ubuntu.com/ubuntu focal/universe amd64 libomp5-10 amd64 1:10.0.0-4ubuntu1 [300 kB]
Get:34 http://archive.ubuntu.com/ubuntu focal/universe amd64 libomp-10-dev amd64 1:10.0.0-4ubuntu1 [47.7 kB]
Get:35 http://archive.ubuntu.com/ubuntu focal/universe amd64 libomp-dev amd64 1:10.0-50~exp1 [2,824 B]
Get:36 http://archive.ubuntu.com/ubuntu focal/universe amd64 libasan4 amd64 7.5.0-6ubuntu2 [358 kB]
Get:37 http://archive.ubuntu.com/ubuntu focal/universe amd64 libubsan0 amd64 7.5.0-6ubuntu2 [126 kB]
Get:38 http://archive.ubuntu.com/ubuntu focal/universe amd64 libcilkrts5 amd64 7.5.0-6ubuntu2 [42.7 kB]
Get:39 http://archive.ubuntu.com/ubuntu focal/universe amd64 libmpx2 amd64 8.4.0-3ubuntu2 [11.8 kB]
Get:40 http://archive.ubuntu.com/ubuntu focal/universe amd64 libgcc-7-dev amd64 7.5.0-6ubuntu2 [2,311 kB]
Get:41 http://archive.ubuntu.com/ubuntu focal/universe amd64 libtbb2 amd64 2020.1-2 [124 kB]
Get:42 http://archive.ubuntu.com/ubuntu focal/universe amd64 libtbb-dev amd64 2020.1-2 [273 kB]
Get:43 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-rt amd64 2020.0.166-1 [933 kB]
Get:44 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-interface-dev amd64 2020.0.166-1 [4,599 kB]
Get:45 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-threading-dev amd64 2020.0.166-1 [22.9 MB]
Get:46 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-computational-dev amd64 2020.0.166-1 [96.8 MB]
Get:47 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 libmkl-dev amd64 2020.0.166-1 [519 kB]
Get:48 http://archive.ubuntu.com/ubuntu focal/multiverse amd64 intel-mkl amd64 2020.0.166-1 [11.7 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 274 MB in 15s (18.6 MB/s)
Selecting previously unselected package gcc-7-base:amd64.
(Reading database ... 59173 files and directories currently installed.)
Preparing to unpack .../00-gcc-7-base_7.5.0-6ubuntu2_amd64.deb ...
Unpacking gcc-7-base:amd64 (7.5.0-6ubuntu2) ...
Selecting previously unselected package gcc-8-base:amd64.
Preparing to unpack .../01-gcc-8-base_8.4.0-3ubuntu2_amd64.deb ...
Unpacking gcc-8-base:amd64 (8.4.0-3ubuntu2) ...
Selecting previously unselected package libmkl-locale.
Preparing to unpack .../02-libmkl-locale_2020.0.166-1_amd64.deb ...
Unpacking libmkl-locale (2020.0.166-1) ...
Selecting previously unselected package libmkl-intel-lp64:amd64.
Preparing to unpack .../03-libmkl-intel-lp64_2020.0.166-1_amd64.deb ...
Unpacking libmkl-intel-lp64:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-intel-ilp64:amd64.
Preparing to unpack .../04-libmkl-intel-ilp64_2020.0.166-1_amd64.deb ...
Unpacking libmkl-intel-ilp64:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-gf-lp64:amd64.
Preparing to unpack .../05-libmkl-gf-lp64_2020.0.166-1_amd64.deb ...
Unpacking libmkl-gf-lp64:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-gf-ilp64:amd64.
Preparing to unpack .../06-libmkl-gf-ilp64_2020.0.166-1_amd64.deb ...
Unpacking libmkl-gf-ilp64:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-meta-interface:amd64.
Preparing to unpack .../07-libmkl-meta-interface_2020.0.166-1_amd64.deb ...
Unpacking libmkl-meta-interface:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-intel-thread:amd64.
Preparing to unpack .../08-libmkl-intel-thread_2020.0.166-1_amd64.deb ...
Unpacking libmkl-intel-thread:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-gnu-thread:amd64.
Preparing to unpack .../09-libmkl-gnu-thread_2020.0.166-1_amd64.deb ...
Unpacking libmkl-gnu-thread:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-sequential:amd64.
Preparing to unpack .../10-libmkl-sequential_2020.0.166-1_amd64.deb ...
Unpacking libmkl-sequential:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-tbb-thread:amd64.
Preparing to unpack .../11-libmkl-tbb-thread_2020.0.166-1_amd64.deb ...
Unpacking libmkl-tbb-thread:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-pgi-thread:amd64.
Preparing to unpack .../12-libmkl-pgi-thread_2020.0.166-1_amd64.deb ...
Unpacking libmkl-pgi-thread:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-meta-threading:amd64.
Preparing to unpack .../13-libmkl-meta-threading_2020.0.166-1_amd64.deb ...
Unpacking libmkl-meta-threading:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-avx:amd64.
Preparing to unpack .../14-libmkl-avx_2020.0.166-1_amd64.deb ...
Unpacking libmkl-avx:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-avx2:amd64.
Preparing to unpack .../15-libmkl-avx2_2020.0.166-1_amd64.deb ...
Unpacking libmkl-avx2:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-avx512:amd64.
Preparing to unpack .../16-libmkl-avx512_2020.0.166-1_amd64.deb ...
Unpacking libmkl-avx512:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-avx512-mic:amd64.
Preparing to unpack .../17-libmkl-avx512-mic_2020.0.166-1_amd64.deb ...
Unpacking libmkl-avx512-mic:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-def:amd64.
Preparing to unpack .../18-libmkl-def_2020.0.166-1_amd64.deb ...
Unpacking libmkl-def:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-def:amd64.
Preparing to unpack .../19-libmkl-vml-def_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-def:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-core:amd64.
Preparing to unpack .../20-libmkl-core_2020.0.166-1_amd64.deb ...
Unpacking libmkl-core:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-mc:amd64.
Preparing to unpack .../21-libmkl-mc_2020.0.166-1_amd64.deb ...
Unpacking libmkl-mc:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-mc3:amd64.
Preparing to unpack .../22-libmkl-mc3_2020.0.166-1_amd64.deb ...
Unpacking libmkl-mc3:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-avx:amd64.
Preparing to unpack .../23-libmkl-vml-avx_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-avx:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-avx2:amd64.
Preparing to unpack .../24-libmkl-vml-avx2_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-avx2:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-avx512:amd64.
Preparing to unpack .../25-libmkl-vml-avx512_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-avx512:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-avx512-mic:amd64.
Preparing to unpack .../26-libmkl-vml-avx512-mic_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-avx512-mic:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-cmpt:amd64.
Preparing to unpack .../27-libmkl-vml-cmpt_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-cmpt:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-mc:amd64.
Preparing to unpack .../28-libmkl-vml-mc_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-mc:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-mc2:amd64.
Preparing to unpack .../29-libmkl-vml-mc2_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-mc2:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-vml-mc3:amd64.
Preparing to unpack .../30-libmkl-vml-mc3_2020.0.166-1_amd64.deb ...
Unpacking libmkl-vml-mc3:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-meta-computational:amd64.
Preparing to unpack .../31-libmkl-meta-computational_2020.0.166-1_amd64.deb ...
Unpacking libmkl-meta-computational:amd64 (2020.0.166-1) ...
Selecting previously unselected package libomp5-10:amd64.
Preparing to unpack .../32-libomp5-10_1%3a10.0.0-4ubuntu1_amd64.deb ...
Unpacking libomp5-10:amd64 (1:10.0.0-4ubuntu1) ...
Selecting previously unselected package libomp-10-dev.
Preparing to unpack .../33-libomp-10-dev_1%3a10.0.0-4ubuntu1_amd64.deb ...
Unpacking libomp-10-dev (1:10.0.0-4ubuntu1) ...
Selecting previously unselected package libomp-dev.
Preparing to unpack .../34-libomp-dev_1%3a10.0-50~exp1_amd64.deb ...
Unpacking libomp-dev (1:10.0-50~exp1) ...
Selecting previously unselected package libasan4:amd64.
Preparing to unpack .../35-libasan4_7.5.0-6ubuntu2_amd64.deb ...
Unpacking libasan4:amd64 (7.5.0-6ubuntu2) ...
Selecting previously unselected package libubsan0:amd64.
Preparing to unpack .../36-libubsan0_7.5.0-6ubuntu2_amd64.deb ...
Unpacking libubsan0:amd64 (7.5.0-6ubuntu2) ...
Selecting previously unselected package libcilkrts5:amd64.
Preparing to unpack .../37-libcilkrts5_7.5.0-6ubuntu2_amd64.deb ...
Unpacking libcilkrts5:amd64 (7.5.0-6ubuntu2) ...
Selecting previously unselected package libmpx2:amd64.
Preparing to unpack .../38-libmpx2_8.4.0-3ubuntu2_amd64.deb ...
Unpacking libmpx2:amd64 (8.4.0-3ubuntu2) ...
Selecting previously unselected package libgcc-7-dev:amd64.
Preparing to unpack .../39-libgcc-7-dev_7.5.0-6ubuntu2_amd64.deb ...
Unpacking libgcc-7-dev:amd64 (7.5.0-6ubuntu2) ...
Selecting previously unselected package libtbb2:amd64.
Preparing to unpack .../40-libtbb2_2020.1-2_amd64.deb ...
Unpacking libtbb2:amd64 (2020.1-2) ...
Selecting previously unselected package libtbb-dev:amd64.
Preparing to unpack .../41-libtbb-dev_2020.1-2_amd64.deb ...
Unpacking libtbb-dev:amd64 (2020.1-2) ...
Selecting previously unselected package libmkl-rt:amd64.
Preparing to unpack .../42-libmkl-rt_2020.0.166-1_amd64.deb ...
Unpacking libmkl-rt:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-interface-dev:amd64.
Preparing to unpack .../43-libmkl-interface-dev_2020.0.166-1_amd64.deb ...
Unpacking libmkl-interface-dev:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-threading-dev:amd64.
Preparing to unpack .../44-libmkl-threading-dev_2020.0.166-1_amd64.deb ...
Unpacking libmkl-threading-dev:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-computational-dev:amd64.
Preparing to unpack .../45-libmkl-computational-dev_2020.0.166-1_amd64.deb ...
Unpacking libmkl-computational-dev:amd64 (2020.0.166-1) ...
Selecting previously unselected package libmkl-dev:amd64.
Preparing to unpack .../46-libmkl-dev_2020.0.166-1_amd64.deb ...
Unpacking libmkl-dev:amd64 (2020.0.166-1) ...
Selecting previously unselected package intel-mkl:amd64.
Preparing to unpack .../47-intel-mkl_2020.0.166-1_amd64.deb ...
Unpacking intel-mkl:amd64 (2020.0.166-1) ...
Setting up libtbb2:amd64 (2020.1-2) ...
Setting up libmkl-locale (2020.0.166-1) ...
Setting up libmkl-vml-cmpt:amd64 (2020.0.166-1) ...
Setting up libmkl-mc:amd64 (2020.0.166-1) ...
Setting up libmkl-avx512:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-avx512:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-mc:amd64 (2020.0.166-1) ...
Setting up gcc-7-base:amd64 (7.5.0-6ubuntu2) ...
Setting up libmkl-avx512-mic:amd64 (2020.0.166-1) ...
Setting up libasan4:amd64 (7.5.0-6ubuntu2) ...
Setting up libmkl-tbb-thread:amd64 (2020.0.166-1) ...
Setting up gcc-8-base:amd64 (8.4.0-3ubuntu2) ...
Setting up libmpx2:amd64 (8.4.0-3ubuntu2) ...
Setting up libmkl-avx2:amd64 (2020.0.166-1) ...
Setting up libmkl-gnu-thread:amd64 (2020.0.166-1) ...
Setting up libomp5-10:amd64 (1:10.0.0-4ubuntu1) ...
Setting up libcilkrts5:amd64 (7.5.0-6ubuntu2) ...
Setting up libubsan0:amd64 (7.5.0-6ubuntu2) ...
Setting up libtbb-dev:amd64 (2020.1-2) ...
Setting up libmkl-vml-avx512-mic:amd64 (2020.0.166-1) ...
Setting up libmkl-def:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-mc3:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-def:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-mc2:amd64 (2020.0.166-1) ...
Setting up libmkl-avx:amd64 (2020.0.166-1) ...
Setting up libmkl-gf-lp64:amd64 (2020.0.166-1) ...
Setting up libmkl-sequential:amd64 (2020.0.166-1) ...
Setting up libmkl-intel-thread:amd64 (2020.0.166-1) ...
Setting up libmkl-gf-ilp64:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-avx2:amd64 (2020.0.166-1) ...
Setting up libmkl-mc3:amd64 (2020.0.166-1) ...
Setting up libmkl-intel-ilp64:amd64 (2020.0.166-1) ...
Setting up libomp-10-dev (1:10.0.0-4ubuntu1) ...
Setting up libmkl-intel-lp64:amd64 (2020.0.166-1) ...
Setting up libmkl-vml-avx:amd64 (2020.0.166-1) ...
Setting up libmkl-pgi-thread:amd64 (2020.0.166-1) ...
Setting up libmkl-core:amd64 (2020.0.166-1) ...
Setting up libmkl-meta-computational:amd64 (2020.0.166-1) ...
Setting up libmkl-computational-dev:amd64 (2020.0.166-1) ...
Setting up libgcc-7-dev:amd64 (7.5.0-6ubuntu2) ...
Setting up libmkl-meta-interface:amd64 (2020.0.166-1) ...
Setting up libomp-dev (1:10.0-50~exp1) ...
Setting up libmkl-meta-threading:amd64 (2020.0.166-1) ...
Setting up libmkl-rt:amd64 (2020.0.166-1) ...
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
Intel Math Kernel Library (Intel MKL)
-------------------------------------

Intel MKL's Single Dynamic Library (SDL) is installed on your machine. This
shared object can be used as an alternative to both libblas.so.3 and
liblapack.so.3, so that packages built against BLAS/LAPACK can directly use MKL
without rebuild.

However, MKL is non-free software, and in particular its source code is not
publicly available. By using MKL as the default BLAS/LAPACK implementation, you
might be violating the licensing terms of copyleft software that would become
dynamically linked against it. Please verify that the licensing terms of the
program(s) that you intend to use with MKL are compatible with the MKL
licensing terms. For the case of software under the GNU General Public License,
you may want to read this FAQ:

    https://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs


If you don't know what MKL is, or unwilling to set it as default, just choose
the preset value or simply type Enter.

Use libmkl_rt.so as the default alternative to BLAS/LAPACK? [yes/no]


MKL inconsistent results

I have R package pcoxtime (my implementation but already in CRAN) which I am using to fit survival model using proximal gradient descent. I have noticed that whenever I run the code on a system which has MKL as the default, I get different (seemingly wrong) results. This mostly happens when the dataset is large. For small dataset (few observations), the results are comparable (generally similar) with other packages (what we expect). Here's part of my sessionInfo() in this case.

R version 3.6.3 (2020-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.5 LTS

Matrix products: default
BLAS/LAPACK: /opt/intel/compilers_and_libraries_2018.2.199/linux/mkl/lib/intel64_lin/libmkl_rt.so

However, default BLAS/LAPACK libraries give me expected results which are consistent. No matter the size of the data.

One thing to mention, pcoxtime has most of it's matrix operations implemented using Rcpp and RcppArmadillo.

Here is the example, but first install pcoxtime and also the problem only occurs if you MKL as the default.

Small n: print(mod_coxph) and print(mod_pcox) are close enough, which is what we expect.

# install.packages("pcoxtime")
library(survival)
library(pcoxtime)

set.seed(911)
sims <- simtdc(10)
df <- sims$data
betas <- sims$betas
print(betas)
df <- df[, c("Start", "Stop", "Event", names(betas))]
## coxph
mod_coxph <- coxph(Surv(Start, Stop, Event) ~ ., data = df, method = "breslow")
print(mod_coxph)
## pcoxtime
mod_pcox <- pcoxtime(Surv(Start, Stop, Event) ~ ., data = df, alpha = 1, lambda = 0)
print(mod_pcox)

Relatively large n: print(mod_coxph) and print(mod_pcox) gives inconsistent results

sims <- simtdc(100)
df <- sims$data
betas <- sims$betas
print(betas)
df <- df[, c("Start", "Stop", "Event", names(betas))]
## coxph
mod_coxph <- coxph(Surv(Start, Stop, Event) ~ ., data = df, method = "breslow")
print(mod_coxph)
## pcoxtime
mod_pcox <- pcoxtime(Surv(Start, Stop, Event) ~ ., data = df, alpha = 1, lambda = 0)
print(mod_pcox)

Any help will be appreciated.

Thanks,

when using "sudo", the linux script does not work

in linux, when you when you get to these commands:

echo "/opt/intel/lib/intel64"     >  /etc/ld.so.conf.d/mkl.conf
echo "/opt/intel/mkl/lib/intel64" >> /etc/ld.so.conf.d/mkl.conf
ldconfig

you'll get a permission error, if you use "sudo" in order to obtain root permissions in front of each command. This is because sudo only applies to one command at a time. Either use sudo bash to get a root bash shell, or use quotes around the command with the -sh option, eg. like this:

sudo sh -c "echo '/usr/local/lib' >> /etc/ld.so.conf"

Perhaps this should be made clear in the otherwise excellent guide?

intel-mkl 2020.0.166-1 no longer has /opt/intel

wrt to your helpful script/instructions - it looks like intel-mkl-2020.0.166-1 and the rest of its .deb packages no longer use /opt/intel and instead install everything directly into various standard dirs, which I think makes them visible to compilers w/o needing any env vars.

Moreover the .deb packages no longer include the mklvars.sh script, so now we need to figure out how to set all the different env vars manually for all those projects that expect a gazillion of mkl env vars like: MKL_LIBRARIES MKL_INCLUDE_DIRS MKL_INTERFACE_LIBRARY MKL_SEQUENTIAL_LAYER_LIBRARY MKL_CORE_LIBRARY and fail w/o those preset.

Probably need to fool those with setting MKLROOT=/usr, MKL_LIBRARIES=/usr/lib/x86_64-linux-gnu, etc. But I'm not 100% sure what some of those used to point to.

script.sh does not affect BLAS/LAPACK library for rocker/r-ver:3.6.1

This script works great for rocker/r-ver:3.5.3, but not for rocker/r-ver:3.6.1.
While it appears to execute without error, the BLAS/LAPACK library used by R is unchanged:

$ docker run -it --rm --entrypoint=/bin/bash rocker/r-ver:3.6.1
# apt update && apt install -y --no-install-recommends gnupg wget apt-transport-https
...
# wget https://raw.githubusercontent.com/eddelbuettel/mkl4deb/c82f816/script.sh
# sh script.sh
...
# Rscript -e 'sessionInfo()'
R version 3.6.1 (2019-07-05)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 9 (stretch)

Matrix products: default
BLAS/LAPACK: /usr/lib/libopenblasp-r0.2.19.so
...

Translating into duprkit recipe

My experimental toolkit (assume that you have seen my mails on -devel) enables user to manage tricks with dpkg. The trick means something trivial that cannot be uploaded to Debian, but some people will use it to modify the system, e.g. the not-quite-safe apt accelerator:
https://github.com/dupr/duprkit/blob/master/examples/apt-nosync.rcp
mkl4deb is a good example of "trick" as well. Does it sound good if I translate your script into a Recipe as an experiment?

That means, the user can build a mkl4deb.deb package (empty). Upon postinst, your script will be executed. Upon prerm, the update-alternative changes will be reverted. In that case this "trick" is managed by dpkg and the user can do less.

using MKL with rocker/r-devel

I was tying to use the (updated) script to add MLK support in a rocker/r-devel image (so far just running interactively) to test an R package (/tthps://github.com/merliseclyde/bark) that fails unit-tests on CRAN MKL. (I am guessing it is a random-number threading issue, but would like to debug more)

Script (slightly updated for MKL version) from the one here

# add MKL

apt-get update && apt-get install -y gnupg

cd /tmp
# now get the key:
wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
# now install that key
apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB
# now remove the public key file exit the root shell
# rm GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB

# wget https://apt.repos.intel.com/setup/intelproducts.list -O /etc/apt/sources.list.d/intelproducts.list
## just MKL
sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list'




apt-get update

# use apt-get install intel-mkl to see most recent targets :-)
apt-get install intel-mkl-2020.4-912 2020.4-912

## update alternatives
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so     \
                    libblas.so-x86_64-linux-gnu      /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so.3   \
                    libblas.so.3-x86_64-linux-gnu    /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so   \
                    liblapack.so-x86_64-linux-gnu    /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so.3 \
                    liblapack.so.3-x86_64-linux-gnu  /opt/intel/mkl/lib/intel64/libmkl_rt.so 50
                    
# Next, we have to tell the dyanmic linker about two directories use by the MKL, and have it update its cache:

                    
echo "/opt/intel/lib/intel64"     >  /etc/ld.so.conf.d/mkl.conf
echo "/opt/intel/mkl/lib/intel64" >> /etc/ld.so.conf.d/mkl.conf
ldconfig

But when I go to start r-devel. via RD and run sesssionInfo() I am not seeing the MKL BLAS but:
Matrix products: default BLAS: /usr/local/lib/R/lib/libRblas.so LAPACK: /usr/local/lib/R/lib/libRlapack.so; LAPACK version 3.11.0
Any suggestions of what I may have missed? Is there an existing rocker/r version with MKL support already configured ?

TIA - Merlise

benchmarkme fails

I can't get this to run in a container. benchmarkmefails :(

sessionInfo(); library("benchmarkme"); benchmark_std(runs = 1)

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS/LAPACK: /opt/intel/compilers_and_libraries_2018.2.199/linux/mkl/lib/intel64_lin/libmkl_rt.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.4
# Programming benchmarks (5 tests):
	3,500,000 Fibonacci numbers calculation (vector calc): 0.867 (sec).
	Grand common divisors of 1,000,000 pairs (recursion): 1.38 (sec).
	Creation of a 3500x3500 Hilbert matrix (matrix calc): 0.66 (sec).
	Creation of a 3000x3000 Toeplitz matrix (loops): 15.4 (sec).
	Escoufier's method on a 60x60 matrix (mixed): 1.61 (sec).
# Matrix calculation benchmarks (5 tests):
	Creation, transp., deformation of a 5000x5000 matrix: 1.15 (sec).
	2500x2500 normal distributed random matrix ^1000: 0.659 (sec).
	Sorting of 7,000,000 random values: 0.892 (sec).
	2500x2500 cross-product matrix (b = a' * a): 0.992 (sec).
Error in solve(crossprod(a), crossprod(a, b)) : 
  the leading minor of order 1421 is not positive definite
Calls: benchmark_std ... bm_matrix_cal_lm -> system.time -> solve -> solve -> .Call
Timing stopped at: 1.064 0.032 0.553

It's a ubuntu 16.04 container and here's the mkl part that I use:

# install mkl
RUN wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB -P /tmp \
    && apt-key add /tmp/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB \
    && sh -c 'echo deb https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list' \
    && apt-get update \
    && apt-get install -y intel-mkl-64bit-2018.2-046 \
    && update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so     \
                    libblas.so-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50 \
    && update-alternatives --install /usr/lib/x86_64-linux-gnu/libblas.so.3   \
                    libblas.so.3-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50 \
    && update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so   \
                    liblapack.so-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50 \
    && update-alternatives --install /usr/lib/x86_64-linux-gnu/liblapack.so.3 \
                    liblapack.so.3-x86_64-linux-gnu /opt/intel/mkl/lib/intel64/libmkl_rt.so 50 \
    && echo "/opt/intel/lib/intel64"     >  /etc/ld.so.conf.d/mkl.conf \
    && echo "/opt/intel/mkl/lib/intel64" >> /etc/ld.so.conf.d/mkl.conf \
    && ldconfig

Any ideas /hints? Can you share the Dockerfile you used?

openblas works fine:

sessionInfo(); library("benchmarkme"); benchmark_std(runs = 1)

R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/openblas-base/libblas.so.3
LAPACK: /usr/lib/libopenblasp-r0.2.18.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] compiler_3.4.4
# Programming benchmarks (5 tests):
	3,500,000 Fibonacci numbers calculation (vector calc): 0.874 (sec).
	Grand common divisors of 1,000,000 pairs (recursion): 1.31 (sec).
	Creation of a 3500x3500 Hilbert matrix (matrix calc): 0.23 (sec).
	Creation of a 3000x3000 Toeplitz matrix (loops): 16.9 (sec).
	Escoufier's method on a 60x60 matrix (mixed): 1.28 (sec).
# Matrix calculation benchmarks (5 tests):
	Creation, transp., deformation of a 5000x5000 matrix: 1.31 (sec).
	2500x2500 normal distributed random matrix ^1000: 0.769 (sec).
	Sorting of 7,000,000 random values: 0.918 (sec).
	2500x2500 cross-product matrix (b = a' * a): 0.558 (sec).
	Linear regr. over a 3000x3000 matrix (c = a \ b'): 0.396 (sec).
# Matrix function benchmarks (5 tests):
	Cholesky decomposition of a 3000x3000 matrix: 0.773 (sec).
	Determinant of a 2500x2500 random matrix: 1.03 (sec).
	Eigenvalues of a 640x640 random matrix: 0.865 (sec).
	FFT over 2,500,000 random values: 0.536 (sec).
	Inverse of a 1600x1600 random matrix: 0.81 (sec).
     user system elapsed          test test_group cores
1   0.856  0.016   0.874           fib       prog     0
2   1.220  0.088   1.309           gcd       prog     0
3   0.176  0.056   0.230       hilbert       prog     0
4  16.824  0.032  16.947      toeplitz       prog     0
5   1.236  0.040   1.278     escoufier       prog     0
6   1.232  0.048   1.314         manip matrix_cal     0
7   0.768  0.000   0.769         power matrix_cal     0
8   0.892  0.024   0.918          sort matrix_cal     0
9   0.952  0.536   0.558 cross_product matrix_cal     0
10  0.848  0.468   0.396            lm matrix_cal     0
11  0.812  0.784   0.773      cholesky matrix_fun     0
12  1.516  0.384   1.027   determinant matrix_fun     0
13  0.936  1.608   0.865         eigen matrix_fun     0
14  0.536  0.000   0.536           fft matrix_fun     0
15  1.264  0.732   0.810       inverse matrix_fun     0

installation failed behind proxy

I followed the same steps as in script.h for installing but there were some certificate and proxy related issues. On modifying the commands as below, I am now getting "unexpected TLS packet error".

$ wget -q0- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2019.PUB --no-check-certificate 
$ apt-key --keyring /usr/share/keyrings/intel-sw-products.gpg add - 
$ echo 'deb [signed by=/usr/share/keyrings/intel-sw-products.gpg trusted=yes] https://apt.repos.intel.com/mkl all main > /etc/apt/sources.list.d/intel-mkl.list
$ apt-get update
$ apt-get install intel-mkl-64bit-2019.2-057
Ign:1 https://apt.repos.intel.com/mkl all InRelease
Ign:2 https://apt.repos.intel.com/mkl all Release
Ign:3 https://apt.repos.intel.com/mkl all/main all Packages
Ign:4 https://apt.repos.intel.com/mkl all/main i386 Packages
Ign:5 https://apt.repos.intel.com/mkl all/main amd64 Packages
Err:4 https://apt.repos.intel.com/mkl all/main i386 Packages
Could not handshake: An unexpected TLS packet was received. [IP: <ip port>]
E: Failed to fetch https://apt.repos.intel.com/mkl/dists/all/main/binary-i386/Packages
Could not handshake: An unexpected TLS packet was received. [IP: <ip port>]

I am working on Ubuntu 18.04 and the proxy configuration has already been set in /etc/apt/apt.conf

Please let me know if anyone has ideas on how to resolve this issue.

Fixing problems with MKL when using `intel-mkl`

Documenting here how to get R working properly with MKL when installing the intel-mkl package on Ubuntu.

I am running Ubuntu 20.4 LTS and R 4.2.2
Install the MKL package sudo apt install intel-mkl

If you are working in the R console, it is sufficient to set MKL_THREADING_LAYER=GNU or MKL_THREADING_LAYER=SEQUENTIAL environment variables, eg in /etc/environment. The terminal session needs to be restarted (not just the R session).

RStudio won't load these variables however - it needs to be set in an .Renviron file in the home directory. Restart R after modifying .Renviron.

With either approach, verify the MKL_THREADING_LAYER variable is set by runnning Sys.getenv().

With the above approach, I am seeing consistent behaviour of pcox with small and large data uisng MKL as described in #13 (comment)
The example in the bug reported here https://bugs.launchpad.net/ubuntu/+source/intel-mkl/+bug/1989161 is resolved.
The issue with running benchmarks described here #2 (comment) is also resolved.

Repository and package are now named `oneapi-mkl`

Newer versions of MKL are now uploaded into a different repository called "oneapi-mkl" instead of just "mkl" - the newest version in the repository referenced in this guide stands at around 2020.something, whereas the current version is 2023.something.

These are the instructions that they provide in their webpage:

wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \
| gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
sudo apt install intel-oneapi-mkl

Adding MKL support to bioconductor docker

Hi,

Thanks a lot for your wonderful script. I am trying to update bioconductor docker to support MKL. I followed all the mentioned steps, but I still get that sessionInfo() uses OpenBLAS:

sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.4 LTS

Matrix products: default
BLAS/LAPACK: /usr/lib/x86_64-linux-gnu/libopenblasp-r0.2.20.so

locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=C
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] BiocManager_1.30.10

loaded via a namespace (and not attached):
[1] compiler_4.0.0

I were able to compile R 4.0 with MKL with no problem, and the performance increase is drastic. I am trying to see if I can achieve the same without compiling R from scratch. I would greatly appreciate your feedback.

Thanks,
-- Shahin.

Bumping priority number to > 100

Sebastien and I bumped Debian's OpenBLAS priority number to 100. That means people who use Buster (or newer) will find this script not working because it assigns 50 to MKL (I guess they still need the /opt installation layout for some reason).

MKL threading

First of all, thank you for the update-alternatives trick! I had no idea that libmkl_rt.so can stand for all four libraries. It's just WOW! A fantastic trick!

I'm a little bit worried about your unconditional recommendation to use MKL_THREADING_LAYER=GNU. I've been doing numerical stuff with MKL for many years, and (while I normally went with TBB threading, as it seems to have the least lock contention) the results are mixed. Sometimes it's a big gain on one architecture, and slows down the computation on another. My most surprising moment was when I ran the same program on an MS Server (2012 R2, IIRC), and on a Hyper-V VM on the same host, with the same OS, same number of CPU and a lot of RAM (probably less that the host, but close). I've got a big gain on the VM, but unexpected drop in speed on the host (yes, not the other way round!)

I suggest maybe adding a paragraph that the users should try also MKL_THREADING_LAYER=SEQUENTIAL and see which one is actually better for their problem would be helpful. It's really both problem-dependent and hardware-dependent. The LinPACK benchmark always benefits from threading, in my experience, so it should be the real code for their task that they test the performance on. My impression is MKL does not always makes the best choice as to whether shard the computation between threads or not.

FWIW, the default for MKL_THREADING_LAYER is intel.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.