Skip to content

Instantly share code, notes, and snippets.

@tsuchm
Last active August 12, 2019 07:59
Show Gist options
  • Select an option

  • Save tsuchm/20fb69e1792f6532fc5031027ecb5247 to your computer and use it in GitHub Desktop.

Select an option

Save tsuchm/20fb69e1792f6532fc5031027ecb5247 to your computer and use it in GitHub Desktop.
Ansible playbook to install Intel MKL debian package (for Buster)
- name: Add Intel-MKL packages
apt:
name: intel-mkl
state: latest
- name: Install python3-pip
apt:
name: ['python3-pip',
'python3-setuptools',
'python3-numpy',
'python3-scipy',
'gfortran']
state: latest
- name: Prepare the site configuration file to build NumPy/SciPy
copy: src="numpy-site.cfg" dest="/root/.numpy-site.cfg" owner=root group=root mode=0644
- name: Prepare the PIP configuration file to build NumPy/SciPy
copy: src="pip.conf" dest="/root/.config/pip/" owner=root group=root mode=0644
register: pip_numpy
- name: Install python-setuptools to avoid the bug of ansible pip module, described at https://github.com/ansible/ansible/issues/47361
apt:
name: python-setuptools
state: latest
- name: Build NumPy/SciPy to /usr/local/lib/pythonX.Y/
pip:
name: ['numpy', 'scipy']
state: latest
executable: pip3
register: pip_numpy
- name: Check NumPy using Intel MKL
shell: python3 -c "import numpy;numpy.show_config();"|grep -q mkl_rt
register: numpy_result
changed_when: numpy_result.rc != 0
when: pip_numpy.changed
- name: Check SciPy using Intel MKL
shell: python3 -c "import scipy;scipy.show_config();"|grep -q mkl_rt
register: scipy_result
changed_when: scipy_result.rc != 0
when: pip_numpy.changed
[mkl]
library_dirs = /usr/lib/x86_64-linux-gnu
include_dirs = /usr/include/mkl
mkl_libs = mkl_rt
lapack_libs =
[install]
no-binary = numpy,scipy
[wheel]
no-binary = numpy,scipy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment