From f246a346207372fa11f8ad8b436acf9f69c07ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tuomas=20M=C3=A4kinen?= <1947505+tuommaki@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:34:15 +0200 Subject: [PATCH] Only allocate GPU if requirements need it (#102) Now that it's possible to provide program specific resource requirements, the GPU should be only allocated when it's requested. There's still plenty of room for improvement here (mainly allocating the right amount and fee GPUs), but this quick fix should help for the most immediate issues. --- crates/node/src/vmm/qemu.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/node/src/vmm/qemu.rs b/crates/node/src/vmm/qemu.rs index f84c26b1..be63374c 100644 --- a/crates/node/src/vmm/qemu.rs +++ b/crates/node/src/vmm/qemu.rs @@ -244,7 +244,7 @@ impl Provider for Qemu { .args(["-qmp", &format!("tcp:localhost:{qmp_port},server")]); // TODO: When GPU argument handling is refactored, this should be fixed as well. - if self.config.gpu_devices.is_some() { + if self.config.gpu_devices.is_some() && req.gpus > 0 { cmd.args(parse_gpu_devices_into_qemu_params( self.config.gpu_devices.as_ref().unwrap(), ));