Skip to content

Commit

Permalink
Fix running_compute_processes count handling
Browse files Browse the repository at this point in the history
Consistent with running_graphics_processes
  • Loading branch information
jjyyxx authored Oct 13, 2022
1 parent 4965d7e commit 759f61d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nvml-wrapper/src/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ impl<'nvml> Device<'nvml> {
unsafe {
let mut count: c_uint = match self.running_compute_processes_count()? {
0 => return Ok(vec![]),
value => value + 5,
value => value,
};
// Add a bit of headroom in case more processes are launched in
// between the above call to get the expected count and the time we
Expand All @@ -575,6 +575,7 @@ impl<'nvml> Device<'nvml> {

nvml_try(sym(self.device, &mut count, processes.as_mut_ptr()))?;

processes.truncate(count as usize);
Ok(processes.into_iter().map(ProcessInfo::from).collect())
}
}
Expand Down

0 comments on commit 759f61d

Please sign in to comment.