try elementwise_metric.cu
This commit is contained in:
parent
946f9e9802
commit
6fa248b75f
@ -40,23 +40,12 @@
|
||||
#endif // defined(__CUDACC__)
|
||||
|
||||
namespace dh {
|
||||
#if defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
#if defined(__CUDACC__)
|
||||
/*
|
||||
* Error handling functions
|
||||
*/
|
||||
#define safe_cuda(ans) ThrowOnCudaError((ans), __FILE__, __LINE__)
|
||||
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
inline hipError_t ThrowOnCudaError(hipError_t code, const char *file, int line)
|
||||
{
|
||||
if (code != hipSuccess) {
|
||||
LOG(FATAL) << thrust::system_error(code, thrust::hip_category(),
|
||||
std::string{file} + ": " + // NOLINT
|
||||
std::to_string(line)).what();
|
||||
}
|
||||
return code;
|
||||
}
|
||||
#else
|
||||
inline cudaError_t ThrowOnCudaError(cudaError_t code, const char *file, int line)
|
||||
{
|
||||
if (code != cudaSuccess) {
|
||||
@ -66,8 +55,23 @@ inline cudaError_t ThrowOnCudaError(cudaError_t code, const char *file, int line
|
||||
}
|
||||
return code;
|
||||
}
|
||||
|
||||
#elif defined(__HIP_PLATFORM_AMD__)
|
||||
/*
|
||||
* Error handling functions
|
||||
*/
|
||||
#define safe_cuda(ans) ThrowOnCudaError((ans), __FILE__, __LINE__)
|
||||
|
||||
inline hipError_t ThrowOnCudaError(hipError_t code, const char *file, int line)
|
||||
{
|
||||
if (code != hipSuccess) {
|
||||
LOG(FATAL) << thrust::system_error(code, thrust::hip_category(),
|
||||
std::string{file} + ": " + // NOLINT
|
||||
std::to_string(line)).what();
|
||||
}
|
||||
return code;
|
||||
}
|
||||
#endif
|
||||
#endif // defined(__CUDACC__) || defined(__HIP_PLATFORM_AMD__)
|
||||
} // namespace dh
|
||||
|
||||
namespace xgboost {
|
||||
|
||||
@ -1,2 +1,4 @@
|
||||
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
#include "context.cu"
|
||||
#endif
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
#include "gbtree.cu"
|
||||
|
||||
#endif
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
*/
|
||||
// Dummy file to keep the CUDA conditional compile trick.
|
||||
|
||||
#if !defined(XGBOOST_USE_CUDA)
|
||||
#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
|
||||
#include "elementwise_metric.cu"
|
||||
#elif !defined(XGBOOST_USE_HIP)
|
||||
#include "elementwise_metric.hip"
|
||||
#endif // !defined(XGBOOST_USE_CUDA)
|
||||
#endif // !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
|
||||
|
||||
@ -1,2 +1,4 @@
|
||||
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
#include "elementwise_metric.cu"
|
||||
#endif
|
||||
|
||||
@ -3,6 +3,6 @@
|
||||
*/
|
||||
// Dummy file to keep the CUDA conditional compile trick.
|
||||
|
||||
#if !defined(XGBOOST_USE_CUDA)
|
||||
#if !defined(XGBOOST_USE_CUDA) && !defined(XGBOOST_USE_HIP)
|
||||
#include "multiclass_metric.cu"
|
||||
#endif // !defined(XGBOOST_USE_CUDA)
|
||||
|
||||
@ -23,6 +23,15 @@
|
||||
#include "../common/device_helpers.cuh"
|
||||
#endif // XGBOOST_USE_CUDA
|
||||
|
||||
#if defined(XGBOOST_USE_HIP)
|
||||
#include <thrust/execution_policy.h> // thrust::cuda::par
|
||||
#include <thrust/functional.h> // thrust::plus<>
|
||||
#include <thrust/iterator/counting_iterator.h>
|
||||
#include <thrust/transform_reduce.h>
|
||||
|
||||
#include "../common/device_helpers.hip.h"
|
||||
#endif // XGBOOST_USE_HIP
|
||||
|
||||
namespace xgboost {
|
||||
namespace metric {
|
||||
// tag the this file, used by force static link later.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user