Remove omp_get_max_threads (#7608)
This is the one last PR for removing omp global variable. * Add context object to the `DMatrix`. This bridges `DMatrix` with https://github.com/dmlc/xgboost/issues/7308 . * Require context to be available at the construction time of booster. * Add `n_threads` support for R csc DMatrix constructor. * Remove `omp_get_max_threads` in R glue code. * Remove threading utilities that rely on omp global variable.
This commit is contained in:
@@ -69,11 +69,12 @@ class IterativeDeviceDMatrix : public DMatrix {
|
||||
|
||||
bool SingleColBlock() const override { return false; }
|
||||
|
||||
MetaInfo& Info() override {
|
||||
return info_;
|
||||
}
|
||||
MetaInfo const& Info() const override {
|
||||
return info_;
|
||||
MetaInfo &Info() override { return info_; }
|
||||
MetaInfo const &Info() const override { return info_; }
|
||||
|
||||
GenericParameter const *Ctx() const override {
|
||||
LOG(FATAL) << "`IterativeDMatrix` doesn't have context.";
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -79,6 +79,11 @@ class DMatrixProxy : public DMatrix {
|
||||
|
||||
MetaInfo& Info() override { return info_; }
|
||||
MetaInfo const& Info() const override { return info_; }
|
||||
GenericParameter const* Ctx() const override {
|
||||
LOG(FATAL) << "`ProxyDMatrix` doesn't have context.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool SingleColBlock() const override { return true; }
|
||||
bool EllpackExists() const override { return true; }
|
||||
bool SparsePageExists() const override { return false; }
|
||||
|
||||
@@ -30,8 +30,8 @@ class SimpleDMatrix : public DMatrix {
|
||||
void SaveToLocalFile(const std::string& fname);
|
||||
|
||||
MetaInfo& Info() override;
|
||||
|
||||
const MetaInfo& Info() const override;
|
||||
GenericParameter const* Ctx() const override { return &ctx_; }
|
||||
|
||||
bool SingleColBlock() const override { return true; }
|
||||
DMatrix* Slice(common::Span<int32_t const> ridxs) override;
|
||||
|
||||
@@ -99,8 +99,8 @@ class SparsePageDMatrix : public DMatrix {
|
||||
}
|
||||
|
||||
MetaInfo& Info() override;
|
||||
|
||||
const MetaInfo& Info() const override;
|
||||
GenericParameter const* Ctx() const override { return &ctx_; }
|
||||
|
||||
bool SingleColBlock() const override { return false; }
|
||||
DMatrix *Slice(common::Span<int32_t const>) override {
|
||||
|
||||
Reference in New Issue
Block a user