Reduce compiler warnings on CPU-only build. (#8483)
This commit is contained in:
@@ -390,24 +390,21 @@ XGBOOST_REGISTER_METRIC(EvalAUC, "auc")
|
||||
.set_body([](const char*) { return new EvalROCAUC(); });
|
||||
|
||||
#if !defined(XGBOOST_USE_CUDA)
|
||||
std::tuple<double, double, double>
|
||||
GPUBinaryROCAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::tuple<double, double, double> GPUBinaryROCAUC(common::Span<float const>, MetaInfo const &,
|
||||
std::int32_t,
|
||||
std::shared_ptr<DeviceAUCCache> *) {
|
||||
common::AssertGPUSupport();
|
||||
return {};
|
||||
}
|
||||
|
||||
double GPUMultiClassROCAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *cache,
|
||||
size_t n_classes) {
|
||||
double GPUMultiClassROCAUC(common::Span<float const>, MetaInfo const &, std::int32_t,
|
||||
std::shared_ptr<DeviceAUCCache> *, std::size_t) {
|
||||
common::AssertGPUSupport();
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
std::pair<double, uint32_t>
|
||||
GPURankingAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::pair<double, std::uint32_t> GPURankingAUC(common::Span<float const>, MetaInfo const &,
|
||||
std::int32_t, std::shared_ptr<DeviceAUCCache> *) {
|
||||
common::AssertGPUSupport();
|
||||
return {};
|
||||
}
|
||||
@@ -432,8 +429,8 @@ class EvalPRAUC : public EvalAUC<EvalPRAUC> {
|
||||
return std::make_tuple(pr, re, auc);
|
||||
}
|
||||
|
||||
double EvalMultiClass(HostDeviceVector<float> const &predts,
|
||||
MetaInfo const &info, size_t n_classes) {
|
||||
double EvalMultiClass(HostDeviceVector<float> const &predts, MetaInfo const &info,
|
||||
size_t n_classes) {
|
||||
if (tparam_->gpu_id == GenericParameter::kCpuId) {
|
||||
auto n_threads = this->tparam_->Threads();
|
||||
return MultiClassOVR(predts.ConstHostSpan(), info, n_classes, n_threads,
|
||||
@@ -472,24 +469,20 @@ XGBOOST_REGISTER_METRIC(AUCPR, "aucpr")
|
||||
.set_body([](char const *) { return new EvalPRAUC{}; });
|
||||
|
||||
#if !defined(XGBOOST_USE_CUDA)
|
||||
std::tuple<double, double, double>
|
||||
GPUBinaryPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::tuple<double, double, double> GPUBinaryPRAUC(common::Span<float const>, MetaInfo const &,
|
||||
std::int32_t, std::shared_ptr<DeviceAUCCache> *) {
|
||||
common::AssertGPUSupport();
|
||||
return {};
|
||||
}
|
||||
|
||||
double GPUMultiClassPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *cache,
|
||||
size_t n_classes) {
|
||||
double GPUMultiClassPRAUC(common::Span<float const>, MetaInfo const &, std::int32_t,
|
||||
std::shared_ptr<DeviceAUCCache> *, std::size_t) {
|
||||
common::AssertGPUSupport();
|
||||
return {};
|
||||
}
|
||||
|
||||
std::pair<double, uint32_t>
|
||||
GPURankingPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *cache) {
|
||||
std::pair<double, std::uint32_t> GPURankingPRAUC(common::Span<float const>, MetaInfo const &,
|
||||
std::int32_t, std::shared_ptr<DeviceAUCCache> *) {
|
||||
common::AssertGPUSupport();
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -162,9 +162,9 @@ GPUBinaryAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
return std::make_tuple(last.first, last.second, auc);
|
||||
}
|
||||
|
||||
std::tuple<double, double, double>
|
||||
GPUBinaryROCAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::tuple<double, double, double> GPUBinaryROCAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
auto &cache = *p_cache;
|
||||
InitCacheOnce<false>(predts, p_cache);
|
||||
|
||||
@@ -451,10 +451,9 @@ void MultiClassSortedIdx(common::Span<float const> predts,
|
||||
dh::SegmentedArgSort<false>(d_predts_t, d_class_ptr, d_sorted_idx);
|
||||
}
|
||||
|
||||
double GPUMultiClassROCAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache,
|
||||
size_t n_classes) {
|
||||
double GPUMultiClassROCAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
std::int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache,
|
||||
std::size_t n_classes) {
|
||||
auto& cache = *p_cache;
|
||||
InitCacheOnce<true>(predts, p_cache);
|
||||
|
||||
@@ -480,9 +479,9 @@ struct RankScanItem {
|
||||
};
|
||||
} // anonymous namespace
|
||||
|
||||
std::pair<double, uint32_t>
|
||||
GPURankingAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::pair<double, std::uint32_t> GPURankingAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
auto& cache = *p_cache;
|
||||
InitCacheOnce<false>(predts, p_cache);
|
||||
|
||||
@@ -600,9 +599,9 @@ GPURankingAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
return std::make_pair(auc, n_valid);
|
||||
}
|
||||
|
||||
std::tuple<double, double, double>
|
||||
GPUBinaryPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::tuple<double, double, double> GPUBinaryPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
auto& cache = *p_cache;
|
||||
InitCacheOnce<false>(predts, p_cache);
|
||||
|
||||
@@ -640,10 +639,9 @@ GPUBinaryPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
return std::make_tuple(1.0, 1.0, auc);
|
||||
}
|
||||
|
||||
double GPUMultiClassPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache,
|
||||
size_t n_classes) {
|
||||
double GPUMultiClassPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
std::int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache,
|
||||
std::size_t n_classes) {
|
||||
auto& cache = *p_cache;
|
||||
InitCacheOnce<true>(predts, p_cache);
|
||||
|
||||
@@ -816,9 +814,9 @@ GPURankingPRAUCImpl(common::Span<float const> predts, MetaInfo const &info,
|
||||
return std::make_pair(auc, n_groups - invalid_groups);
|
||||
}
|
||||
|
||||
std::pair<double, uint32_t>
|
||||
GPURankingPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
std::pair<double, std::uint32_t> GPURankingPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache) {
|
||||
dh::safe_cuda(cudaSetDevice(device));
|
||||
if (predts.empty()) {
|
||||
return std::make_pair(0.0, static_cast<uint32_t>(0));
|
||||
|
||||
@@ -29,34 +29,32 @@ XGBOOST_DEVICE inline double TrapezoidArea(double x0, double x1, double y0, doub
|
||||
|
||||
struct DeviceAUCCache;
|
||||
|
||||
std::tuple<double, double, double>
|
||||
GPUBinaryROCAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache);
|
||||
std::tuple<double, double, double> GPUBinaryROCAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache);
|
||||
|
||||
double GPUMultiClassROCAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *cache,
|
||||
size_t n_classes);
|
||||
double GPUMultiClassROCAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
std::int32_t device, std::shared_ptr<DeviceAUCCache> *cache,
|
||||
std::size_t n_classes);
|
||||
|
||||
std::pair<double, uint32_t>
|
||||
GPURankingAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *cache);
|
||||
std::pair<double, std::uint32_t> GPURankingAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *cache);
|
||||
|
||||
/**********
|
||||
* PR AUC *
|
||||
**********/
|
||||
std::tuple<double, double, double>
|
||||
GPUBinaryPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *p_cache);
|
||||
std::tuple<double, double, double> GPUBinaryPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *p_cache);
|
||||
|
||||
double GPUMultiClassPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *cache,
|
||||
size_t n_classes);
|
||||
double GPUMultiClassPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
std::int32_t device, std::shared_ptr<DeviceAUCCache> *cache,
|
||||
std::size_t n_classes);
|
||||
|
||||
std::pair<double, uint32_t>
|
||||
GPURankingPRAUC(common::Span<float const> predts, MetaInfo const &info,
|
||||
int32_t device, std::shared_ptr<DeviceAUCCache> *cache);
|
||||
std::pair<double, std::uint32_t> GPURankingPRAUC(common::Span<float const> predts,
|
||||
MetaInfo const &info, std::int32_t device,
|
||||
std::shared_ptr<DeviceAUCCache> *cache);
|
||||
|
||||
namespace detail {
|
||||
XGBOOST_DEVICE inline double CalcH(double fp_a, double fp_b, double tp_a,
|
||||
|
||||
Reference in New Issue
Block a user