From d8e168a81fb6dd6cd6a90b902129686b29429d60 Mon Sep 17 00:00:00 2001 From: Long Pham Date: Wed, 6 Nov 2024 11:35:28 -0800 Subject: [PATCH] Enhance software build performance by utilizing all available CPU cores in the builder --- litex/soc/integration/builder.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/litex/soc/integration/builder.py b/litex/soc/integration/builder.py index 027862e8f..f4d1ef90b 100644 --- a/litex/soc/integration/builder.py +++ b/litex/soc/integration/builder.py @@ -317,8 +317,8 @@ class Builder: def _generate_rom_software(self, compile_bios=True): # Compile all software packages. - for name, src_dir in self.software_packages: - + cpu_count = os.cpu_count() + for name, src_dir in self.software_packages: # Skip BIOS compilation when disabled. if name == "bios" and not compile_bios: continue @@ -326,7 +326,7 @@ class Builder: dst_dir = os.path.join(self.software_dir, name) makefile = os.path.join(src_dir, "Makefile") if self.compile_software: - subprocess.check_call(["make", "-C", dst_dir, "-f", makefile]) + subprocess.check_call(["make", f"-j{cpu_count}", "-C", dst_dir, "-f", makefile]) def _initialize_rom_software(self): # Get BIOS data from compiled BIOS binary.