/*! * Copyright (c) 2022 Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See LICENSE file in the project root for * license information. */ #ifndef LIGHTGBM_METRIC_CUDA_CUDA_REGRESSION_METRIC_HPP_ #define LIGHTGBM_METRIC_CUDA_CUDA_REGRESSION_METRIC_HPP_ #ifdef USE_CUDA_EXP #include #include #include #include "../regression_metric.hpp" #define NUM_DATA_PER_EVAL_THREAD (1024) namespace LightGBM { template class CUDARegressionMetricInterface: public CUDAMetricInterface { public: explicit CUDARegressionMetricInterface(const Config& config): CUDAMetricInterface(config) {} virtual ~CUDARegressionMetricInterface() {} void Init(const Metadata& metadata, data_size_t num_data) override; std::vector Eval(const double* score, const ObjectiveFunction* objective) const override; protected: double LaunchEvalKernel(const double* score_convert) const; CUDAVector score_convert_buffer_; CUDAVector reduce_block_buffer_; CUDAVector reduce_block_buffer_inner_; }; class CUDARMSEMetric: public CUDARegressionMetricInterface { public: explicit CUDARMSEMetric(const Config& config); virtual ~CUDARMSEMetric() {} __device__ static double MetricOnPointCUDA(label_t label, double score) { return (score - static_cast(label)); } }; } // namespace LightGBM #endif // USE_CUDA_EXP #endif // LIGHTGBM_METRIC_CUDA_CUDA_REGRESSION_METRIC_HPP_