Consistent use of context to specify number of threads. (#8733)

- Use context in all tests.
- Use context in R.
- Use context in C API DMatrix initialization. (0 threads is used as dft).
This commit is contained in:
Jiaming Yuan
2023-01-30 15:25:31 +08:00
committed by GitHub
parent 21a28f2cc5
commit 3760cede0f
24 changed files with 212 additions and 152 deletions

View File

@@ -1,5 +1,5 @@
/*!
* Copyright 2021-2022 by XGBoost contributors
/**
* Copyright 2021-2023 by XGBoost contributors
*/
#include <gtest/gtest.h>
#include <xgboost/host_device_vector.h>
@@ -62,7 +62,6 @@ class TestPredictionCache : public ::testing::Test {
void RunTest(std::string updater_name) {
{
omp_set_num_threads(1);
Context ctx;
ctx.InitAllowUnknown(Args{{"nthread", "8"}});
if (updater_name == "grow_gpu_hist") {