-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure nvbench initializes nvml context when built statically
- Loading branch information
1 parent
70c2cf7
commit 25f2976
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
rapids-cmake/cpm/patches/nvbench/nvml_with_static_builds.diff
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,39 @@ | ||
diff --git a/nvbench/device_info.cu b/nvbench/device_info.cu | ||
index 8edad22..a09def3 100644 | ||
--- a/nvbench/device_info.cu | ||
+++ b/nvbench/device_info.cu | ||
@@ -25,6 +25,10 @@ | ||
|
||
#include <cuda_runtime_api.h> | ||
|
||
+#ifdef NVBENCH_HAS_NVML | ||
+#include <nvbench/internal/nvml.cxx> | ||
+#endif | ||
+ | ||
#define UNUSED(x) (void)(x) | ||
|
||
namespace nvbench | ||
@@ -47,6 +51,10 @@ device_info::device_info(int id) | ||
NVBENCH_CUDA_CALL(cudaGetDeviceProperties(&m_prop, m_id)); | ||
|
||
#ifdef NVBENCH_HAS_NVML | ||
+ // NVML's lifetime should extend for the entirety of the process, so store in a | ||
+ // global. | ||
+ [[maybe_unused]] static auto nvml_lifetime = NVMLLifetimeManager(); | ||
+ | ||
// Retrieve the current device's pci_id as a null-terminated string. | ||
// Docs say 13 chars should always be sufficient. | ||
constexpr int pci_id_len = 13; | ||
diff --git a/nvbench/internal/nvml.cxx b/nvbench/internal/nvml.cxx | ||
index 4f750bc..ce7d874 100644 | ||
--- a/nvbench/internal/nvml.cxx | ||
+++ b/nvbench/internal/nvml.cxx | ||
@@ -64,8 +64,4 @@ private: | ||
bool m_inited{false}; | ||
}; | ||
|
||
-// NVML's lifetime should extend for the entirety of the process, so store in a | ||
-// global. | ||
-auto nvml_lifetime = NVMLLifetimeManager{}; | ||
- | ||
} // namespace |
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