Rename and extract Context. (#8528)

* Rename `GenericParameter` to `Context`.
* Rename header file to reflect the change.
* Rename all references.
This commit is contained in:
Jiaming Yuan
2022-12-07 04:58:54 +08:00
committed by GitHub
parent 05fc6f3ca9
commit 3e26107a9c
105 changed files with 548 additions and 574 deletions

View File

@@ -590,7 +590,7 @@ TEST(Json, DISABLED_RoundTripExhaustive) {
}
};
int64_t int32_max = static_cast<int64_t>(std::numeric_limits<uint32_t>::max());
GenericParameter ctx;
Context ctx;
common::ParallelFor(int32_max, ctx.Threads(), [&](auto i) { test(static_cast<uint32_t>(i)); });
}

View File

@@ -2,7 +2,7 @@
* Copyright 2021 by XGBoost Contributors
*/
#include <gtest/gtest.h>
#include <xgboost/generic_parameters.h>
#include <xgboost/context.h>
#include <xgboost/host_device_vector.h>
#include <xgboost/linalg.h>
@@ -13,7 +13,7 @@
namespace xgboost {
namespace linalg {
namespace {
auto kCpuId = GenericParameter::kCpuId;
auto kCpuId = Context::kCpuId;
}
auto MakeMatrixFromTest(HostDeviceVector<float> *storage, size_t n_rows, size_t n_cols) {

View File

@@ -4,7 +4,7 @@
#include <gtest/gtest.h>
#include "../../../src/common/linalg_op.cuh"
#include "xgboost/generic_parameters.h"
#include "xgboost/context.h"
#include "xgboost/linalg.h"
namespace xgboost {
@@ -21,7 +21,7 @@ void TestElementWiseKernel() {
ASSERT_FALSE(t.CContiguous());
ElementWiseTransformDevice(t, [] __device__(size_t i, float) { return i; });
// CPU view
t = l.View(GenericParameter::kCpuId).Slice(linalg::All(), 1, linalg::All());
t = l.View(Context::kCpuId).Slice(linalg::All(), 1, linalg::All());
size_t k = 0;
for (size_t i = 0; i < l.Shape(0); ++i) {
for (size_t j = 0; j < l.Shape(2); ++j) {
@@ -41,7 +41,7 @@ void TestElementWiseKernel() {
ElementWiseTransformDevice(t, [] XGBOOST_DEVICE(size_t i, float) { return i; });
ASSERT_TRUE(t.CContiguous());
// CPU view
t = l.View(GenericParameter::kCpuId);
t = l.View(Context::kCpuId);
size_t ind = 0;
for (size_t i = 0; i < l.Shape(0); ++i) {

View File

@@ -2,7 +2,7 @@
* Copyright 2022 by XGBoost Contributors
*/
#include <gtest/gtest.h>
#include <xgboost/generic_parameters.h>
#include <xgboost/context.h>
#include "../../../src/common/stats.h"

View File

@@ -2,12 +2,13 @@
* Copyright 2022 by XGBoost Contributors
*/
#include <gtest/gtest.h>
#include <utility>
#include <vector>
#include "../../../src/common/stats.cuh"
#include "xgboost/base.h"
#include "xgboost/generic_parameters.h"
#include "xgboost/context.h"
#include "xgboost/host_device_vector.h"
#include "xgboost/linalg.h"