Fix cpplint. (#4157)

* Add comment after #endif.
* Add missing headers.
This commit is contained in:
Jiaming Yuan
2019-02-18 00:16:29 +08:00
committed by GitHub
parent 71a604fae3
commit 2e618af743
46 changed files with 97 additions and 72 deletions

View File

@@ -27,6 +27,6 @@ GlobalRandomEngine& GlobalRandom() {
int AllVisibleImpl::AllVisible() {
return 0;
}
#endif
#endif // !defined(XGBOOST_USE_CUDA)
} // namespace xgboost

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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();

View File

@@ -159,4 +159,4 @@ template class HostDeviceVector<size_t>;
} // namespace xgboost
#endif
#endif // XGBOOST_USE_CUDA

View File

@@ -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);

View File

@@ -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)

View File

@@ -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.

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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 {