forked from dmlc/xgboost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EM] Support mmap backed ellpack. (dmlc#10602)
- Support resource view in ellpack. - Define the CUDA version of MMAP resource. - Define the CUDA version of malloc resource. - Refactor cuda runtime API wrappers, and add memory access related wrappers. - gather windows macros into a single header.
- Loading branch information
1 parent
e9fbce9
commit 292bb67
Showing
59 changed files
with
887 additions
and
644 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/** | ||
* Copyright 2024, XGBoost Contributors | ||
* | ||
* @brief Macro for Windows. | ||
*/ | ||
#pragma once | ||
|
||
#if !defined(xgboost_IS_WIN) | ||
|
||
#if defined(_MSC_VER) || defined(__MINGW32__) | ||
#define xgboost_IS_WIN 1 | ||
#endif // defined(_MSC_VER) || defined(__MINGW32__) | ||
|
||
#endif // !defined(xgboost_IS_WIN) | ||
|
||
#if defined(xgboost_IS_WIN) | ||
|
||
#if !defined(NOMINMAX) | ||
#define NOMINMAX | ||
#endif // !defined(NOMINMAX) | ||
|
||
// A macro used inside `windows.h` to avoid conflicts with `winsock2.h` | ||
#define WIN32_LEAN_AND_MEAN | ||
|
||
#if !defined(xgboost_IS_MINGW) | ||
|
||
#if defined(__MINGW32__) | ||
#define xgboost_IS_MINGW 1 | ||
#endif // defined(__MINGW32__) | ||
|
||
#endif // xgboost_IS_MINGW | ||
|
||
#endif // defined(xgboost_IS_WIN) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
/*! | ||
* Copyright 2018-2022 XGBoost contributors | ||
/** | ||
* Copyright 2018-2024, XGBoost contributors | ||
*/ | ||
#include "common.h" | ||
|
||
namespace xgboost { | ||
namespace common { | ||
#include <thrust/system/cuda/error.h> | ||
#include <thrust/system_error.h> | ||
|
||
void SetDevice(std::int32_t device) { | ||
if (device >= 0) { | ||
dh::safe_cuda(cudaSetDevice(device)); | ||
} | ||
} | ||
#include "common.h" | ||
|
||
int AllVisibleGPUs() { | ||
int n_visgpus = 0; | ||
try { | ||
// When compiled with CUDA but running on CPU only device, | ||
// cudaGetDeviceCount will fail. | ||
dh::safe_cuda(cudaGetDeviceCount(&n_visgpus)); | ||
} catch (const dmlc::Error &) { | ||
cudaGetLastError(); // reset error. | ||
return 0; | ||
namespace dh { | ||
void ThrowOnCudaError(cudaError_t code, const char *file, int line) { | ||
if (code != cudaSuccess) { | ||
std::string f; | ||
if (file != nullptr) { | ||
f = file; | ||
} | ||
LOG(FATAL) << thrust::system_error(code, thrust::cuda_category(), | ||
f + ": " + std::to_string(line)) | ||
.what(); | ||
} | ||
return n_visgpus; | ||
} | ||
|
||
} // namespace common | ||
} // namespace xgboost | ||
} // namespace dh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.