xgboost/src/common/common.cu
2018-10-04 16:51:38 +13:00

21 lines
408 B
Plaintext

/*!
* Copyright 2018 XGBoost contributors
*/
#include "common.h"
namespace xgboost {
int AllVisibleImpl::AllVisible() {
int n_visgpus = 0;
try {
// When compiled with CUDA but running on CPU only device,
// cudaGetDeviceCount will fail.
dh::safe_cuda(cudaGetDeviceCount(&n_visgpus));
} catch(const dmlc::Error &except) {
return 0;
}
return n_visgpus;
}
} // namespace xgboost