From 54109272ca50c32deab095e949a8ad61f18cbbd6 Mon Sep 17 00:00:00 2001 From: Derek Deming <87205616+derekdeming@users.noreply.github.com> Date: Fri, 16 May 2025 21:15:16 -0400 Subject: [PATCH] Fix temperature sensor call --- chimera/agent/Cargo.toml | 1 + chimera/agent/build.rs | 4 ++-- chimera/agent/src/grpc/mod.rs | 1 - chimera/agent/src/main.rs | 2 +- chimera/agent/src/nvml/mod.rs | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chimera/agent/Cargo.toml b/chimera/agent/Cargo.toml index 2230a574..f3e313cd 100644 --- a/chimera/agent/Cargo.toml +++ b/chimera/agent/Cargo.toml @@ -12,6 +12,7 @@ prost-types = "0.12" tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["fmt", "env-filter"] } nvml-wrapper = "0.9" +sha2 = "0.10" [build-dependencies] prost-build = "0.12" diff --git a/chimera/agent/build.rs b/chimera/agent/build.rs index d9dc8462..83fdb0a5 100644 --- a/chimera/agent/build.rs +++ b/chimera/agent/build.rs @@ -6,8 +6,8 @@ fn main() -> Result<(), Box> { .build_server(true) .build_client(true) // Specify the proto file - .compile(&["/app/proto/telemetry.proto"], &["/app/proto"])?; + .compile(&["../proto/telemetry.proto"], &["../proto"])?; - println!("cargo:rerun-if-changed=/app/proto/telemetry.proto"); + println!("cargo:rerun-if-changed=../proto/telemetry.proto"); Ok(()) } diff --git a/chimera/agent/src/grpc/mod.rs b/chimera/agent/src/grpc/mod.rs index ee8a4779..295faf43 100644 --- a/chimera/agent/src/grpc/mod.rs +++ b/chimera/agent/src/grpc/mod.rs @@ -1,5 +1,4 @@ use tonic::{transport::Server, Request, Response, Status}; -use prost::Message; use crate::hash::trusted_hash; use crate::nvml::{collect_metrics, TelemetryData}; use tokio::time::{sleep, Duration}; diff --git a/chimera/agent/src/main.rs b/chimera/agent/src/main.rs index 055e6fe7..1b9b4957 100644 --- a/chimera/agent/src/main.rs +++ b/chimera/agent/src/main.rs @@ -1,6 +1,6 @@ #![forbid(unsafe_code)] -use tracing::{info, Instrument}; +use tracing::Instrument; mod hash; mod nvml; diff --git a/chimera/agent/src/nvml/mod.rs b/chimera/agent/src/nvml/mod.rs index a924c4c1..55ace647 100644 --- a/chimera/agent/src/nvml/mod.rs +++ b/chimera/agent/src/nvml/mod.rs @@ -1,4 +1,4 @@ -use nvml_wrapper::NVML; +use nvml_wrapper::{Nvml, enum_wrappers::device::TemperatureSensor}; use std::error::Error; #[derive(Default, Clone)] @@ -10,10 +10,10 @@ pub struct TelemetryData { } pub fn collect_metrics() -> Result> { - let nvml = NVML::init()?; + let nvml = Nvml::init()?; let device = nvml.device_by_index(0)?; let memory = device.memory_info()?; - let temperature = device.temperature(0)?; + let temperature = device.temperature(TemperatureSensor::Gpu)?; let ecc_errors = 0u64; // placeholder until NVML bindings available Ok(TelemetryData { gpu_index: 0,