dcgm: patch for modern GCC

Just a few missing includes, really nothing too bad at all.
This commit is contained in:
Emily 2024-11-19 18:31:39 +00:00
parent decc7e8faf
commit 2301651b8c
2 changed files with 117 additions and 6 deletions

View File

@ -0,0 +1,110 @@
diff --git a/common/CudaWorker/DcgmDgemm.cpp b/common/CudaWorker/DcgmDgemm.cpp
index 8d33a3256e..6b3284258d 100644
--- a/common/CudaWorker/DcgmDgemm.cpp
+++ b/common/CudaWorker/DcgmDgemm.cpp
@@ -17,6 +17,7 @@
#include <exception>
#include <stdexcept>
+#include <cinttypes>
#define CU_CHK(op) \
if (auto const status = op; status != CUBLAS_STATUS_SUCCESS) \
@@ -122,4 +123,4 @@
return CUBLAS_STATUS_SUCCESS;
}
-} // namespace DcgmNs
\ No newline at end of file
+} // namespace DcgmNs
diff --git a/common/DcgmError.h b/common/DcgmError.h
index 8638cdceb1..e8d817c0d4 100644
--- a/common/DcgmError.h
+++ b/common/DcgmError.h
@@ -17,6 +17,7 @@
#include <sstream>
#include <string>
+#include <cinttypes>
#include <dcgm_agent.h>
#include <dcgm_errors.h>
diff --git a/common/DcgmStringHelpers.cpp b/common/DcgmStringHelpers.cpp
index b41917e3b7..1fe63980c7 100644
--- a/common/DcgmStringHelpers.cpp
+++ b/common/DcgmStringHelpers.cpp
@@ -17,6 +17,7 @@
#include <cstring>
#include <string>
+#include <algorithm>
/*****************************************************************************/
void dcgmTokenizeString(const std::string &src, const std::string &delimiter, std::vector<std::string> &tokens)
diff --git a/dcgmi/CommandOutputController.cpp b/dcgmi/CommandOutputController.cpp
index 5057205564..8520171efa 100644
--- a/dcgmi/CommandOutputController.cpp
+++ b/dcgmi/CommandOutputController.cpp
@@ -24,6 +24,7 @@
#include "dcgm_agent.h"
#include <DcgmStringHelpers.h>
#include <algorithm>
+#include <functional>
#include <cstdarg>
#include <iostream>
#include <string>
diff --git a/dcgmi/Diag.h b/dcgmi/Diag.h
index a326f7b949..563fb3c9c0 100755
--- a/dcgmi/Diag.h
+++ b/dcgmi/Diag.h
@@ -24,6 +24,7 @@
#define DIAG_H_
#include <optional>
+#include <functional>
#include "Command.h"
#include "CommandOutputController.h"
diff --git a/hostengine/src/HostEngineOutput.cpp b/hostengine/src/HostEngineOutput.cpp
index 23c6ca9f54..798b83b3e4 100644
--- a/hostengine/src/HostEngineOutput.cpp
+++ b/hostengine/src/HostEngineOutput.cpp
@@ -20,6 +20,7 @@
#include <iostream>
#include <limits>
#include <string_view>
+#include <unordered_map>
namespace
{
@@ -365,4 +366,4 @@
}
}
os << std::endl;
-}
\ No newline at end of file
+}
diff --git a/nvvs/src/NvvsCommon.cpp b/nvvs/src/NvvsCommon.cpp
index 8f7888649b..1604d9dabe 100644
--- a/nvvs/src/NvvsCommon.cpp
+++ b/nvvs/src/NvvsCommon.cpp
@@ -15,6 +15,7 @@
*/
#include <sstream>
#include <stdexcept>
+#include <algorithm>
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/sdk/nvidia/nvml/nvml_loader/nvml_loader.cpp b/sdk/nvidia/nvml/nvml_loader/nvml_loader.cpp
index 9eebeaf1c4..6e21201229 100644
--- a/sdk/nvidia/nvml/nvml_loader/nvml_loader.cpp
+++ b/sdk/nvidia/nvml/nvml_loader/nvml_loader.cpp
@@ -20,6 +20,7 @@
#include <atomic>
#include <mutex>
+#include <cstdlib>
static void *g_nvmlLib = 0;
static std::atomic_uint32_t g_nvmlStaticLibResetHooksCount = 1;

View File

@ -1,5 +1,5 @@
{ lib { lib
, gcc11Stdenv , stdenv
, fetchFromGitHub , fetchFromGitHub
, autoAddDriverRunpath , autoAddDriverRunpath
, catch2 , catch2
@ -58,10 +58,7 @@ let
"${lib.getLib cudaPackages.libcublas}/lib/libcublasLt.so" "${lib.getLib cudaPackages.libcublas}/lib/libcublasLt.so"
])) ]))
]; ];
in stdenv.mkDerivation rec {
# gcc11 is required by DCGM's very particular build system
# C.f. https://github.com/NVIDIA/DCGM/blob/7e1012302679e4bb7496483b32dcffb56e528c92/dcgmbuild/build.sh#L22
in gcc11Stdenv.mkDerivation rec {
pname = "dcgm"; pname = "dcgm";
version = "3.3.9"; # N.B: If you change this, be sure prometheus-dcgm-exporter supports this version. version = "3.3.9"; # N.B: If you change this, be sure prometheus-dcgm-exporter supports this version.
@ -73,6 +70,7 @@ in gcc11Stdenv.mkDerivation rec {
}; };
patches = [ patches = [
./fix-includes.patch
./dynamic-libs.patch ./dynamic-libs.patch
]; ];
@ -100,7 +98,7 @@ in gcc11Stdenv.mkDerivation rec {
tclap_1_4 tclap_1_4
fmt_9 fmt_9
(yaml-cpp.override { stdenv = gcc11Stdenv; }) yaml-cpp
jsoncpp jsoncpp
libevent libevent
]; ];
@ -108,6 +106,9 @@ in gcc11Stdenv.mkDerivation rec {
# Add our paths to the CMake flags so FindCuda.cmake can find them. # Add our paths to the CMake flags so FindCuda.cmake can find them.
cmakeFlags = lib.concatMap mkCudaFlags cudaPackageSets; cmakeFlags = lib.concatMap mkCudaFlags cudaPackageSets;
# Lots of dodgy C++.
env.NIX_CFLAGS_COMPILE = "-Wno-error";
disallowedReferences = lib.concatMap getCudaPackages cudaPackageSets; disallowedReferences = lib.concatMap getCudaPackages cudaPackageSets;
meta = with lib; { meta = with lib; {