[Breaking] Add global versioning. (#4936)

* Use CMake config file for representing version.

* Generate c and Python version file with CMake.

The generated file is written into source tree.  But unless XGBoost upgrades
its version, there will be no actual modification.  This retains compatibility
with Makefiles for R.

* Add XGBoost version the DMatrix binaries.
* Simplify prefetch detection in CMakeLists.txt
This commit is contained in:
Jiaming Yuan
2019-10-22 23:27:26 -04:00
committed by GitHub
parent 7e477a2adb
commit 5620322a48
18 changed files with 301 additions and 56 deletions

View File

@@ -217,6 +217,8 @@ const bst_float kRtEps = 1e-6f;
using omp_ulong = dmlc::omp_ulong; // NOLINT
/*! \brief define unsigned int for openmp loop */
using bst_omp_uint = dmlc::omp_uint; // NOLINT
/*! \brief Type used for representing version number in binary form.*/
using XGBoostVersionT = int32_t;
/*!
* \brief define compatible keywords in g++

View File

@@ -1,6 +1,8 @@
/*!
* Copyright 2019 by Contributors
* \file build_config.h
*
* Generated from `cmake/build_config.h.in` by cmake.
*/
#ifndef XGBOOST_BUILD_CONFIG_H_
#define XGBOOST_BUILD_CONFIG_H_
@@ -19,4 +21,8 @@
#endif // !defined(XGBOOST_MM_PREFETCH_PRESENT) && !defined()
#define XGBOOST_VER_MAJOR 1
#define XGBOOST_VER_MINOR 0
#define XGBOOST_VER_PATCH 0
#endif // XGBOOST_BUILD_CONFIG_H_

View File

@@ -58,6 +58,16 @@ typedef struct { // NOLINT(*)
float* value;
} XGBoostBatchCSR;
/*!
* \brief Return the version of the XGBoost library being currently used.
*
* The output variable is only written if it's not NULL.
*
* \param major Store the major version number
* \param minor Store the minor version number
* \param patch Store the patch (revision) number
*/
XGB_DLL void XGBoostVersion(int* major, int* minor, int* patch);
/*!
* \brief Callback to set the data to handle,

View File

@@ -66,10 +66,6 @@ class MetaInfo {
* can be used to specify initial prediction to boost from.
*/
HostDeviceVector<bst_float> base_margin_;
/*! \brief version flag, used to check version of this info */
static const int kVersion = 3;
/*! \brief version that contains qid field */
static const int kVersionWithQid = 2;
/*! \brief default constructor */
MetaInfo() = default;
/*!