Skip to content

Instantly share code, notes, and snippets.

@wjn0
Last active December 3, 2021 18:04
Show Gist options
  • Save wjn0/fd1ded8a6e5033e5ca0d00ac131469ee to your computer and use it in GitHub Desktop.
Save wjn0/fd1ded8a6e5033e5ca0d00ac131469ee to your computer and use it in GitHub Desktop.
Install GPULS in McMaster env
#!/bin/bash
# Install Spack. This allows us to run packages in user-space without
# conflicting with server-wide installs or anything else you've installed
# locally. The downside is we have to worry about our own dependencies and
# installations take a while because they build from source. But they're
# reliable.
cd $HOME
git clone -c feature.manyFiles=true https://github.com/spack/spack.git
. $HOME/spack/share/spack/setup-env.sh
echo ". $HOME/spack/share/spack/setup-env.sh" >> $HOME/.bashrc
# The SSL library on both servers seems to be borked. Use spack to replace it.
# spack install openssl
# spack load openssl
# echo "spack load openssl" >> $HOME/.bashrc
# Install a new compiler. The built-in compiler on the McMaster server does not
# have a Fortran compiler, which R requires, so we upgrade to the latest gcc under
# spack (again, a local install, so no risk of conflict).
# spack install gcc@9.4.0
# spack load gcc@9.4.0
# spack compiler find
# Install R and Python versions that are known to work with GPULS.
spack install python@3.6.9
# spack install r@4.1.1 %gcc@9.4.0
# Load the new Python install. It doesn't come with the Python package manager
# pip, so `ensurepip` will get that installed. We can then install the Python
# packages that GPULS depends on.
spack load python@3.6.9
echo "spack load python@3.6.9" >> $HOME/.bashrc
python3 -m ensurepip
python3 -m pip install --user torch pynvml numpy scipy h5py rpy2
# Load the new R install. Install the dependencies that allow us to read and
# write hdf5 files to communicate with Python.
# spack load r@4.1.1
# echo "spack load r" >> $HOME/.bashrc
mkdir -p $HOME/.local/lib/R_4.0.5
R -q -e 'install.packages("BiocManager", repos="http://cran.us.r-project.org", lib="~/.local/lib/R_4.0.5")'
R -q -e 'BiocManager::install("rhdf5", lib="~/.local/lib/R_4.0.5")'
# Clone gpuls and add to path.
cd $HOME
git clone https://github.com/hamilton-health-sciences/gpuls.git
cd gpuls
git checkout apollo
export PATH=$HOME/gpuls:$PATH
echo 'export PATH=$HOME/gpuls:$PATH' >> $HOME/.bashrc
# Test that gpuls is callable.
gpuls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment