From fb1d0eee4cfac93ff1bb1c28e0c1ac780bfe4ab0 Mon Sep 17 00:00:00 2001 From: Darryl Abbate Date: Tue, 23 Jun 2026 09:54:57 -0700 Subject: [PATCH] Mark top-level Makefile .NOTPARALLEL to fix make -j build race The IMB-* targets each recurse into src_cpp/ and compile a shared set of intermediate objects (imb.o, benchmark_suites_collection.o, args_parser.o, scope.o, libyaml-cpp.a) to identical paths. Building two or more suites concurrently under 'make -j' lets multiple sub-makes write those same object files simultaneously, clobbering them and intermittently breaking the link, e.g.: benchmark_suites_collection.h: undefined reference to `BenchmarkSuitesCollection::pnames' imb.o: file not recognized: File truncated The suite recipes invoke a plain 'make' (not $(MAKE) and not prefixed with '+'), so they are not recognized as recursive. With GNU Make < 4.4's pipe-based jobserver such sub-makes were cut off from the job pool and ran serially, which masked the race. GNU Make >= 4.4's FIFO jobserver connects non-recursive sub-makes to the parallel pool, so the suite builds now run concurrently and the race surfaces routinely (observed on Ubuntu 26.04 / RHEL 10, which ship make 4.4). Add .NOTPARALLEL so the top-level suite builds are serialized regardless of -j. Parallelism within each suite sub-make is unaffected, and the suites build in seconds, so the wall-clock impact is negligible. Signed-off-by: Darryl Abbate --- Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Makefile b/Makefile index aadc6b272..9ed891ead 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,20 @@ # # *************************************************************************** +# The IMB-* targets each recurse into the same src_cpp/ directory and compile a +# shared set of intermediate objects (imb.o, benchmark_suites_collection.o, +# args_parser.o, scope.o, libyaml-cpp.a) to identical paths. Running these +# recursive builds concurrently (make -j) makes multiple sub-makes write those +# same object files at once, which clobbers them and intermittently breaks the +# link with errors such as "undefined reference to BenchmarkSuitesCollection::pnames" +# or "imb.o: File truncated". The recipes are not jobserver-aware (plain `make`, +# not `$(MAKE)`/`+`), so GNU Make < 4.4 happened to run them effectively serial; +# GNU Make >= 4.4's FIFO jobserver connects them to the parallel pool and exposes +# the race. Mark this Makefile non-parallel so the top-level suite builds are +# serialized regardless of -j. (Compilation within each suite sub-make is +# unaffected.) +.NOTPARALLEL: + all: IMB-MPI1 IMB-NBC IMB-RMA IMB-EXT IMB-IO IMB-MT IMB-P2P IMB-MPI1: