Remove internal use of gpu_id. (#9568)
This commit is contained in:
@@ -1,31 +1,27 @@
|
||||
/*!
|
||||
* Copyright 2021 XGBoost contributors
|
||||
/**
|
||||
* Copyright 2021-2023, XGBoost contributors
|
||||
*/
|
||||
#include <gtest/gtest.h>
|
||||
#include "../helpers.h"
|
||||
#include "../../../src/data/proxy_dmatrix.h"
|
||||
#include "../../../src/data/adapter.h"
|
||||
|
||||
namespace xgboost {
|
||||
namespace data {
|
||||
#include "../../../src/data/adapter.h"
|
||||
#include "../../../src/data/proxy_dmatrix.h"
|
||||
#include "../helpers.h"
|
||||
|
||||
namespace xgboost::data {
|
||||
TEST(ProxyDMatrix, HostData) {
|
||||
DMatrixProxy proxy;
|
||||
size_t constexpr kRows = 100, kCols = 10;
|
||||
std::vector<HostDeviceVector<float>> label_storage(1);
|
||||
|
||||
HostDeviceVector<float> storage;
|
||||
auto data = RandomDataGenerator(kRows, kCols, 0.5)
|
||||
.Device(0)
|
||||
.GenerateArrayInterface(&storage);
|
||||
auto data =
|
||||
RandomDataGenerator(kRows, kCols, 0.5).Device(FstCU()).GenerateArrayInterface(&storage);
|
||||
|
||||
proxy.SetArrayData(data.c_str());
|
||||
|
||||
auto n_samples = HostAdapterDispatch(
|
||||
&proxy, [](auto const &value) { return value.Size(); });
|
||||
auto n_samples = HostAdapterDispatch(&proxy, [](auto const &value) { return value.Size(); });
|
||||
ASSERT_EQ(n_samples, kRows);
|
||||
auto n_features = HostAdapterDispatch(
|
||||
&proxy, [](auto const &value) { return value.NumCols(); });
|
||||
auto n_features = HostAdapterDispatch(&proxy, [](auto const &value) { return value.NumCols(); });
|
||||
ASSERT_EQ(n_features, kCols);
|
||||
}
|
||||
} // namespace data
|
||||
} // namespace xgboost
|
||||
} // namespace xgboost::data
|
||||
|
||||
Reference in New Issue
Block a user