Skip to content

Instantly share code, notes, and snippets.

@ironmaniiith
Last active August 8, 2018 12:29
Show Gist options
  • Save ironmaniiith/c1c2fd943ecf81473d7fa23b8e0fae92 to your computer and use it in GitHub Desktop.
Save ironmaniiith/c1c2fd943ecf81473d7fa23b8e0fae92 to your computer and use it in GitHub Desktop.
Caffe installation script for ada
#!/usr/bin/bash
# Make sure to export $PREFIX as full path name
# ex. export PREFIX=/home/ironmaniiith/caffe_installation
if [ -z "$PREFIX" ]; then
echo "error: PREFIX variable not found"
exit 1
fi
if [ ! -d "$PREFIX" ]; then
echo "No such directory: $PREFIX. Directory will be created"
fi
MODULES=(cuda/8.0 glog/0.3.5 opencv/3.3.0 gflags/2.2.1 cudnn/5.1-cuda-8.0)
for module in ${MODULES[*]}; do
module load "$module"
done
mkdir -p "$PREFIX"; cd "$PREFIX"
git clone "https://github.com/BVLC/caffe"
cd caffe
# Download the Makefile.config for building caffe on ada
wget -O "Makefile.config" "https://gist.githubusercontent.com/ironmaniiith/bede031d643b2fd3c3692ecca5fa79af/raw/a3c8d036ca4e253ade3341fa4cd2610681e9af29/Makefile.config"
mkdir -p build
cd build
cmake -DBUILD_TIFF=ON .. -Wno-dev
make -j `nproc`
make pycaffe
echo -e "# The following line is generated as part of caffe installation process\nexport PYTHONPATH=$PREFIX/caffe/python:$PYTHONPATH" >> ~/.bashrc
# additionally install the following pip packages
pip2 install --user protobuf scikit-image
source ~/.bashrc
# Check whether caffe is succesfully installed or not
python -c 'import caffe' && echo 'Caffe succesfully installed'
@ironmaniiith
Copy link
Author

In order to use caffe later (after installation), run the following command

MODULES=(cuda/8.0 glog/0.3.5 opencv/3.3.0 gflags/2.2.1 cudnn/5.1-cuda-8.0)
for module in ${MODULES[*]}; do
  module load "$module"
done

@jerinphilip
Copy link

We can use prereq while shipping module. This was just a starting point, no need to overoptimize. Is this python2 in particular? How hard is a python3 setup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment