Skip to content

Commit 3275a8f

Browse files
committed
GitHub CI pipeline: Reducing parallelism (in some specific envs, namely gcc x debug-oriented) when building our code (not in the generated code); some new multi-SHM-provider tests, combined with existing such tests, can lead to out-of-memory in the build step.
1 parent 19b7bdb commit 3275a8f

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,22 +239,31 @@ jobs:
239239
c-path: /usr/bin/gcc-9
240240
cpp-path: /usr/bin/g++-9
241241
install: True
242+
# Very-RAM-hungry when generating debug info (see also high-mem-build in build-test-cfg axis; as of this
243+
# writing if both are true then some step(s) may tweak some knobs to reduce RAM use).
244+
high-mem-build: True
242245
- id: gcc-10
243246
name: gcc
244247
version: 10
245248
c-path: /usr/bin/gcc-10
246249
cpp-path: /usr/bin/g++-10
250+
# See comment on first occurrence.
251+
high-mem-build: True
247252
- id: gcc-11
248253
name: gcc
249254
version: 11
250255
c-path: /usr/bin/gcc-11
251256
cpp-path: /usr/bin/g++-11
257+
# See comment on first occurrence.
258+
high-mem-build: True
252259
- id: gcc-13
253260
name: gcc
254261
version: 13
255262
c-path: /usr/bin/gcc-13
256263
cpp-path: /usr/bin/g++-13
257264
install: True
265+
# See comment on first occurrence.
266+
high-mem-build: True
258267
- id: clang-13
259268
name: clang
260269
version: 13
@@ -281,6 +290,11 @@ jobs:
281290
- id: debug
282291
conan-profile-build-type: Debug
283292
conan-profile-jemalloc-build-type: Debug
293+
# Debug-info generation makes compiles much more RAM-hungry; see the profile-creation step, which
294+
# *may* (depending on possibly other cfg such as compiler) react to this flag by, say, reducing build
295+
# parallelism. Other consumers may arise over time. This is a hint to the consumer steps which
296+
# are responsible for the ultimate behavior.
297+
high-mem-build: True
284298
# In any case Debug, at the CMake script (in meta-project ./, and in flow/, ipc_*/) level,
285299
# means LTO will be ignored (only *Rel* build-types enable LTO, if so instructed).
286300
# Still keeping this here to make that clear to the reader/maintainer. Could remove it though.
@@ -292,6 +306,8 @@ jobs:
292306
- id: relwithdebinfo
293307
conan-profile-build-type: RelWithDebInfo
294308
conan-profile-jemalloc-build-type: Release
309+
# See comment on first occurrence.
310+
high-mem-build: True
295311
# As of this writing RelWithDebInfo (in CMake, and Conan in our case at least doesn't override it)
296312
# defaults to -O2 (not -O3), which isn't a super-effective way of deploying LTO. Plus
297313
# we can use a test of non-LTO building.
@@ -761,6 +777,24 @@ jobs:
761777
if [ '${{ matrix.build-test-cfg.build-type-cflags-override }}' != '' ]; then
762778
echo 'ipc:build_type_cflags_override = ${{ matrix.build-test-cfg.build-type-cflags-override }}' >> conan_profile
763779
fi
780+
# high-mem-build config x high-mem-build compiler: several jumbo test
781+
# translation units (.cpp files) compiling in parallel, at the default
782+
# parallelism (= logical cores), can exceed runner RAM; observed as sporadic whole-VM-OOM
783+
# (runner-shutdown) job kills. So use physical cores instead: measured (via `free` sampling) to leave
784+
# ample headroom while costing only the SMT throughput bonus (perhaps 15-25% of the compile phase).
785+
# TODO: Splitting up heavy test `.cpp`s into less memory-hungry chunks, such as by instantiating certain
786+
# key template groups (<=> ipc::session::Session compile-time config, possibly others) in separate
787+
# `.cpp`s, would benefit other environments, including user environments, and be less reliant on fairly
788+
# dynamic hardware conditions from GitHub/whomever. Revisit that; ideally get rid of this as a result.
789+
# XXXrevisit soon, if there's time; or delete this line and leave TODO; whatever seems best at the end.
790+
if [ '${{ matrix.compiler.high-mem-build }}' != '' ] \
791+
&& [ '${{ matrix.compiler.high-mem-build }}' != 'false' ] \
792+
&& [ '${{ matrix.build-test-cfg.high-mem-build }}' != '' ] \
793+
&& [ '${{ matrix.build-test-cfg.high-mem-build }}' != 'false' ]; then
794+
echo "Reducing build parallelism to N-physical-cores [$N_PHYS_CORES]."
795+
N_PHYS_CORES=$(lscpu -p=Core,Socket | grep -v '^#' | sort -u | wc -l)
796+
echo "tools.build:jobs = $N_PHYS_CORES" >> conan_profile
797+
fi
764798
765799
# We need to prepare a sanitizer ignore-list in MSAN mode. Background for this is subtle and annoying:
766800
# As it stands, whatever matrix compiler/build-type is chosen applies not just to our code (correct)

0 commit comments

Comments
 (0)