Skip to content

Instantly share code, notes, and snippets.

@aminnj
Created September 23, 2018 00:41
Show Gist options
  • Save aminnj/884d72106589466dd01a5a6d3d3869cb to your computer and use it in GitHub Desktop.
Save aminnj/884d72106589466dd01a5a6d3d3869cb to your computer and use it in GitHub Desktop.
installing xgboost with gpu support on uaf-1
# main instructions from https://xgboost.readthedocs.io/en/latest/build.html#building-with-gpu-support
# first install cmake somewhere
curl -O -L https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
tar xf cmake*.tar.gz
cd cmake*/
export CMAKE_ROOT=`pwd`
# get 10X environment for slc7
cd /cvmfs/cms.cern.ch/slc7_amd64_gcc630/cms/cmssw/CMSSW_10_2_0_pre6/ ; cmsenv ; cd -
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
mkdir build
cd build
# either put cmake on the path or just use absolute path for the executable
cmake .. -DUSE_CUDA=ON -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-9.2/
make -j15
cd ..
export PYTHONPATH=`pwd`/python-package/:$PYTHONPATH
export PATH=/usr/local/cuda-9.2/bin:$PATH
export PYTHONPATH=`pwd`/python-package/:$PYTHONPATH
# need to remove the cuda libraries that CMSSW already has in /external/cuda so that our cuda-9.2 gets used
export LD_LIBRARY_PATH=$(echo $LD_LIBRARY_PATH | sed 's#/[^:]*/external/cuda/[^:]*##')
export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64:${LD_LIBRARY_PATH}
python tests/benchmark/benchmark_tree.py --params "{'gpu_id':1}" --iterations 100 --tree_method "gpu_hist"
# compare with `--tree_method "hist"` and without (by default, tree_method is gpu_hist)
# some example numbers with 4 methods (hist is default, gpu_hist should be the fastest IF the GPU architecture >= pascal)
# for reference, the GeForce Titan X's on uaf1 are maxwell, which is older than pascal :(
# hist (cpu): 4.7sec
# exact (cpu): 6.8sec
# gpu_hist (gpu): 46sec
# gpu_exact (gpu): 4.5sec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment