Skip to content

Instantly share code, notes, and snippets.

@teju85
Last active December 23, 2019 05:54
Show Gist options
  • Save teju85/51ff12886f5ae9967a4cab6fd0376953 to your computer and use it in GitHub Desktop.
Save teju85/51ff12886f5ae9967a4cab6fd0376953 to your computer and use it in GitHub Desktop.
Wrapper script to setup RAPIDS development environment from scratch
#!/bin/bash
if [ -z $Root ]; then
Root=$HOME
fi
if [ -z $CudaVersion ]; then
CudaVersion=10.1
fi
CondaFile="Miniconda3-latest-Linux-x86_64.sh"
CondaRepo="https://repo.anaconda.com/miniconda/$CondaFile"
CondaLocation=$Root/conda
Conda=$CondaLocation/bin/conda
CudfLocation=$Root/cudf
CumlLocation=$Root/cuml
function __installConda() {
if [ -x $Conda ]; then
echo "Conda already seems to be installed"
return
fi
wget $CondaRepo && \
/bin/bash $CondaFile -b -p $CondaLocation && \
$Conda update -n base conda && \
rm -f $CondaFile
}
function __installCudfDeps() {
if [ ! -d $CudfLocation ]; then
git clone --recursive https://github.com/rapidsai/cudf $CudfLocation
fi
$Conda env list | grep -q cudf_dev
if [ "$?" = "0" ]; then
echo "cudf_dev conda env already exists"
return
fi
cd $CudfLocation && \
$Conda env create --name cudf_dev --file \
conda/environments/cudf_dev_cuda${CudaVersion}.yml
}
function installCudf() {
__installConda && \
__installCudfDeps && \
export PATH=$CondaLocation/bin:$PATH && \
source activate cudf_dev && \
cd $CudfLocation && \
./build.sh
}
function __installCumlDeps() {
if [ ! -d $CumlLocation ]; then
git clone --recursive https://github.com/rapidsai/cuml $CumlLocation
fi
$Conda env list | grep -q cuml_dev
if [ "$?" = "0" ]; then
echo "cuml_dev conda env already exists"
return
fi
cd $CumlLocation && \
$Conda env create --name cuml_dev --file \
conda/environments/cuml_dev_cuda${CudaVersion}.yml && \
export PATH=$CondaLocation/bin:$PATH
}
function __printCumlSetupInstructions() {
echo "Execute the following commands in your bash terminal to complete the
setup. Or, better yet, put these in your ~/.bashrc.
export PATH=$CondaLocation/bin:\$PATH
source activate cuml_dev
export LD_LIBRARY_PATH=\$CONDA_PREFIX/lib:\$LD_LIBRARY_PATH
Your cuML repository has also been created at '$CumlLocation'. Feel free to use
this for your developmental purposes."
}
function installCuml() {
__installConda && \
__installCumlDeps && \
export PATH=$CondaLocation/bin:$PATH && \
source activate cuml_dev && \
export LD_LIBRARY_PATH=$CONDA_PREFIX/lib:$LD_LIBRARY_PATH && \
cd $CumlLocation && \
env BUILD_ABI=OFF ./build.sh && \
__printCumlSetupInstructions
}
function printHelp() {
echo "rapids-setup
Simple script to help setup non-docker RAPIDS development environment from
scratch.
USAGE:
rapids-setup [-h] [installCuml|installCudf]
OPTIONS:
-h Print this help and exit
installCuml Install cuML development environment
installCudf Install cuDF development environment (not yet tested!)
Environment Variables:
Root Location where to install anaconda and cuML/cuDF repos [$Root]
CudaVersion CUDA Toolkit version to be used for development [$CudaVersion].
Make sure that the corresponding cuda toolkit installation is
available on your system and is in the \$PATH env variable."
}
while [ "$1" != "" ]; do
cmd=$1
shift
if [ "$cmd" = "-h" ]; then
printHelp
exit 0
fi
$cmd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment