Skip optional synchronization in thrust. (#9212)
This commit is contained in:
parent
ddec0f378c
commit
ae7450ce54
@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2022 by XGBoost Contributors
|
||||
* Copyright 2022-2023, XGBoost Contributors
|
||||
*/
|
||||
#ifndef XGBOOST_COMMON_CUDA_CONTEXT_CUH_
|
||||
#define XGBOOST_COMMON_CUDA_CONTEXT_CUH_
|
||||
@ -17,11 +17,23 @@ struct CUDAContext {
|
||||
/**
|
||||
* \brief Caching thrust policy.
|
||||
*/
|
||||
auto CTP() const { return thrust::cuda::par(caching_alloc_).on(dh::DefaultStream()); }
|
||||
auto CTP() const {
|
||||
#if THRUST_MAJOR_VERSION >= 2
|
||||
return thrust::cuda::par_nosync(caching_alloc_).on(dh::DefaultStream());
|
||||
#else
|
||||
return thrust::cuda::par(caching_alloc_).on(dh::DefaultStream());
|
||||
#endif // THRUST_MAJOR_VERSION >= 2
|
||||
}
|
||||
/**
|
||||
* \brief Thrust policy without caching allocator.
|
||||
*/
|
||||
auto TP() const { return thrust::cuda::par(alloc_).on(dh::DefaultStream()); }
|
||||
auto TP() const {
|
||||
#if THRUST_MAJOR_VERSION >= 2
|
||||
return thrust::cuda::par_nosync(alloc_).on(dh::DefaultStream());
|
||||
#else
|
||||
return thrust::cuda::par(alloc_).on(dh::DefaultStream());
|
||||
#endif // THRUST_MAJOR_VERSION >= 2
|
||||
}
|
||||
auto Stream() const { return dh::DefaultStream(); }
|
||||
};
|
||||
} // namespace xgboost
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user