fix CAPI BuildInfo
This commit is contained in:
parent
c50cc424bc
commit
06d9b998ce
@ -1 +1 @@
|
|||||||
Subproject commit dfd9365264a060a5096734b7d892e1858b6d2722
|
Subproject commit ea21135fbb141ae103fb5fc960289b5601b468f2
|
||||||
@ -17,8 +17,11 @@ namespace xgboost {
|
|||||||
void XGBBuildInfoDevice(Json *p_info) {
|
void XGBBuildInfoDevice(Json *p_info) {
|
||||||
auto &info = *p_info;
|
auto &info = *p_info;
|
||||||
|
|
||||||
|
#if defined(XGBOOST_USE_CUDA)
|
||||||
info["USE_CUDA"] = true;
|
info["USE_CUDA"] = true;
|
||||||
|
#elif defined(XGBOOST_USE_HIP)
|
||||||
info["USE_HIP"] = true;
|
info["USE_HIP"] = true;
|
||||||
|
#endif
|
||||||
|
|
||||||
std::vector<Json> v{Json{Integer{THRUST_MAJOR_VERSION}}, Json{Integer{THRUST_MINOR_VERSION}},
|
std::vector<Json> v{Json{Integer{THRUST_MAJOR_VERSION}}, Json{Integer{THRUST_MINOR_VERSION}},
|
||||||
Json{Integer{THRUST_SUBMINOR_VERSION}}};
|
Json{Integer{THRUST_SUBMINOR_VERSION}}};
|
||||||
@ -29,6 +32,9 @@ void XGBBuildInfoDevice(Json *p_info) {
|
|||||||
|
|
||||||
#if defined(XGBOOST_USE_NCCL)
|
#if defined(XGBOOST_USE_NCCL)
|
||||||
info["USE_NCCL"] = Boolean{true};
|
info["USE_NCCL"] = Boolean{true};
|
||||||
|
v = {Json{Integer{NCCL_MAJOR}}, Json{Integer{NCCL_MINOR}}, Json{Integer{NCCL_PATCH}}};
|
||||||
|
info["NCCL_VERSION"] = v;
|
||||||
|
#elif defined(XGBOOST_USE_RCCL)
|
||||||
info["USE_RCCL"] = Boolean{true};
|
info["USE_RCCL"] = Boolean{true};
|
||||||
v = {Json{Integer{NCCL_MAJOR}}, Json{Integer{NCCL_MINOR}}, Json{Integer{NCCL_PATCH}}};
|
v = {Json{Integer{NCCL_MAJOR}}, Json{Integer{NCCL_MINOR}}, Json{Integer{NCCL_PATCH}}};
|
||||||
info["NCCL_VERSION"] = v;
|
info["NCCL_VERSION"] = v;
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include "device_communicator.cuh"
|
#include "device_communicator.cuh"
|
||||||
#include "device_communicator_adapter.cuh"
|
#include "device_communicator_adapter.cuh"
|
||||||
#include "noop_communicator.h"
|
#include "noop_communicator.h"
|
||||||
#ifdef XGBOOST_USE_NCCL
|
#if defined(XGBOOST_USE_NCCL) || defined(XGBOOST_USE_RCCL)
|
||||||
#include "nccl_device_communicator.cuh"
|
#include "nccl_device_communicator.cuh"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ void Communicator::Finalize() {
|
|||||||
DeviceCommunicator* Communicator::GetDevice(int device_ordinal) {
|
DeviceCommunicator* Communicator::GetDevice(int device_ordinal) {
|
||||||
if (!device_communicator_ || device_ordinal_ != device_ordinal) {
|
if (!device_communicator_ || device_ordinal_ != device_ordinal) {
|
||||||
device_ordinal_ = device_ordinal;
|
device_ordinal_ = device_ordinal;
|
||||||
#ifdef XGBOOST_USE_NCCL
|
#if defined(XGBOOST_USE_NCCL) || defined(XGBOOST_USE_RCCL)
|
||||||
if (type_ != CommunicatorType::kFederated) {
|
if (type_ != CommunicatorType::kFederated) {
|
||||||
device_communicator_.reset(new NcclDeviceCommunicator(device_ordinal, Get()));
|
device_communicator_.reset(new NcclDeviceCommunicator(device_ordinal, Get()));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -38,9 +38,9 @@
|
|||||||
#include "xgboost/logging.h"
|
#include "xgboost/logging.h"
|
||||||
#include "xgboost/span.h"
|
#include "xgboost/span.h"
|
||||||
|
|
||||||
#ifdef XGBOOST_USE_NCCL
|
#ifdef XGBOOST_USE_RCCL
|
||||||
#include "nccl.h"
|
#include "rccl.h"
|
||||||
#endif // XGBOOST_USE_NCCL
|
#endif // XGBOOST_USE_RCCL
|
||||||
|
|
||||||
#if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
|
#if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
|
||||||
#include "rmm/mr/device/per_device_resource.hpp"
|
#include "rmm/mr/device/per_device_resource.hpp"
|
||||||
|
|||||||
@ -362,10 +362,13 @@ TEST(CAPI, BuildInfo) {
|
|||||||
XGBuildInfo(&out);
|
XGBuildInfo(&out);
|
||||||
auto loaded = Json::Load(StringView{out});
|
auto loaded = Json::Load(StringView{out});
|
||||||
ASSERT_TRUE(get<Object const>(loaded).find("USE_OPENMP") != get<Object const>(loaded).cend());
|
ASSERT_TRUE(get<Object const>(loaded).find("USE_OPENMP") != get<Object const>(loaded).cend());
|
||||||
|
#if defined(XGBOOST_USE_CUDA)
|
||||||
ASSERT_TRUE(get<Object const>(loaded).find("USE_CUDA") != get<Object const>(loaded).cend());
|
ASSERT_TRUE(get<Object const>(loaded).find("USE_CUDA") != get<Object const>(loaded).cend());
|
||||||
ASSERT_TRUE(get<Object const>(loaded).find("USE_NCCL") != get<Object const>(loaded).cend());
|
ASSERT_TRUE(get<Object const>(loaded).find("USE_NCCL") != get<Object const>(loaded).cend());
|
||||||
|
#elif defined(XGBOOST_USE_HIP)
|
||||||
ASSERT_TRUE(get<Object const>(loaded).find("USE_HIP") != get<Object const>(loaded).cend());
|
ASSERT_TRUE(get<Object const>(loaded).find("USE_HIP") != get<Object const>(loaded).cend());
|
||||||
ASSERT_TRUE(get<Object const>(loaded).find("USE_RCCL") != get<Object const>(loaded).cend());
|
ASSERT_TRUE(get<Object const>(loaded).find("USE_RCCL") != get<Object const>(loaded).cend());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(CAPI, NullPtr) {
|
TEST(CAPI, NullPtr) {
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2022-2023, XGBoost contributors
|
* Copyright 2022-2023, XGBoost contributors
|
||||||
*/
|
*/
|
||||||
#ifdef XGBOOST_USE_NCCL
|
#if defined(XGBOOST_USE_NCCL) || defined(XGBOOST_USE_RCCL)
|
||||||
|
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
#include <string> // for string
|
#include <string> // for string
|
||||||
|
|
||||||
|
#if defined(XGBOOST_USE_NCCL)
|
||||||
#include "../../../src/collective/nccl_device_communicator.cuh"
|
#include "../../../src/collective/nccl_device_communicator.cuh"
|
||||||
|
#elif defined(XGBOOST_USE_RCCL)
|
||||||
|
#include "../../../src/collective/nccl_device_communicator.hip.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace xgboost {
|
namespace xgboost {
|
||||||
namespace collective {
|
namespace collective {
|
||||||
@ -33,4 +37,4 @@ TEST(NcclDeviceCommunicatorSimpleTest, SystemError) {
|
|||||||
} // namespace collective
|
} // namespace collective
|
||||||
} // namespace xgboost
|
} // namespace xgboost
|
||||||
|
|
||||||
#endif // XGBOOST_USE_NCCL
|
#endif // XGBOOST_USE_NCCL || XGBOOST_USE_RCCL
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user