Daily Note - 20-05-2024

bash
lightgbm
Author

JM Ascacibar

Published

May 20, 2024

Installing Lightgbm GPU version

Daily Note - 20/05/2024

1. Installing Lightgbm GPU version (Linux)

The first thing you need to do is to verify that your WSL version support GPU. You can check it by running nvidia-smi in the terminal. Second thing is to update your package list sudo apt-get update.

Next step, we are going to check if OpenCL is installed in your system. You can check it by running clinfo in the terminal. If it is not installed, you can install it by running sudo apt-get install clinfo. Once you have installed OpenCL, we need to install OpenCL headers and libraries. You can do it by running sudo apt-get install ocl-icd-opencl-dev.

Now, we are going to check for Boost installation. You can check it by running dpkg -s libboost-dev | grep 'Version'. If it is not installed, you can install it by running sudo apt install libboost-dev libboost-system-dev libboost-filesystem-dev.

Next, we need to install CMake and GCC or Clang. You can install CMake by running sudo apt install cmake. For GCC, you can install it by running sudo apt install gcc. For Clang, you can install it by running sudo apt install clang.

Now, we are ready to clone Lightgbm repository and build with GPU support.

git clone --recursive https://github.com/microsoft/LightGBM
cd LightGBM
mkdir build
cd build

After that, we need to configure the build for GPU. You can do it by running cmake -DUSE_GPU=1 ... Once the configuration is done, you can build Lightgbm by running make -j4.

2. Installing a new version of CMake

The first thing you need to do is to download the latest version of CMake from the official website.

wget https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1.tar.gz

Extract the source code

tar -xzvf cmake-3.23.1.tar.gz
cd cmake-3.23.1

Compile CMake

./bootstrap && make

I have an error because I didn’t have OpenSSL Development package installed. You can install it by running sudo apt-get install libssl-dev. After that, you can run ./bootstrap && make again.make

Install CMake

sudo make install

Verify the installation

cmake --version
Back to top