Fix cpplint. (#4157)
* Add comment after #endif. * Add missing headers.
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user