feat(backend): remove all the logs from hardware.hpp

This commit is contained in:
Morgan Funtowicz 2024-11-19 00:19:22 +01:00
parent 3a2698fb79
commit 6d3565759a
1 changed files with 2 additions and 7 deletions

View File

@ -2,7 +2,6 @@
#include <optional> #include <optional>
#include <nvml.h> #include <nvml.h>
#include <spdlog/spdlog.h>
namespace huggingface::tgi::hardware::cuda { namespace huggingface::tgi::hardware::cuda {
static constexpr auto VOLTA = std::make_tuple(7u, 0u); static constexpr auto VOLTA = std::make_tuple(7u, 0u);
@ -18,7 +17,6 @@ namespace huggingface::tgi::hardware::cuda {
std::optional<size_t> get_device_count() { std::optional<size_t> get_device_count() {
uint32_t numGpus = 0; uint32_t numGpus = 0;
if (nvmlDeviceGetCount_v2(&numGpus) == NVML_SUCCESS) { if (nvmlDeviceGetCount_v2(&numGpus) == NVML_SUCCESS) {
SPDLOG_DEBUG(FMT_STRING("Detected {:d} GPUs on the machine"), numGpus);
return numGpus; return numGpus;
} else { } else {
return std::nullopt; return std::nullopt;
@ -33,13 +31,10 @@ namespace huggingface::tgi::hardware::cuda {
int32_t minor; int32_t minor;
compute_capabilities_t(): compute_capabilities_t(0) {} compute_capabilities_t(): compute_capabilities_t(0) {}
explicit compute_capabilities_t(size_t device_idx): major(0), minor(0) { explicit compute_capabilities_t(size_t device_idx): major(-1), minor(-1) {
nvmlDevice_t device; nvmlDevice_t device;
if (nvmlDeviceGetHandleByIndex_v2(device_idx, &device) == NVML_SUCCESS) { if (nvmlDeviceGetHandleByIndex_v2(device_idx, &device) == NVML_SUCCESS) {
SPDLOG_DEBUG("Successfully acquired nvmlDevice_t = 0"); nvmlDeviceGetCudaComputeCapability(device, &major, &minor);
if (nvmlDeviceGetCudaComputeCapability(device, &major, &minor) == NVML_SUCCESS) {
SPDLOG_INFO(FMT_STRING("Detected sm_{:d}{:d} compute capabilities"), major, minor);
}
} }
}; };
compute_capabilities_t(int32_t major, int32_t minor): major(major), minor(minor) {} compute_capabilities_t(int32_t major, int32_t minor): major(major), minor(minor) {}