Skip to content

Commit bca13e9

Browse files
q10facebook-github-bot
authored andcommitted
Add option to set build parallelism in OSS workflows (#3859)
Summary: X-link: facebookresearch/FBGEMM#948 - Add option to set build parallelism in OSS workflows Reviewed By: jwfromm Differential Revision: D71571679
1 parent 1020d4a commit bca13e9

File tree

2 files changed

+17
-10
lines changed

2 files changed

+17
-10
lines changed

.github/scripts/fbgemm_gpu_build.bash

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -403,16 +403,23 @@ __build_fbgemm_gpu_set_python_plat_name () {
403403
}
404404

405405
__build_fbgemm_gpu_set_run_multicore () {
406-
# shellcheck disable=SC2155
407-
local core=$(lscpu | grep "Core(s)" | awk '{print $NF}') && echo "core = ${core}" || echo "core not found"
408-
# shellcheck disable=SC2155
409-
local sockets=$(lscpu | grep "Socket(s)" | awk '{print $NF}') && echo "sockets = ${sockets}" || echo "sockets not found"
410-
local re='^[0-9]+$'
406+
if [[ -v BUILD_PARALLELISM ]]; then
407+
# Set manual override if provided. This is useful for preventing
408+
# overlapping compilation error messages when debugging.
409+
export run_multicore="-j ${BUILD_PARALLELISM}"
411410

412-
export run_multicore=""
413-
if [[ $core =~ $re && $sockets =~ $re ]] ; then
414-
local n_core=$((core * sockets))
415-
export run_multicore="-j ${n_core}"
411+
else
412+
# shellcheck disable=SC2155
413+
local core=$(lscpu | grep "Core(s)" | awk '{print $NF}') && echo "core = ${core}" || echo "core not found"
414+
# shellcheck disable=SC2155
415+
local sockets=$(lscpu | grep "Socket(s)" | awk '{print $NF}') && echo "sockets = ${sockets}" || echo "sockets not found"
416+
local re='^[0-9]+$'
417+
418+
export run_multicore=""
419+
if [[ $core =~ $re && $sockets =~ $re ]]; then
420+
local n_core=$((core * sockets))
421+
export run_multicore="-j ${n_core}"
422+
fi
416423
fi
417424

418425
echo "[BUILD] Set multicore run option for setup.py: ${run_multicore}"

.github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
fail-fast: false
5555
matrix:
5656
host-machine: [
57-
{ arch: x86, instance: "ubuntu-latest" },
57+
{ arch: x86, instance: "8-core-ubuntu" },
5858
]
5959
python-version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
6060
cuda-version: [ "11.8.0", "12.4.1", "12.6.3", "12.8.0" ]

0 commit comments

Comments
 (0)