Skip to content

Commit

Permalink
Fix linter errors regarding gpu_info updates
Browse files Browse the repository at this point in the history
  • Loading branch information
CSpyridakis committed Nov 22, 2024
1 parent dd96aac commit f760cf7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
11 changes: 5 additions & 6 deletions edgeless_node/src/gpu_info/jetson.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand All @@ -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)
Expand Down Expand Up @@ -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")
}
1 change: 0 additions & 1 deletion edgeless_node/src/gpu_info/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ pub fn get_mem_size_gpu() -> i32 {
}
}


/// Determines the board type.
///
/// # Returns
Expand Down
4 changes: 3 additions & 1 deletion edgeless_node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,9 @@ fn get_capabilities(runtimes: Vec<String>, user_node_capabilities: NodeCapabilit
.unwrap_or((unique_total_space.values().sum::<u64>() / (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),
}
}

Expand Down

0 comments on commit f760cf7

Please sign in to comment.