Skip to content

Commit

Permalink
Add even scarier warning
Browse files Browse the repository at this point in the history
  • Loading branch information
WillNilges committed Feb 4, 2023
1 parent c9b501a commit 3207d5e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::collections::HashMap;
use nvml_wrapper::{Nvml,error::NvmlError};

use users::get_user_by_uid;
use sysinfo::{Pid, ProcessExt, System, SystemExt};
use colored::Colorize;
Expand Down Expand Up @@ -72,6 +72,7 @@ fn banner_summary(processes: &Vec<GPUprocess>) {

fn print_warnings(processes: &Vec<GPUprocess>) {
let mut gpus = vec![];
let mut users: Vec<String> = vec![];
for proc in processes {
if gpus.contains(&proc.device_number) {
println!(
Expand All @@ -81,6 +82,19 @@ fn print_warnings(processes: &Vec<GPUprocess>) {
}
gpus.push(proc.device_number);
}

let mut map = HashMap::new();
for e in processes {
map.entry(e.device_number).or_insert(vec!()).push(e);
}
println!("{}", "PLEASE CONTACT THE FOLLOWING USERS TO COORDINATE WORKLOADS:".red());
for (size, item) in map {
if size > 1 {
println!("- {}", item[0].user.red().bold());
}
}

//println!("PLEASE CONTACT THE FOLLOWING PEOPLE TO COORDINATE YOUR WORKLOAD: {:?}", map);
}

fn print_device_count(nvml: &Nvml) {
Expand Down

0 comments on commit 3207d5e

Please sign in to comment.