Skip to content

Commit 6bff3d6

Browse files
committed
add an option to limit build parallelism
1 parent cae7049 commit 6bff3d6

File tree

7 files changed

+18
-10
lines changed

7 files changed

+18
-10
lines changed

devops/scripts/benchmarks/benches/compute.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def setup(self):
6464

6565
run(configure_command, add_sycl=True)
6666

67-
run(f"cmake --build {build_path} -j", add_sycl=True)
67+
run(f"cmake --build {build_path} -j {options.build_jobs}", add_sycl=True)
6868

6969
self.built = True
7070

devops/scripts/benchmarks/benches/llamacpp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def setup(self):
6767
run(configure_command, add_sycl=True)
6868

6969
run(
70-
f"cmake --build {self.build_path} -j",
70+
f"cmake --build {self.build_path} -j {options.build_jobs}",
7171
add_sycl=True,
7272
ld_library=self.oneapi.ld_libraries(),
7373
)

devops/scripts/benchmarks/benches/syclbench.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def setup(self):
5151
]
5252

5353
run(configure_command, add_sycl=True)
54-
run(f"cmake --build {build_path} -j", add_sycl=True)
54+
run(f"cmake --build {build_path} -j {options.build_jobs}", add_sycl=True)
5555

5656
self.built = True
5757

devops/scripts/benchmarks/benches/velocity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def setup(self):
101101

102102
run(configure_command, {"CC": "clang", "CXX": "clang++"}, add_sycl=True)
103103
run(
104-
f"cmake --build {build_path} -j",
104+
f"cmake --build {build_path} -j {options.build_jobs}",
105105
add_sycl=True,
106106
ld_library=self.ld_libraries(),
107107
)

devops/scripts/benchmarks/main.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,12 @@ def validate_and_parse_env_args(env_args):
481481
help="Specify a custom results directory",
482482
default=options.custom_results_dir,
483483
)
484+
parser.add_argument(
485+
"--build-jobs",
486+
type=int,
487+
help="Number of build jobs to run simultaneously",
488+
default=options.build_jobs,
489+
)
484490

485491
args = parser.parse_args()
486492
additional_env_vars = validate_and_parse_env_args(args.env)
@@ -508,6 +514,7 @@ def validate_and_parse_env_args(env_args):
508514
options.cublas_directory = args.cublas_directory
509515
options.preset = args.preset
510516
options.custom_results_dir = args.results_dir
517+
options.build_jobs = args.build_jobs
511518

512519
if args.build_igc and args.compute_runtime is None:
513520
parser.error("--build-igc requires --compute-runtime to be set")

devops/scripts/benchmarks/options.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from dataclasses import dataclass, field
22
from enum import Enum
3+
import multiprocessing
34

45
from presets import presets
56

@@ -44,6 +45,6 @@ class Options:
4445
current_run_name: str = "This PR"
4546
preset: str = "Full"
4647
custom_results_dir = None
47-
48+
build_jobs: int = multiprocessing.cpu_count()
4849

4950
options = Options()

devops/scripts/benchmarks/utils/compute_runtime.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def build_gmmlib(self, repo, commit):
6262
f"-DCMAKE_BUILD_TYPE=Release",
6363
]
6464
run(configure_command)
65-
run(f"cmake --build {self.gmmlib_build} -j")
65+
run(f"cmake --build {self.gmmlib_build} -j {options.build_jobs}")
6666
run(f"cmake --install {self.gmmlib_build}")
6767
return self.gmmlib_install
6868

@@ -87,7 +87,7 @@ def build_level_zero(self, repo, commit):
8787
f"-DCMAKE_BUILD_TYPE=Release",
8888
]
8989
run(configure_command)
90-
run(f"cmake --build {self.level_zero_build} -j")
90+
run(f"cmake --build {self.level_zero_build} -j {options.build_jobs}")
9191
run(f"cmake --install {self.level_zero_build}")
9292
return self.level_zero_install
9393

@@ -142,8 +142,8 @@ def build_igc(self, repo, commit):
142142
]
143143
run(configure_command)
144144

145-
# set timeout to 30min. IGC takes A LONG time to build if building from scratch.
146-
run(f"cmake --build {self.igc_build} -j", timeout=600 * 3)
145+
# set timeout to 2h. IGC takes A LONG time to build if building from scratch.
146+
run(f"cmake --build {self.igc_build} -j {options.build_jobs}", timeout=60 * 60 * 2)
147147
# cmake --install doesn't work...
148148
run("make install", cwd=self.igc_build)
149149
return self.igc_install
@@ -214,7 +214,7 @@ def build_compute_runtime(self):
214214
configure_command.append(f"-DIGC_DIR={self.igc}")
215215

216216
run(configure_command)
217-
run(f"cmake --build {self.compute_runtime_build} -j")
217+
run(f"cmake --build {self.compute_runtime_build} -j {options.build_jobs}")
218218
return self.compute_runtime_build
219219

220220

0 commit comments

Comments
 (0)