Ubuntu-16.04-GPU-Bootstrap 3.25 KB
Newer Older
easybuild's avatar
easybuild committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
Bootstrap: docker
From: ubuntu:latest

%setup
cp /apps/easybuild/sources/n/NVIDIA/NVIDIA-Linux-x86_64-390.30.run /tmp

%post
apt -y update && apt -y upgrade
apt -y install python curl wget gcc g++ make vim mc libncurses-dev rsync tclsh lua5.2 liblua5.2 gfortran ssh

curl -s -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py
pip install setuptools python-graph-core python-graph-dot tabulate numpy scipy pandas wheel --upgrade

wget https://github.com/luarocks/luarocks/archive/v2.4.2.tar.gz
tar xvf v2.4.2.tar.gz
cd luarocks-2.4.2
./configure
make build
make install
mkdir ~/.luarocks
echo "fs_use_modules = false" > ~/.luarocks/config.lua
luarocks install luaposix
luarocks install luafilesystem
LUAROCKS_PREFIX=/usr/local
export LUA_PATH="$LUAROCKS_PREFIX/share/lua/5.1/?.lua;$LUAROCKS_PREFIX/share/lua/5.1/?/init.lua;;"
export LUA_CPATH="$LUAROCKS_PREFIX/lib/lua/5.1/?.so;;"

echo "# !/bin/bash" > /bin/logger
echo "exit 0" >> /bin/logger
chmod +x /bin/logger

# Lmod
wget https://github.com/TACC/Lmod/archive/7.7.7.tar.gz
tar xvf 7.7.7.tar.gz
cd Lmod-7.7.7
./configure --prefix=/opt/apps
make install

# OpenMPI
wget https://www.open-mpi.org/software/ompi/v2.1/downloads/openmpi-2.1.1.tar.gz
tar xvf openmpi-2.1.1.tar.gz && cd openmpi-2.1.1
./configure --prefix=/usr/local
make -j 16
make install

# GPU
driver_version=390.30
driver="/tmp/NVIDIA-Linux-x86_64-$driver_version.run"
sh $driver -x
mv NVIDIA-Linux-x86_64-$driver_version /usr/local/
dir=/usr/local/NVIDIA-Linux-x86_64-$driver_version
cd $dir
ln -s libcuda.so.$driver_version libcuda.so
ln -s libEGL.so.$driver_version libEGL.so
ln -s libGLESv1_CM.so.$driver_version libGLESv1_CM.so
ln -s libGLESv2.so.$driver_version libGLESv2.so
ln -s libGL.so.$driver_version libGL.so
ln -s libglx.so.$driver_version libglx.so
ln -s libnvcuvid.so.$driver_version libnvcuvid.so
ln -s libnvidia-cfg.so.$driver_version libnvidia-cfg.so
ln -s libnvidia-compiler.so.$driver_version libnvidia-compiler.so
ln -s libnvidia-eglcore.so.$driver_version libnvidia-eglcore.so
ln -s libnvidia-encode.so.$driver_version libnvidia-encode.so
ln -s libnvidia-fbc.so.$driver_version libnvidia-fbc.so
ln -s libnvidia-glcore.so.$driver_version libnvidia-glcore.so
ln -s libnvidia-glsi.so.$driver_version libnvidia-glsi.so
ln -s libnvidia-gtk2.so.$driver_version libnvidia-gtk2.so
ln -s libnvidia-gtk3.so.$driver_version libnvidia-gtk3.so
ln -s libnvidia-ifr.so.$driver_version libnvidia-ifr.so
ln -s libnvidia-ml.so.$driver_version libnvidia-ml.so
ln -s libnvidia-ml.so.$driver_version libnvidia-ml.so.1
ln -s libnvidia-opencl.so.$driver_version libnvidia-opencl.so
ln -s libnvidia-tls.so.$driver_version libnvidia-tls.so
ln -s libnvidia-wfb.so.$driver_version libnvidia-wfb.so
ln -s libvdpau_nvidia.so.$driver_version libvdpau_nvidia.so
ln -s libvdpau.so.$driver_version libvdpau.so
ln -s libvdpau_trace.so.$driver_version libvdpau_trace.so
ln -s libcuda.so.$driver_version libcuda.so.1

# APPS and SCRATCH
mkdir /apps
mkdir /scratch

cd /bin
rm sh && ln -s /bin/bash sh

%environment
source /opt/apps/lmod/7.7.7/init/profile
clearMT
export -f ml
export -f module
export -f clearMT
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64:/usr/local/NVIDIA-Linux-x86_64-390.30:$LD_LIBRARY_PATH
export PATH=/usr/local/NVIDIA-Linux-x86_64-390.30:/usr/local/cuda/bin:$PATH