| 32 | } |
| 33 | |
| 34 | std::string MakeCachePrefix(std::string cache_prefix) { |
| 35 | std::string_view constexpr kDftname{"DMatrix"}; |
| 36 | cache_prefix = cache_prefix.empty() ? kDftname : cache_prefix; |
| 37 | // Use the directory if one exists |
| 38 | if (std::filesystem::is_directory(cache_prefix)) { |
| 39 | cache_prefix = (std::filesystem::path{cache_prefix} / kDftname).string(); // NOLINT |
| 40 | } |
| 41 | // Avoid conflicts in distributed environments. |
| 42 | if (collective::IsDistributed()) { |
| 43 | cache_prefix += ("-r" + std::to_string(collective::GetRank())); |
| 44 | } |
| 45 | return cache_prefix; |
| 46 | } |
| 47 | } // namespace xgboost::data |
no test coverage detected