Skip to content

Commit

Permalink
limit parallel for circleci
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Dec 11, 2024
1 parent 91799b0 commit aa1bab7
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tools/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,13 @@ def cmake_board(board, toolchain, build_flags_on):
f'-DTOOLCHAIN={toolchain} {build_flags}')
if rcmd.returncode == 0:
cmd = f"cmake --build {build_dir}"
# Due to IAR capability, limit parallel build to 4 (medium+) or 6 (large) docker
if toolchain == 'iar' and os.getenv('CIRCLECI'):
if 'large' in os.getenv('CIRCLE_JOB'):
cmd += ' --parallel 6'
else:
cmd += ' --parallel 4'
# circleci docker return $nproc as 36 core, limit parallel according to resource class. Required for IAR, also prevent crashed/killed by docker
if os.getenv('CIRCLECI'):
resource_class = { 'small': 1, 'medium': 2, 'medium+': 3, 'large': 4 }
for rc in resource_class:
if rc in os.getenv('CIRCLE_JOB'):
cmd += f' --parallel {resource_class[rc]}'
break
rcmd = run_cmd(cmd)
ret[0 if rcmd.returncode == 0 else 1] += 1

Expand Down

0 comments on commit aa1bab7

Please sign in to comment.