Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R-package/R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,7 @@ xgb.createFolds <- function(y, k) {
#' \url{https://xgboost.readthedocs.io/en/latest/tutorials/saving_model.html}.
#'
#' @examples
#' \dontshow{RhpcBLASctl::omp_set_num_threads(1)}
#' data(agaricus.train, package = "xgboost")
#'
#' bst <- xgb.train(
Expand Down
1 change: 1 addition & 0 deletions R-package/R/xgb.Booster.R
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ xgb.get.handle <- function(object) {
#' \url{https://arxiv.org/abs/1706.06060}
#'
#' @examples
#' \dontshow{RhpcBLASctl::omp_set_num_threads(1)}
#' ## binary classification:
#'
#' data(agaricus.train, package = "xgboost")
Expand Down
4 changes: 2 additions & 2 deletions R-package/configure
Original file line number Diff line number Diff line change
Expand Up @@ -3353,7 +3353,7 @@ fi

ac_config_files="$ac_config_files src/Makevars"

ac_config_headers="$ac_config_headers config.h"
ac_config_headers="$ac_config_headers src/config.h"

cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
Expand Down Expand Up @@ -4041,7 +4041,7 @@ for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"src/Makevars") CONFIG_FILES="$CONFIG_FILES src/Makevars" ;;
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;

*) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
esac
Expand Down
2 changes: 1 addition & 1 deletion R-package/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ AC_SUBST(BACKTRACE_LIB)
AC_SUBST(XGBOOST_BUILTIN_PREFETCH_PRESENT)
AC_SUBST(XGBOOST_MM_PREFETCH_PRESENT)
AC_CONFIG_FILES([src/Makevars])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_HEADERS([src/config.h])
AC_OUTPUT
1 change: 1 addition & 0 deletions R-package/man/a-compatibility-note-for-saveRDS-save.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions R-package/man/predict.xgb.Booster.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion R-package/config.h.in → R-package/src/config.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* src/config.h.in. Generated from configure.ac by autoheader. */

/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
Expand Down
4 changes: 2 additions & 2 deletions R-package/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ extern SEXP XGDMatrixCreateFromDF_R(SEXP, SEXP, SEXP);
extern SEXP XGDMatrixGetStrFeatureInfo_R(SEXP, SEXP);
extern SEXP XGDMatrixNumCol_R(SEXP);
extern SEXP XGDMatrixNumRow_R(SEXP);
extern SEXP XGProxyDMatrixCreate_R();
extern SEXP XGProxyDMatrixCreate_R(void);
extern SEXP XGProxyDMatrixSetDataDense_R(SEXP, SEXP);
extern SEXP XGProxyDMatrixSetDataCSR_R(SEXP, SEXP);
extern SEXP XGProxyDMatrixSetDataColumnar_R(SEXP, SEXP);
extern SEXP XGDMatrixCreateFromCallback_R(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP XGQuantileDMatrixCreateFromCallback_R(SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP, SEXP);
extern SEXP XGDMatrixFree_R(SEXP);
extern SEXP XGGetRNAIntAsDouble();
extern SEXP XGGetRNAIntAsDouble(void);
extern SEXP XGDMatrixGetQuantileCut_R(SEXP);
extern SEXP XGDMatrixNumNonMissing_R(SEXP);
extern SEXP XGDMatrixGetDataAsCSR_R(SEXP);
Expand Down
1 change: 1 addition & 0 deletions ops/script/test_r_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def pkgroot(path: str) -> None:
)

shutil.copytree("R-package", dest)
os.remove(dest / "bootstrap.R")
# core
shutil.copytree("src", dest / "src" / "src")
shutil.copytree("include", dest / "src" / "include")
Expand Down
19 changes: 13 additions & 6 deletions src/data/sparse_page_source.cc
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* Copyright 2021-2024, XGBoost Contributors
* Copyright 2021-2025, XGBoost Contributors
*/
#include "sparse_page_source.h"

#include <cstdio> // for remove
#include <filesystem> // for exists
#include <numeric> // for partial_sum
#include <string> // for string
#include <cstdio> // for remove
#include <filesystem> // for exists, path, is_directory
#include <numeric> // for partial_sum
#include <string> // for string
#include <string_view> // for string_view

#include "../collective/communicator-inl.h" // for IsDistributed, GetRank

Expand All @@ -31,7 +32,13 @@ void TryDeleteCacheFile(const std::string& file) {
}

std::string MakeCachePrefix(std::string cache_prefix) {
cache_prefix = cache_prefix.empty() ? "DMatrix" : cache_prefix;
std::string_view constexpr kDftname{"DMatrix"};
cache_prefix = cache_prefix.empty() ? kDftname : cache_prefix;
// Use the directory if one exists
if (std::filesystem::is_directory(cache_prefix)) {
cache_prefix = (std::filesystem::path{cache_prefix} / kDftname).string(); // NOLINT
}
// Avoid conflicts in distributed environments.
if (collective::IsDistributed()) {
cache_prefix += ("-r" + std::to_string(collective::GetRank()));
}
Expand Down
7 changes: 4 additions & 3 deletions tests/cpp/helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,10 @@ void MakeLabels(DeviceOrd device, bst_idx_t n_samples, bst_target_t n_classes,
std::shared_ptr<DMatrix> p_fmat{
DMatrix::Create(static_cast<DataIterHandle>(iter.get()), iter->Proxy(), Reset, Next, config)};

auto row_page_path =
data::MakeId(prefix, dynamic_cast<data::SparsePageDMatrix*>(p_fmat.get())) + ".row.page";
EXPECT_TRUE(FileExists(row_page_path)) << row_page_path;
auto row_page_path = data::MakeId(data::MakeCachePrefix(prefix),
dynamic_cast<data::SparsePageDMatrix*>(p_fmat.get())) +
".row.page";
EXPECT_TRUE(FileExists(row_page_path)) << row_page_path << " prefix:" << prefix;

// Loop over the batches and count the number of pages
std::size_t batch_count = 0;
Expand Down
Loading