Fix cpplint. (#4157)
* Add comment after #endif. * Add missing headers.
This commit is contained in:
parent
71a604fae3
commit
2e618af743
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2015 by Contributors
|
||||
*
|
||||
*
|
||||
* This file was initially generated using the following R command:
|
||||
* tools::package_native_routine_registration_skeleton('.', con = 'src/init.c', character_only = F)
|
||||
* and edited to conform to xgboost C linter requirements. For details, see
|
||||
@ -10,7 +10,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <R_ext/Rdynload.h>
|
||||
|
||||
/* FIXME:
|
||||
/* FIXME:
|
||||
Check these declarations against the C/Fortran source code.
|
||||
*/
|
||||
|
||||
@ -70,7 +70,7 @@ static const R_CallMethodDef CallEntries[] = {
|
||||
|
||||
#if defined(_WIN32)
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
#endif // defined(_WIN32)
|
||||
void R_init_xgboost(DllInfo *dll) {
|
||||
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
|
||||
R_useDynamicSymbols(dll, FALSE);
|
||||
|
||||
@ -53,7 +53,7 @@ bool CheckNAN(double v) {
|
||||
double LogGamma(double v) {
|
||||
return lgammafn(v);
|
||||
}
|
||||
#endif
|
||||
#endif // !defined(XGBOOST_USE_CUDA)
|
||||
// customize random engine.
|
||||
void CustomGlobalRandomEngine::seed(CustomGlobalRandomEngine::result_type val) {
|
||||
// ignore the seed
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
/*!
|
||||
* Copyright 2019 by Contributors
|
||||
* \file build_config.h
|
||||
*/
|
||||
#ifndef XGBOOST_BUILD_CONFIG_H_
|
||||
#define XGBOOST_BUILD_CONFIG_H_
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
*/
|
||||
#ifndef XGBOOST_STRICT_R_MODE
|
||||
#define XGBOOST_STRICT_R_MODE 0
|
||||
#endif
|
||||
#endif // XGBOOST_STRICT_R_MODE
|
||||
|
||||
/*!
|
||||
* \brief Whether always log console message with time.
|
||||
@ -26,21 +26,21 @@
|
||||
*/
|
||||
#ifndef XGBOOST_LOG_WITH_TIME
|
||||
#define XGBOOST_LOG_WITH_TIME 1
|
||||
#endif
|
||||
#endif // XGBOOST_LOG_WITH_TIME
|
||||
|
||||
/*!
|
||||
* \brief Whether customize the logger outputs.
|
||||
*/
|
||||
#ifndef XGBOOST_CUSTOMIZE_LOGGER
|
||||
#define XGBOOST_CUSTOMIZE_LOGGER XGBOOST_STRICT_R_MODE
|
||||
#endif
|
||||
#endif // XGBOOST_CUSTOMIZE_LOGGER
|
||||
|
||||
/*!
|
||||
* \brief Whether to customize global PRNG.
|
||||
*/
|
||||
#ifndef XGBOOST_CUSTOMIZE_GLOBAL_PRNG
|
||||
#define XGBOOST_CUSTOMIZE_GLOBAL_PRNG XGBOOST_STRICT_R_MODE
|
||||
#endif
|
||||
#endif // XGBOOST_CUSTOMIZE_GLOBAL_PRNG
|
||||
|
||||
/*!
|
||||
* \brief Check if alignas(*) keyword is supported. (g++ 4.8 or higher)
|
||||
@ -49,7 +49,7 @@
|
||||
#define XGBOOST_ALIGNAS(X) alignas(X)
|
||||
#else
|
||||
#define XGBOOST_ALIGNAS(X)
|
||||
#endif
|
||||
#endif // defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4)
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ > 4) && \
|
||||
!defined(__CUDACC__)
|
||||
@ -64,7 +64,7 @@
|
||||
#else
|
||||
#define XGBOOST_PARALLEL_SORT(X, Y, Z) std::sort((X), (Y), (Z))
|
||||
#define XGBOOST_PARALLEL_STABLE_SORT(X, Y, Z) std::stable_sort((X), (Y), (Z))
|
||||
#endif
|
||||
#endif // GLIBC VERSION
|
||||
|
||||
/*!
|
||||
* \brief Tag function as usable by device
|
||||
@ -73,7 +73,7 @@
|
||||
#define XGBOOST_DEVICE __host__ __device__
|
||||
#else
|
||||
#define XGBOOST_DEVICE
|
||||
#endif
|
||||
#endif // defined (__CUDA__) || defined(__NVCC__)
|
||||
|
||||
/*! \brief namespace of xgboost*/
|
||||
namespace xgboost {
|
||||
@ -215,8 +215,8 @@ using bst_omp_uint = dmlc::omp_uint; // NOLINT
|
||||
#if __GNUC__ == 4 && __GNUC_MINOR__ < 8
|
||||
#define override
|
||||
#define final
|
||||
#endif
|
||||
#endif
|
||||
#endif // __GNUC__ == 4 && __GNUC_MINOR__ < 8
|
||||
#endif // DMLC_USE_CXX11 && defined(__GNUC__) && !defined(__clang_version__)
|
||||
} // namespace xgboost
|
||||
|
||||
/* Always keep this #include at the bottom of xgboost/base.h */
|
||||
|
||||
@ -13,6 +13,6 @@
|
||||
#elif defined(__GNUC__)
|
||||
// Enable __builtin_prefetch for GCC
|
||||
#define XGBOOST_BUILTIN_PREFETCH_PRESENT
|
||||
#endif
|
||||
#endif // GUARDS
|
||||
|
||||
#endif // XGBOOST_BUILD_CONFIG_H_
|
||||
|
||||
@ -10,11 +10,12 @@
|
||||
#ifdef __cplusplus
|
||||
#define XGB_EXTERN_C extern "C"
|
||||
#include <cstdio>
|
||||
#include <cstdint>
|
||||
#else
|
||||
#define XGB_EXTERN_C
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#endif
|
||||
#endif // __cplusplus
|
||||
|
||||
// XGBoost C API will include APIs in Rabit C API
|
||||
#include <rabit/c_api.h>
|
||||
@ -23,7 +24,7 @@
|
||||
#define XGB_DLL XGB_EXTERN_C __declspec(dllexport)
|
||||
#else
|
||||
#define XGB_DLL XGB_EXTERN_C
|
||||
#endif
|
||||
#endif // defined(_MSC_VER) || defined(_WIN32)
|
||||
|
||||
// manually define unsigned long
|
||||
typedef uint64_t bst_ulong; // NOLINT(*)
|
||||
@ -49,7 +50,7 @@ typedef struct { // NOLINT(*)
|
||||
long* offset; // NOLINT(*)
|
||||
#else
|
||||
int64_t* offset; // NOLINT(*)
|
||||
#endif
|
||||
#endif // __APPLE__
|
||||
/*! \brief labels of each instance */
|
||||
float* label;
|
||||
/*! \brief weight of each instance, can be NULL */
|
||||
@ -562,7 +563,7 @@ XGB_DLL int XGBoosterGetAttr(BoosterHandle handle,
|
||||
*
|
||||
* \param handle handle
|
||||
* \param key The key of the attribute.
|
||||
* \param value The value to be saved.
|
||||
* \param value The value to be saved.
|
||||
* If nullptr, the attribute would be deleted.
|
||||
* \return 0 when success, -1 when failure happens
|
||||
*/
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <rabit/rabit.h>
|
||||
#include <utility>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "./base.h"
|
||||
|
||||
@ -25,7 +25,7 @@ class BaseLogger {
|
||||
BaseLogger() {
|
||||
#if XGBOOST_LOG_WITH_TIME
|
||||
log_stream_ << "[" << dmlc::DateLogger().HumanDate() << "] ";
|
||||
#endif
|
||||
#endif // XGBOOST_LOG_WITH_TIME
|
||||
}
|
||||
std::ostream& stream() { return log_stream_; } // NOLINT
|
||||
|
||||
@ -116,14 +116,14 @@ class LogCallbackRegistry {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
#endif // !defined(XGBOOST_STRICT_R_MODE) || XGBOOST_STRICT_R_MODE == 0
|
||||
|
||||
using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
|
||||
|
||||
// Redefines LOG_WARNING for controling verbosity
|
||||
#if defined(LOG_WARNING)
|
||||
#undef LOG_WARNING
|
||||
#endif
|
||||
#endif // defined(LOG_WARNING)
|
||||
#define LOG_WARNING \
|
||||
if (::xgboost::ConsoleLogger::ShouldLog( \
|
||||
::xgboost::ConsoleLogger::LV::kWarning)) \
|
||||
@ -133,7 +133,7 @@ using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
|
||||
// Redefines LOG_INFO for controling verbosity
|
||||
#if defined(LOG_INFO)
|
||||
#undef LOG_INFO
|
||||
#endif
|
||||
#endif // defined(LOG_INFO)
|
||||
#define LOG_INFO \
|
||||
if (::xgboost::ConsoleLogger::ShouldLog( \
|
||||
::xgboost::ConsoleLogger::LV::kInfo)) \
|
||||
@ -142,7 +142,7 @@ using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
|
||||
|
||||
#if defined(LOG_DEBUG)
|
||||
#undef LOG_DEBUG
|
||||
#endif
|
||||
#endif // defined(LOG_DEBUG)
|
||||
#define LOG_DEBUG \
|
||||
if (::xgboost::ConsoleLogger::ShouldLog( \
|
||||
::xgboost::ConsoleLogger::LV::kDebug)) \
|
||||
@ -152,7 +152,7 @@ using LogCallbackRegistryStore = dmlc::ThreadLocalStore<LogCallbackRegistry>;
|
||||
// redefines the logging macro if not existed
|
||||
#ifndef LOG
|
||||
#define LOG(severity) LOG_##severity.stream()
|
||||
#endif
|
||||
#endif // LOG
|
||||
|
||||
// Enable LOG(CONSOLE) for print messages to console.
|
||||
#define LOG_CONSOLE ::xgboost::ConsoleLogger( \
|
||||
|
||||
@ -7,11 +7,14 @@
|
||||
#pragma once
|
||||
#include <xgboost/base.h>
|
||||
#include <xgboost/data.h>
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "../../src/gbm/gbtree_model.h"
|
||||
#include "../../src/common/host_device_vector.h"
|
||||
|
||||
|
||||
@ -27,6 +27,6 @@ GlobalRandomEngine& GlobalRandom() {
|
||||
int AllVisibleImpl::AllVisible() {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif // !defined(XGBOOST_USE_CUDA)
|
||||
|
||||
} // namespace xgboost
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
|
||||
#define WITH_CUDA() false
|
||||
|
||||
#endif
|
||||
#endif // defined(__CUDACC__)
|
||||
|
||||
namespace dh {
|
||||
#if defined(__CUDACC__)
|
||||
@ -44,7 +44,7 @@ inline cudaError_t ThrowOnCudaError(cudaError_t code, const char *file,
|
||||
}
|
||||
return code;
|
||||
}
|
||||
#endif
|
||||
#endif // defined(__CUDACC__)
|
||||
} // namespace dh
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
|
||||
#ifdef __CUDACC__
|
||||
#include "device_helpers.cuh"
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
|
||||
namespace xgboost {
|
||||
namespace common {
|
||||
@ -115,7 +115,7 @@ class CompressedBufferWriter {
|
||||
symbol >>= 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
|
||||
template <typename IterT>
|
||||
void Write(CompressedByteT *buffer, IterT input_begin, IterT input_end) {
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#define PREFETCH_READ_T0(addr) __builtin_prefetch(reinterpret_cast<const char*>(addr), 0, 3)
|
||||
#else // no SW pre-fetching available; PREFETCH_READ_T0 is no-op
|
||||
#define PREFETCH_READ_T0(addr) do {} while (0)
|
||||
#endif
|
||||
#endif // defined(XGBOOST_MM_PREFETCH_PRESENT)
|
||||
|
||||
namespace xgboost {
|
||||
namespace common {
|
||||
@ -544,7 +544,7 @@ void GHistBuilder::BuildBlockHist(const std::vector<GradientPair>& gpair,
|
||||
|
||||
#if defined(_OPENMP)
|
||||
const auto nthread = static_cast<bst_omp_uint>(this->nthread_);
|
||||
#endif
|
||||
#endif // defined(_OPENMP)
|
||||
tree::GradStats* p_hist = hist.data();
|
||||
|
||||
#pragma omp parallel for num_threads(nthread) schedule(guided)
|
||||
@ -590,7 +590,7 @@ void GHistBuilder::SubtractionTrick(GHistRow self, GHistRow sibling, GHistRow pa
|
||||
|
||||
#if defined(_OPENMP)
|
||||
const auto nthread = static_cast<bst_omp_uint>(this->nthread_);
|
||||
#endif
|
||||
#endif // defined(_OPENMP)
|
||||
tree::GradStats* p_self = self.data();
|
||||
tree::GradStats* p_sibling = sibling.data();
|
||||
tree::GradStats* p_parent = parent.data();
|
||||
|
||||
@ -159,4 +159,4 @@ template class HostDeviceVector<size_t>;
|
||||
|
||||
} // namespace xgboost
|
||||
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
|
||||
@ -57,6 +57,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstdlib>
|
||||
#include <initializer_list>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "common.h"
|
||||
@ -66,7 +67,7 @@
|
||||
// is included from a .cu file
|
||||
#ifdef __CUDACC__
|
||||
#include <thrust/device_ptr.h>
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
@ -74,7 +75,7 @@ namespace xgboost {
|
||||
// Sets a function to call instead of cudaSetDevice();
|
||||
// only added for testing
|
||||
void SetCudaSetDeviceHandler(void (*handler)(int));
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
|
||||
template <typename T> struct HostDeviceVectorImpl;
|
||||
|
||||
@ -233,7 +234,7 @@ class HostDeviceVector {
|
||||
|
||||
void ScatterFrom(thrust::device_ptr<const T> begin, thrust::device_ptr<const T> end);
|
||||
void GatherTo(thrust::device_ptr<T> begin, thrust::device_ptr<T> end) const;
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
|
||||
void Fill(T v);
|
||||
void Copy(const HostDeviceVector<T>& other);
|
||||
|
||||
@ -123,7 +123,7 @@ inline bool CheckNAN(T v) {
|
||||
return (_isnan(v) != 0);
|
||||
#else
|
||||
return std::isnan(v);
|
||||
#endif
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
#endif // XGBOOST_STRICT_R_MODE_
|
||||
|
||||
@ -149,7 +149,7 @@ XGBOOST_DEVICE inline T LogGamma(T v) {
|
||||
|
||||
#else
|
||||
return lgamma(v);
|
||||
#endif
|
||||
#endif // _MSC_VER
|
||||
}
|
||||
|
||||
#endif // XGBOOST_STRICT_R_MODE && !defined(XGBOOST_USE_CUDA)
|
||||
|
||||
@ -66,7 +66,7 @@ typedef CustomGlobalRandomEngine GlobalRandomEngine;
|
||||
* \brief global random engine
|
||||
*/
|
||||
using GlobalRandomEngine = RandomEngine;
|
||||
#endif
|
||||
#endif // XGBOOST_CUSTOMIZE_GLOBAL_PRNG
|
||||
|
||||
/*!
|
||||
* \brief global singleton of a random engine.
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
|
||||
#define __span_noexcept noexcept
|
||||
|
||||
#endif
|
||||
#endif // defined(_MSC_VER) && _MSC_VER < 1910
|
||||
|
||||
namespace xgboost {
|
||||
namespace common {
|
||||
@ -85,7 +85,7 @@ namespace common {
|
||||
#define SPAN_CHECK KERNEL_CHECK
|
||||
#else
|
||||
#define SPAN_CHECK CHECK // check from dmlc
|
||||
#endif
|
||||
#endif // __CUDA_ARCH__
|
||||
|
||||
namespace detail {
|
||||
/*!
|
||||
@ -101,7 +101,7 @@ using ptrdiff_t = int64_t; // NOLINT
|
||||
constexpr const detail::ptrdiff_t dynamic_extent = -1; // NOLINT
|
||||
#else
|
||||
constexpr detail::ptrdiff_t dynamic_extent = -1; // NOLINT
|
||||
#endif
|
||||
#endif // defined(_MSC_VER) && _MSC_VER < 1910
|
||||
|
||||
enum class byte : unsigned char {}; // NOLINT
|
||||
|
||||
|
||||
@ -81,7 +81,7 @@ struct Monitor {
|
||||
cudaSetDevice(device);
|
||||
cudaDeviceSynchronize();
|
||||
}
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
}
|
||||
statistics_map[name].timer.Start();
|
||||
}
|
||||
@ -96,7 +96,7 @@ struct Monitor {
|
||||
cudaSetDevice(device);
|
||||
cudaDeviceSynchronize();
|
||||
}
|
||||
#endif
|
||||
#endif // __CUDACC__
|
||||
}
|
||||
this->Stop(name);
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
#include <dmlc/omp.h>
|
||||
#include <xgboost/data.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <type_traits> // enable_if
|
||||
|
||||
@ -15,7 +16,7 @@
|
||||
|
||||
#if defined (__CUDACC__)
|
||||
#include "device_helpers.cuh"
|
||||
#endif
|
||||
#endif // defined (__CUDACC__)
|
||||
|
||||
namespace xgboost {
|
||||
namespace common {
|
||||
@ -32,7 +33,7 @@ __global__ void LaunchCUDAKernel(Functor _func, Range _range,
|
||||
_func(i, _spans...);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // defined(__CUDACC__)
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@ -155,7 +156,7 @@ class Transform {
|
||||
void LaunchCUDA(Functor _func, HDV*... _vectors) const {
|
||||
LOG(FATAL) << "Not part of device code. WITH_CUDA: " << WITH_CUDA();
|
||||
}
|
||||
#endif
|
||||
#endif // defined(__CUDACC__)
|
||||
|
||||
template <typename... HDV>
|
||||
void LaunchCPU(Functor func, HDV*... vectors) const {
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#if DMLC_ENABLE_STD_THREAD
|
||||
#include "./sparse_page_source.h"
|
||||
#include "./sparse_page_dmatrix.h"
|
||||
#endif
|
||||
#endif // DMLC_ENABLE_STD_THREAD
|
||||
|
||||
namespace dmlc {
|
||||
DMLC_REGISTRY_ENABLE(::xgboost::data::SparsePageFormatReg);
|
||||
@ -264,7 +264,7 @@ DMatrix* DMatrix::Create(dmlc::Parser<uint32_t>* parser,
|
||||
#else
|
||||
LOG(FATAL) << "External memory is not enabled in mingw";
|
||||
return nullptr;
|
||||
#endif
|
||||
#endif // DMLC_ENABLE_STD_THREAD
|
||||
}
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ DMatrix* DMatrix::Create(std::unique_ptr<DataSource>&& source,
|
||||
#else
|
||||
LOG(FATAL) << "External memory is not enabled in mingw";
|
||||
return nullptr;
|
||||
#endif
|
||||
#endif // DMLC_ENABLE_STD_THREAD
|
||||
}
|
||||
}
|
||||
} // namespace xgboost
|
||||
|
||||
@ -9,9 +9,13 @@
|
||||
|
||||
#include <xgboost/base.h>
|
||||
#include <xgboost/data.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "simple_csr_source.h"
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
@ -100,4 +100,4 @@ bool SparsePageDMatrix::SingleColBlock() const {
|
||||
}
|
||||
} // namespace data
|
||||
} // namespace xgboost
|
||||
#endif
|
||||
#endif // DMLC_ENABLE_STD_THREAD
|
||||
|
||||
@ -9,9 +9,11 @@
|
||||
|
||||
#include <xgboost/data.h>
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "sparse_page_source.h"
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
@ -29,7 +29,7 @@ GetCacheShards(const std::string& cache_info) {
|
||||
cache_shards[0] = cache_info.substr(0, 2) + cache_shards[0];
|
||||
return cache_shards;
|
||||
}
|
||||
#endif
|
||||
#endif // (defined _WIN32) || (defined __CYGWIN__)
|
||||
return xgboost::common::Split(cache_info, ':');
|
||||
}
|
||||
|
||||
@ -291,4 +291,4 @@ void SparsePageSource::CreateColumnPage(DMatrix* src,
|
||||
}
|
||||
} // namespace data
|
||||
} // namespace xgboost
|
||||
#endif
|
||||
#endif // DMLC_ENABLE_STD_THREAD
|
||||
|
||||
@ -10,9 +10,12 @@
|
||||
#include <xgboost/base.h>
|
||||
#include <xgboost/data.h>
|
||||
#include <dmlc/threadediter.h>
|
||||
#include <vector>
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "sparse_page_writer.h"
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#if DMLC_ENABLE_STD_THREAD
|
||||
#include <dmlc/concurrency.h>
|
||||
#include <thread>
|
||||
#endif
|
||||
#endif // DMLC_ENABLE_STD_THREAD
|
||||
|
||||
namespace xgboost {
|
||||
namespace data {
|
||||
|
||||
@ -5,6 +5,8 @@
|
||||
#include <dmlc/parameter.h>
|
||||
#include <dmlc/io.h>
|
||||
#include <xgboost/tree_model.h>
|
||||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
@ -178,7 +178,7 @@ class LearnerImpl : public Learner {
|
||||
static void AssertGPUSupport() {
|
||||
#ifndef XGBOOST_USE_CUDA
|
||||
LOG(FATAL) << "XGBoost version not compiled with GPU support.";
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
}
|
||||
|
||||
|
||||
@ -387,7 +387,7 @@ class LearnerImpl : public Learner {
|
||||
cfg_["predictor"] = "cpu_predictor";
|
||||
kv.second = "cpu_predictor";
|
||||
}
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
}
|
||||
}
|
||||
attributes_ =
|
||||
|
||||
@ -30,6 +30,6 @@ DMLC_REGISTRY_LINK_TAG(updater_shotgun);
|
||||
DMLC_REGISTRY_LINK_TAG(updater_coordinate);
|
||||
#ifdef XGBOOST_USE_CUDA
|
||||
DMLC_REGISTRY_LINK_TAG(updater_gpu_coordinate);
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
} // namespace linear
|
||||
} // namespace xgboost
|
||||
|
||||
@ -35,7 +35,7 @@ TrackerLogger::~TrackerLogger() {
|
||||
|
||||
} // namespace xgboost
|
||||
|
||||
#endif
|
||||
#endif // !defined(XGBOOST_STRICT_R_MODE) || XGBOOST_STRICT_R_MODE == 0
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
|
||||
@ -5,4 +5,4 @@
|
||||
|
||||
#if !defined(XGBOOST_USE_CUDA)
|
||||
#include "elementwise_metric.cu"
|
||||
#endif
|
||||
#endif // !defined(XGBOOST_USE_CUDA)
|
||||
|
||||
@ -144,7 +144,7 @@ class MetricsReduction {
|
||||
result.weights_sum_ += res_per_device[i].weights_sum_;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif // defined(XGBOOST_USE_CUDA)
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -152,7 +152,7 @@ class MetricsReduction {
|
||||
EvalRow policy_;
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
std::vector<dh::CubMemory> allocators_;
|
||||
#endif
|
||||
#endif // defined(XGBOOST_USE_CUDA)
|
||||
};
|
||||
|
||||
struct EvalRowRMSE {
|
||||
|
||||
@ -15,4 +15,4 @@ DMLC_REGISTRY_FILE_TAG(hinge_obj);
|
||||
|
||||
#ifndef XGBOOST_USE_CUDA
|
||||
#include "hinge.cu"
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
|
||||
@ -16,7 +16,7 @@ namespace obj {
|
||||
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
DMLC_REGISTRY_FILE_TAG(hinge_obj_gpu);
|
||||
#endif
|
||||
#endif // defined(XGBOOST_USE_CUDA)
|
||||
|
||||
struct HingeObjParam : public dmlc::Parameter<HingeObjParam> {
|
||||
int n_gpus;
|
||||
|
||||
@ -15,4 +15,4 @@ DMLC_REGISTRY_FILE_TAG(multiclass_obj);
|
||||
|
||||
#ifndef XGBOOST_USE_CUDA
|
||||
#include "multiclass_obj.cu"
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
|
||||
@ -21,7 +21,7 @@ namespace obj {
|
||||
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
DMLC_REGISTRY_FILE_TAG(multiclass_obj_gpu);
|
||||
#endif
|
||||
#endif // defined(XGBOOST_USE_CUDA)
|
||||
|
||||
struct SoftmaxMultiClassParam : public dmlc::Parameter<SoftmaxMultiClassParam> {
|
||||
int num_class;
|
||||
|
||||
@ -38,7 +38,7 @@ DMLC_REGISTRY_LINK_TAG(multiclass_obj_gpu);
|
||||
DMLC_REGISTRY_LINK_TAG(regression_obj);
|
||||
DMLC_REGISTRY_LINK_TAG(hinge_obj);
|
||||
DMLC_REGISTRY_LINK_TAG(multiclass_obj);
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
DMLC_REGISTRY_LINK_TAG(rank_obj);
|
||||
} // namespace obj
|
||||
} // namespace xgboost
|
||||
|
||||
@ -15,4 +15,4 @@ DMLC_REGISTRY_FILE_TAG(regression_obj);
|
||||
|
||||
#ifndef XGBOOST_USE_CUDA
|
||||
#include "regression_obj.cu"
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
|
||||
@ -24,7 +24,7 @@ namespace obj {
|
||||
|
||||
#if defined(XGBOOST_USE_CUDA)
|
||||
DMLC_REGISTRY_FILE_TAG(regression_obj_gpu);
|
||||
#endif
|
||||
#endif // defined(XGBOOST_USE_CUDA)
|
||||
|
||||
struct RegLossParam : public dmlc::Parameter<RegLossParam> {
|
||||
float scale_pos_weight;
|
||||
|
||||
@ -29,7 +29,7 @@ namespace predictor {
|
||||
// List of files that will be force linked in static links.
|
||||
#ifdef XGBOOST_USE_CUDA
|
||||
DMLC_REGISTRY_LINK_TAG(gpu_predictor);
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
DMLC_REGISTRY_LINK_TAG(cpu_predictor);
|
||||
} // namespace predictor
|
||||
} // namespace xgboost
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#include <dmlc/registry.h>
|
||||
#include <xgboost/base.h>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -37,6 +37,6 @@ DMLC_REGISTRY_LINK_TAG(updater_sync);
|
||||
#ifdef XGBOOST_USE_CUDA
|
||||
DMLC_REGISTRY_LINK_TAG(updater_gpu);
|
||||
DMLC_REGISTRY_LINK_TAG(updater_gpu_hist);
|
||||
#endif
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
} // namespace tree
|
||||
} // namespace xgboost
|
||||
|
||||
@ -597,7 +597,7 @@ class ColMaker: public TreeUpdater {
|
||||
const auto num_features = static_cast<bst_omp_uint>(feat_set.size());
|
||||
#if defined(_OPENMP)
|
||||
const int batch_size = std::max(static_cast<int>(num_features / this->nthread_ / 32), 1);
|
||||
#endif
|
||||
#endif // defined(_OPENMP)
|
||||
int poption = param_.parallel_option;
|
||||
if (poption == 2) {
|
||||
poption = static_cast<int>(num_features) * 2 < this->nthread_ ? 1 : 0;
|
||||
|
||||
@ -16,6 +16,7 @@
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <iomanip>
|
||||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include "./param.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user