Fix potential race in feature constraint. (#10719)

This commit is contained in:
Jiaming Yuan
2024-08-21 16:50:31 +08:00
committed by GitHub
parent e9f1abc1f0
commit 402e7837fb
3 changed files with 22 additions and 19 deletions

View File

@@ -1,16 +1,17 @@
/**
* Copyright 2019-2023, XGBoost contributors
* Copyright 2019-2024, XGBoost contributors
*/
#include <gtest/gtest.h>
#include <thrust/copy.h>
#include <thrust/device_vector.h>
#include <cinttypes>
#include <string>
#include <bitset>
#include <cstdint>
#include <set>
#include <string>
#include "../../../src/common/device_helpers.cuh"
#include "../../../src/tree/constraints.cuh"
#include "../../../src/tree/param.h"
#include "../../../src/common/device_helpers.cuh"
namespace xgboost {
namespace {
@@ -36,9 +37,7 @@ std::string GetConstraintsStr() {
}
tree::TrainParam GetParameter() {
std::vector<std::pair<std::string, std::string>> args{
{"interaction_constraints", GetConstraintsStr()}
};
Args args{{"interaction_constraints", GetConstraintsStr()}};
tree::TrainParam param;
param.Init(args);
return param;