xgboost
Classes | Namespaces | Macros | Typedefs | Variables
base.h File Reference

Defines configuration macros and basic types for xgboost. More...

#include <dmlc/omp.h>
#include <xgboost/windefs.h>
#include <cstdint>
#include <ostream>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for base.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  xgboost::detail::GradientPairInternal< T >
 Implementation of gradient statistics pair. Template specialisation may be used to overload different gradients types e.g. low precision, high precision, integer, floating point. More...
 
class  xgboost::GradientPairInt64
 Fixed point representation for high precision gradient pair. Has a different interface so we don't accidentally use it in gain calculations. More...
 

Namespaces

 xgboost
 Learner interface that integrates objective, gbm and evaluation together. This is the user facing XGBoost training module.
 
 xgboost::detail
 

Macros

#define XGBOOST_STRICT_R_MODE   0
 string flag for R library, to leave hooks when needed. More...
 
#define XGBOOST_LOG_WITH_TIME   1
 Whether always log console message with time. It will display like, with timestamp appended to head of the message. "[21:47:50] 6513x126 matrix with 143286 entries loaded from ../data/agaricus.txt.train". More...
 
#define XGBOOST_ALIGNAS(X)
 Check if alignas(*) keyword is supported. (g++ 4.8 or higher) More...
 
#define XGBOOST_EXPECT(cond, ret)   (cond)
 
#define XGBOOST_DEVICE
 Tag function as usable by device. More...
 
#define XGBOOST_HOST_DEV_INLINE
 
#define XGBOOST_DEV_INLINE
 
#define XGBOOST_RESTRICT   __restrict__
 

Typedefs

using xgboost::bst_uint = std::uint32_t
 unsigned integer type used for feature index. More...
 
using xgboost::bst_ulong = std::uint64_t
 unsigned long integers More...
 
using xgboost::bst_float = float
 float type, used for storing statistics More...
 
using xgboost::bst_cat_t = std::int32_t
 Categorical value type. More...
 
using xgboost::bst_feature_t = std::uint32_t
 Type for data column (feature) index. More...
 
using xgboost::bst_bin_t = std::int32_t
 Type for histogram bin index. We sometimes use -1 to indicate invalid bin. More...
 
using xgboost::bst_idx_t = std::uint64_t
 Type for data row index (sample). More...
 
using xgboost::bst_node_t = std::int32_t
 Type for tree node index and tree depth. More...
 
using xgboost::bst_group_t = std::uint32_t
 Type for ranking group index. More...
 
using xgboost::bst_target_t = std::uint32_t
 Type for indexing into output targets. More...
 
using xgboost::bst_layer_t = std::int32_t
 Type for indexing boosted layers. More...
 
using xgboost::bst_tree_t = std::int32_t
 Type for indexing trees. More...
 
using xgboost::bst_d_ordinal_t = std::int16_t
 Ordinal of a CUDA device. More...
 
using xgboost::GradientPair = detail::GradientPairInternal< float >
 gradient statistics pair usually needed in gradient boosting More...
 
using xgboost::GradientPairPrecise = detail::GradientPairInternal< double >
 High precision gradient statistics pair. More...
 
using xgboost::Args = std::vector< std::pair< std::string, std::string > >
 
using xgboost::omp_ulong = dmlc::omp_ulong
 define unsigned long for openmp loop More...
 
using xgboost::bst_omp_uint = dmlc::omp_uint
 define unsigned int for openmp loop More...
 
using xgboost::XGBoostVersionT = std::int32_t
 Type used for representing version number in binary form. More...
 

Variables

constexpr float xgboost::kRtEps = 1e-6f
 small eps gap for minimum split decision. More...
 

Detailed Description

Defines configuration macros and basic types for xgboost.

Copyright 2015-2026, XGBoost Contributors

Macro Definition Documentation

◆ XGBOOST_ALIGNAS

#define XGBOOST_ALIGNAS (   X)

Check if alignas(*) keyword is supported. (g++ 4.8 or higher)

◆ XGBOOST_DEV_INLINE

#define XGBOOST_DEV_INLINE

◆ XGBOOST_DEVICE

#define XGBOOST_DEVICE

Tag function as usable by device.

◆ XGBOOST_EXPECT

#define XGBOOST_EXPECT (   cond,
  ret 
)    (cond)

◆ XGBOOST_HOST_DEV_INLINE

#define XGBOOST_HOST_DEV_INLINE

◆ XGBOOST_LOG_WITH_TIME

#define XGBOOST_LOG_WITH_TIME   1

Whether always log console message with time. It will display like, with timestamp appended to head of the message. "[21:47:50] 6513x126 matrix with 143286 entries loaded from ../data/agaricus.txt.train".

◆ XGBOOST_RESTRICT

#define XGBOOST_RESTRICT   __restrict__

◆ XGBOOST_STRICT_R_MODE

#define XGBOOST_STRICT_R_MODE   0

string flag for R library, to leave hooks when needed.