diff --git a/edgeless_node/src/gpu_info/jetson.rs b/edgeless_node/src/gpu_info/jetson.rs index 39c8082..00e131c 100644 --- a/edgeless_node/src/gpu_info/jetson.rs +++ b/edgeless_node/src/gpu_info/jetson.rs @@ -126,14 +126,14 @@ pub fn jetson_get_gpu_load() -> i32 { pub fn jetson_get_model_name_gpu() -> String { if let Ok(contents) = fs::read_to_string("/sys/firmware/devicetree/base/model") { // it also trims all non-printable characters like \0 or \n that may exist at the end - return contents.chars().filter(|c| c.is_ascii_graphic() || c.is_whitespace()).collect() + return contents.chars().filter(|c| c.is_ascii_graphic() || c.is_whitespace()).collect(); } - "".to_string() + "".to_string() } /// Jetson-specific implementation to retrieve the GPU mem size -/// see: +/// see: /// - https://forums.developer.nvidia.com/t/unified-memory-on-jetson-platforms/187448 /// - https://forums.developer.nvidia.com/t/gpu-memory-usage-got-by-using-cudamemgetinfo-is-different-with-tegrastats-command/243798 /// @@ -147,7 +147,7 @@ pub fn jetson_get_model_name_gpu() -> String { // MemTotal not found in the /proc/meminfo file // // * -20.0 -// Could not parse as u32 the value read from /proc/meminfo +// Could not parse as u32 the value read from /proc/meminfo // // * -10.0 // Could not read the /proc/meminfo file (file does not exist or permission error) @@ -192,11 +192,10 @@ pub fn jetson_get_num_gpus() -> i32 { 1 // TODO: implement this } - /// Determines if the system is a Jetson board by checking `/sys/firmware/devicetree/base/model`. /// /// # Returns /// * `bool` - True if running on a Jetson board, otherwise false. pub fn is_jetson_board() -> bool { - get_model_name_gpu().to_lowercase().contains("jetson") + jetson_get_model_name_gpu().to_lowercase().contains("jetson") } diff --git a/edgeless_node/src/gpu_info/mod.rs b/edgeless_node/src/gpu_info/mod.rs index 75b1bea..8bcfec0 100644 --- a/edgeless_node/src/gpu_info/mod.rs +++ b/edgeless_node/src/gpu_info/mod.rs @@ -85,7 +85,6 @@ pub fn get_mem_size_gpu() -> i32 { } } - /// Determines the board type. /// /// # Returns diff --git a/edgeless_node/src/lib.rs b/edgeless_node/src/lib.rs index 43e3aab..fdac8d8 100644 --- a/edgeless_node/src/lib.rs +++ b/edgeless_node/src/lib.rs @@ -239,7 +239,9 @@ fn get_capabilities(runtimes: Vec, user_node_capabilities: NodeCapabilit .unwrap_or((unique_total_space.values().sum::() / (1024 * 1024)) as u32), num_gpus: user_node_capabilities.num_gpus.unwrap_or(crate::gpu_info::get_num_gpus() as u32), model_name_gpu: user_node_capabilities.model_name_gpu.unwrap_or(crate::gpu_info::get_model_name_gpu()), - mem_size_gpu: user_node_capabilities.mem_size_gpu.unwrap_or((crate::gpu_info::get_mem_size_gpu() / (1024) ) as u32), + mem_size_gpu: user_node_capabilities + .mem_size_gpu + .unwrap_or((crate::gpu_info::get_mem_size_gpu() / (1024)) as u32), } }