Skip to content

Instantly share code, notes, and snippets.

@yoshipon
Created July 25, 2020 09:40
Show Gist options
  • Save yoshipon/6597607d71c67fe47e3f65c7d4298499 to your computer and use it in GitHub Desktop.
Save yoshipon/6597607d71c67fe47e3f65c7d4298499 to your computer and use it in GitHub Desktop.
A singularity recipe for NumPy w/ AOCL
# 1. Download `aocl-linux-gcc-2.2.0_1_amd64.deb` into the same directory as this config file.
# 2. Build the container with `sudo singularity build numpy-aocl.img numpy-aocl.conf`.
# 3. Run ipython with `OMP_NUM_THREADS=64 singularity exec numpy-aocl.img ipython`.
Bootstrap: docker
From: continuumio/anaconda3
%files
aocl-linux-gcc-2.2.0_1_amd64.deb /tmp
%environment
PATH=/opt/conda/bin:$PATH
export PATH
%post
PATH=/opt/conda/bin:$PATH
export PATH
apt update --fix-missing
apt install -y build-essential
# install AOCL
apt install -y /tmp/aocl-linux-gcc-2.2.0_1_amd64.deb
# install NumPy
cd /opt
git clone https://github.com/numpy/numpy.git
cd ./numpy
cat <<EOL >> site.cfg
[blis]
libraries = blis-mt
library_dirs = /opt/AMD/aocl/aocl-linux-gcc-2.2.0/lib
include_dirs = /opt/AMD/aocl/aocl-linux-gcc-2.2.0/include
runtime_library_dirs = /opt/AMD/aocl/aocl-linux-gcc-2.2.0/lib
[flame]
libraries = flame
library_dirs = /opt/AMD/aocl/aocl-linux-gcc-2.2.0/lib
runtime_library_dirs = /opt/AMD/aocl/aocl-linux-gcc-2.2.0/lib
EOL
NPY_BLAS_ORDER=blis NPY_LAPACK_ORDER=flame pip install .
# clean up
apt clean
%runscript
ipython
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment