[doc] prefer 'cmake -B' and 'cmake --build' everywhere (#10717)
This commit is contained in:
parent
24d225c1ab
commit
03bd1183bc
@ -18,8 +18,8 @@ run CMake with option ``-DPLUGIN_RMM=ON`` (``-DUSE_CUDA=ON`` also required):
|
|||||||
|
|
||||||
.. code-block:: sh
|
.. code-block:: sh
|
||||||
|
|
||||||
cmake .. -DUSE_CUDA=ON -DUSE_NCCL=ON -DPLUGIN_RMM=ON
|
cmake -B build -S . -DUSE_CUDA=ON -DUSE_NCCL=ON -DPLUGIN_RMM=ON
|
||||||
make -j$(nproc)
|
cmake --build build -j$(nproc)
|
||||||
|
|
||||||
CMake will attempt to locate the RMM library in your build environment. You may choose to build
|
CMake will attempt to locate the RMM library in your build environment. You may choose to build
|
||||||
RMM from the source, or install it using the Conda package manager. If CMake cannot find RMM, you
|
RMM from the source, or install it using the Conda package manager. If CMake cannot find RMM, you
|
||||||
@ -28,9 +28,9 @@ should specify the location of RMM with the CMake prefix:
|
|||||||
.. code-block:: sh
|
.. code-block:: sh
|
||||||
|
|
||||||
# If using Conda:
|
# If using Conda:
|
||||||
cmake .. -DUSE_CUDA=ON -DUSE_NCCL=ON -DPLUGIN_RMM=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
cmake -B build -S . -DUSE_CUDA=ON -DUSE_NCCL=ON -DPLUGIN_RMM=ON -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
||||||
# If using RMM installed with a custom location
|
# If using RMM installed with a custom location
|
||||||
cmake .. -DUSE_CUDA=ON -DUSE_NCCL=ON -DPLUGIN_RMM=ON -DCMAKE_PREFIX_PATH=/path/to/rmm
|
cmake -B build -S . -DUSE_CUDA=ON -DUSE_NCCL=ON -DPLUGIN_RMM=ON -DCMAKE_PREFIX_PATH=/path/to/rmm
|
||||||
|
|
||||||
********************************
|
********************************
|
||||||
Informing XGBoost about RMM pool
|
Informing XGBoost about RMM pool
|
||||||
|
|||||||
@ -68,10 +68,8 @@ After obtaining the source code, one builds XGBoost by running CMake:
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cd xgboost
|
cd xgboost
|
||||||
mkdir build
|
cmake -B build -S .
|
||||||
cd build
|
cmake --build build -j$(nproc)
|
||||||
cmake ..
|
|
||||||
make -j$(nproc)
|
|
||||||
|
|
||||||
Building on MacOS
|
Building on MacOS
|
||||||
=================
|
=================
|
||||||
@ -94,12 +92,10 @@ following from the root of the XGBoost directory:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -G"Visual Studio 14 2015 Win64"
|
||||||
cd build
|
# for VS15: cmake -B build -S . -G"Visual Studio 15 2017" -A x64
|
||||||
cmake .. -G"Visual Studio 14 2015 Win64"
|
# for VS16: cmake -B build -S . -G"Visual Studio 16 2019" -A x64
|
||||||
# for VS15: cmake .. -G"Visual Studio 15 2017" -A x64
|
cmake --build build --config Release
|
||||||
# for VS16: cmake .. -G"Visual Studio 16 2019" -A x64
|
|
||||||
cmake --build . --config Release
|
|
||||||
|
|
||||||
This specifies an out of source build using the Visual Studio 64 bit generator. (Change the ``-G`` option appropriately if you have a different version of Visual Studio installed.)
|
This specifies an out of source build using the Visual Studio 64 bit generator. (Change the ``-G`` option appropriately if you have a different version of Visual Studio installed.)
|
||||||
|
|
||||||
@ -127,10 +123,8 @@ From the command line on Linux starting from the XGBoost directory:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -DUSE_CUDA=ON
|
||||||
cd build
|
cmake --build build -j4
|
||||||
cmake .. -DUSE_CUDA=ON
|
|
||||||
make -j4
|
|
||||||
|
|
||||||
.. note:: Specifying compute capability
|
.. note:: Specifying compute capability
|
||||||
|
|
||||||
@ -142,10 +136,8 @@ From the command line on Linux starting from the XGBoost directory:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -DUSE_CUDA=ON -DUSE_NCCL=ON -DNCCL_ROOT=/path/to/nccl2
|
||||||
cd build
|
cmake --build build -j4
|
||||||
cmake .. -DUSE_CUDA=ON -DUSE_NCCL=ON -DNCCL_ROOT=/path/to/nccl2
|
|
||||||
make -j4
|
|
||||||
|
|
||||||
Some additional flags are available for NCCL, ``BUILD_WITH_SHARED_NCCL`` enables building XGBoost with NCCL as a shared library, while ``USE_DLOPEN_NCCL`` enables XGBoost to load NCCL at runtime using ``dlopen``.
|
Some additional flags are available for NCCL, ``BUILD_WITH_SHARED_NCCL`` enables building XGBoost with NCCL as a shared library, while ``USE_DLOPEN_NCCL`` enables XGBoost to load NCCL at runtime using ``dlopen``.
|
||||||
|
|
||||||
@ -153,9 +145,7 @@ On Windows, run CMake as follows:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -G"Visual Studio 17 2022" -A x64 -DUSE_CUDA=ON
|
||||||
cd build
|
|
||||||
cmake .. -G"Visual Studio 17 2022" -A x64 -DUSE_CUDA=ON
|
|
||||||
|
|
||||||
(Change the ``-G`` option appropriately if you have a different version of Visual Studio installed.)
|
(Change the ``-G`` option appropriately if you have a different version of Visual Studio installed.)
|
||||||
|
|
||||||
@ -163,7 +153,7 @@ The above cmake configuration run will create an ``xgboost.sln`` solution file i
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cmake --build . --target xgboost --config Release
|
cmake --buildbuild. --target xgboost --config Release
|
||||||
|
|
||||||
To speed up compilation, run multiple jobs in parallel by appending option ``-- /MP``.
|
To speed up compilation, run multiple jobs in parallel by appending option ``-- /MP``.
|
||||||
|
|
||||||
@ -250,14 +240,11 @@ There are several ways to build and install the package from source:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Under xgboost source directory
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
# Build shared library libxgboost.so
|
# Build shared library libxgboost.so
|
||||||
cmake .. -GNinja
|
cmake -B build -S . -GNinja
|
||||||
ninja
|
cmake --build build
|
||||||
# Install as editable installation
|
# Install as editable installation
|
||||||
cd ../python-package
|
cd ./python-package
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
4. Use ``libxgboost.so`` on system path.
|
4. Use ``libxgboost.so`` on system path.
|
||||||
@ -336,11 +323,8 @@ above snippet can be replaced by:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -DR_LIB=ON
|
||||||
cd build
|
cmake --build build --target install -j$(nproc)
|
||||||
cmake .. -DR_LIB=ON
|
|
||||||
make -j$(nproc)
|
|
||||||
make install
|
|
||||||
|
|
||||||
|
|
||||||
Installing the development version with Visual Studio (Windows)
|
Installing the development version with Visual Studio (Windows)
|
||||||
@ -368,10 +352,8 @@ Open the Command Prompt and navigate to the XGBoost directory, and then run the
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cd C:\path\to\xgboost
|
cd C:\path\to\xgboost
|
||||||
mkdir build
|
cmake -B build -S . -G"Visual Studio 16 2019" -A x64 -DR_LIB=ON -DR_VERSION=4.0.0
|
||||||
cd build
|
cmake --build build --target install --config Release
|
||||||
cmake .. -G"Visual Studio 16 2019" -A x64 -DR_LIB=ON -DR_VERSION=4.0.0
|
|
||||||
cmake --build . --target install --config Release
|
|
||||||
|
|
||||||
|
|
||||||
.. _r_gpu_support:
|
.. _r_gpu_support:
|
||||||
@ -385,10 +367,8 @@ On Linux, starting from the XGBoost directory type:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -DUSE_CUDA=ON -DR_LIB=ON
|
||||||
cd build
|
cmake --build build --target install -j$(nproc)
|
||||||
cmake .. -DUSE_CUDA=ON -DR_LIB=ON
|
|
||||||
make install -j$(nproc)
|
|
||||||
|
|
||||||
When default target is used, an R package shared library would be built in the ``build`` area.
|
When default target is used, an R package shared library would be built in the ``build`` area.
|
||||||
The ``install`` target, in addition, assembles the package files with this shared library under ``build/R-package`` and runs ``R CMD INSTALL``.
|
The ``install`` target, in addition, assembles the package files with this shared library under ``build/R-package`` and runs ``R CMD INSTALL``.
|
||||||
@ -413,10 +393,8 @@ Open the Command Prompt and navigate to the XGBoost directory, and then run the
|
|||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
cd C:\path\to\xgboost
|
cd C:\path\to\xgboost
|
||||||
mkdir build
|
cmake -B build -S . -G"Visual Studio 16 2019" -A x64 -DUSE_CUDA=ON -DR_LIB=ON -DR_VERSION=4.0.0
|
||||||
cd build
|
cmake --build build --target install --config Release
|
||||||
cmake .. -G"Visual Studio 16 2019" -A x64 -DUSE_CUDA=ON -DR_LIB=ON -DR_VERSION=4.0.0
|
|
||||||
cmake --build . --target install --config Release
|
|
||||||
|
|
||||||
If CMake can't find your R during the configuration step, you might provide the location of R to CMake like this: ``-DLIBR_HOME="C:\Program Files\R\R-4.0.0"``.
|
If CMake can't find your R during the configuration step, you might provide the location of R to CMake like this: ``-DLIBR_HOME="C:\Program Files\R\R-4.0.0"``.
|
||||||
|
|
||||||
|
|||||||
@ -130,10 +130,9 @@ To build and run C++ unit tests enable tests while running CMake:
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
mkdir build
|
cmake -B build -S . -GNinja -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON -DUSE_CUDA=ON -DUSE_NCCL=ON
|
||||||
cd build
|
cmake --build build
|
||||||
cmake -GNinja -DGOOGLE_TEST=ON -DUSE_DMLC_GTEST=ON -DUSE_CUDA=ON -DUSE_NCCL=ON ..
|
cd ./build
|
||||||
ninja
|
|
||||||
./testxgboost
|
./testxgboost
|
||||||
|
|
||||||
Flags like ``USE_CUDA``, ``USE_DMLC_GTEST`` are optional. For more info about how to build
|
Flags like ``USE_CUDA``, ``USE_DMLC_GTEST`` are optional. For more info about how to build
|
||||||
|
|||||||
@ -26,14 +26,12 @@ Run the following commands on your terminal. The below commands will install the
|
|||||||
# clone the XGBoost repository & its submodules
|
# clone the XGBoost repository & its submodules
|
||||||
git clone --recursive https://github.com/dmlc/xgboost
|
git clone --recursive https://github.com/dmlc/xgboost
|
||||||
cd xgboost
|
cd xgboost
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
# Activate the Conda environment, into which we'll install XGBoost
|
# Activate the Conda environment, into which we'll install XGBoost
|
||||||
conda activate [env_name]
|
conda activate [env_name]
|
||||||
# Build the compiled version of XGBoost inside the build folder
|
# Build the compiled version of XGBoost inside the build folder
|
||||||
cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
|
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
|
||||||
# install XGBoost in your conda environment (usually under [your home directory]/miniconda3)
|
# install XGBoost in your conda environment (usually under [your home directory]/miniconda3)
|
||||||
make install
|
cmake --build build --target install
|
||||||
|
|
||||||
*********************************************************************
|
*********************************************************************
|
||||||
Configure CMakeList.txt file of your application to link with XGBoost
|
Configure CMakeList.txt file of your application to link with XGBoost
|
||||||
@ -55,14 +53,12 @@ To ensure that CMake can locate the XGBoost library, supply ``-DCMAKE_PREFIX_PAT
|
|||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
||||||
# Navigate to the build directory for your application
|
|
||||||
cd build
|
|
||||||
# Activate the Conda environment where we previously installed XGBoost
|
# Activate the Conda environment where we previously installed XGBoost
|
||||||
conda activate [env_name]
|
conda activate [env_name]
|
||||||
# Invoke CMake with CMAKE_PREFIX_PATH
|
# Invoke CMake with CMAKE_PREFIX_PATH
|
||||||
cmake .. -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
cmake -B build -S . -DCMAKE_PREFIX_PATH=$CONDA_PREFIX
|
||||||
# Build your application
|
# Build your application
|
||||||
make
|
cmake --build build
|
||||||
|
|
||||||
************************
|
************************
|
||||||
Useful Tips To Remember
|
Useful Tips To Remember
|
||||||
|
|||||||
@ -33,8 +33,6 @@ See also [Intel® oneAPI Programming Guide](https://www.intel.com/content/www/us
|
|||||||
From the ``xgboost`` directory, run:
|
From the ``xgboost`` directory, run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ mkdir build
|
$ cmake -B build -S . -DPLUGIN_SYCL=ON
|
||||||
$ cd build
|
$ cmake --build build -j
|
||||||
$ cmake .. -DPLUGIN_SYCL=ON
|
|
||||||
$ make -j
|
|
||||||
```
|
```
|
||||||
Loading…
x
Reference in New Issue
Block a user