xgb.dl: Install xgboost from source

Description Usage Arguments Value Examples

Description

Downloads and install xgboost from repository. Allows to customize the commit/branch used. Requires git and compiler make (or mingw32-make for MinGW) in PATH environment variable. Windows uses \\ (backward slashes) while Linux uses / (forward slashes).

Usage

1
2
3
xgb.dl(commit = "master", compiler = "gcc",
  repo = "https://github.com/dmlc/xgboost", cores = 1, use_gpu = FALSE,
  use_avx = FALSE, CUDA = NULL, NCCL = NULL)

Arguments

commit

The commit / branch to use. Put "" for master branch. Defaults to "master".

compiler

Applicable only to Windows. The compiler to use (either "gcc" for MinGW, "Visual Studio 15 2017" for Visual Studio). Defaults to "gcc". Use "Visual Studio 14 2015 Win64" for the officially supported Visual Studio 2015.

repo

The link to the repository. Defaults to "https://github.com/dmlc/xgboost".

cores

The number of cores to use for compilation, ignored for Visual Studio. Defaults to 1.

use_gpu

Whether to install with GPU enabled or not. Defaults to FALSE. Disabled for Windows + MinGW.

use_avx

Whether to install with AVX enabled or not. Defaults to FALSE. Disabled for Windows + MinGW.

CUDA

Path to CUDA, gcc, and g++ if cmake does not recognize CUDA path. Defaults to list(NULL, NULL, NULL). Disabled for Windows. Please specify a list. Example: CUDA = list("/usr/lib/cuda", "/usr/bin/gcc-6", "/usr/bin/g++-6").

NCCL

Activate NCCL by specifying the path to NCCL. Defaults to NULL. Disabled for Windows. Example: NCCL = "/usr/lib/x86_64-linux-gnu"

Value

A logical describing whether the xgboost package was installed or not (TRUE if installed, FALSE if installation failed AND you did not have the package before).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
## Not run: 
# Install using Visual Studio 2017
# (Download: http://landinghub.visualstudio.com/visual-cpp-build-tools)
xgb.dl(compiler = "Visual Studio 15 2017 Win64")

# Install using Rtools MinGW or use Linux compilation
xgb.dl(compiler = "gcc")

# Install master using Visual Studio 2017 with GPU support
xgb.dl(commit = "master",
       compiler = "Visual Studio 15 2017 Win64",
       repo = "https://github.com/dmlc/xgboost",
       use_gpu = TRUE)

# Install master using Visual Studio 2017 with GPU support and AVX speedups
xgb.dl(commit = "master",
       compiler = "Visual Studio 15 2017 Win64",
       repo = "https://github.com/dmlc/xgboost",
       use_gpu = TRUE,
       use_avx = TRUE)

# Test package
library(xgboost)
data(agaricus.train, package = "xgboost")
data(agaricus.test, package = "xgboost")

dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label)
watchlist <- list(train = dtrain, eval = dtest)

param <- list(max_depth = 2, eta = 1, silent = 1, nthread = 2,
              objective = "binary:logistic", eval_metric = "auc")
bst <- xgb.train(param, dtrain, nrounds = 2, watchlist)



# Install with GPU support on Linux, CUDA 10 + gcc-6 + g++-6
xgb.dl(compiler = "gcc",
       commit = "a2dc929",
       use_avx = FALSE,
       use_gpu = TRUE,
       CUDA = list("/usr/lib/cuda", "/usr/bin/gcc-6", "/usr/bin/g++-6"))

# Test GPU package
library(xgboost)
data(agaricus.train, package = "xgboost")
data(agaricus.test, package = "xgboost")

dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label)
watchlist <- list(train = dtrain, eval = dtest)

param <- list(max_depth = 2, eta = 1, silent = 1, nthread = 2,
              objective = "binary:logistic", eval_metric = "auc",
              max_bin = 64, tree_method = "gpu_hist")
bst <- xgb.train(param, dtrain, nrounds = 2, watchlist)



# Install with multi-GPU support on Linux, CUDA 10 + gcc-6 + g++-6
xgb.dl(compiler = "gcc",
       commit = "a2dc929",
       use_avx = FALSE,
       use_gpu = TRUE,
       CUDA = list("/usr/lib/cuda", "/usr/bin/gcc-6", "/usr/bin/g++-6"),
       NCCL = "/usr/lib/x86_64-linux-gnu")

# Test Multi-GPU package
library(xgboost)
data(agaricus.train, package = "xgboost")
data(agaricus.test, package = "xgboost")

dtrain <- xgb.DMatrix(agaricus.train$data, label = agaricus.train$label)
dtest <- xgb.DMatrix(agaricus.test$data, label = agaricus.test$label)
watchlist <- list(train = dtrain, eval = dtest)

param <- list(max_depth = 2, eta = 1, silent = 1, nthread = 2,
              objective = "binary:logistic", eval_metric = "auc",
              max_bin = 64, tree_method = "gpu_hist", n_gpus = 4)
bst <- xgb.train(param, dtrain, nrounds = 2, watchlist)


## End(Not run)

Laurae2/xgbdl documentation built on May 23, 2019, 3:04 p.m.