Problem in the Makefile

16 views
Skip to first unread message

Philippe-A. Bourdin

unread,
Sep 8, 2026, 2:19:34 PM (3 days ago) Sep 8
to pencil-code-discuss
Dear all,

we have a serious problem in our Makefile or alternatively in the dependencies that are listed in Makefile.depend. To reproduce the problem, use the "samples/corona" directory and use "pc_build" without any specific configuration options. You will notice that this sample will compile fine on the first try. On the second try to recompile (without any changes!) everything is fine again. On the third try to recompile (again no changes to the code!) it will always recompile, then not, then again, etc. etc.

As a matter of fact, all samples are affected from (more or less) random recompilation, even though it is not necessary. This consumes a lot of power and credits on our auto-test servers and on the Travis infrastructure. Therefore, this must be fixed.

As Matthias found out, the issue only happens for parallel compilation (multiple CPU cores working), so this is likely a race condition, where obviously some source file (or dependent include files, ob which we have many) is being changed, while something else is compiled. Due to the inter-dependencies, this could explain the observed behavior (=> every second try recompilation compiles everything even without any code change).

I have experienced "strange behavior" already in the beginning of this year, some time between end of November and beginning of April. Still, the problematic change could have also happened earlier or later than this date.

I would kindly ask the responsible persons to look into their changes to the Makefiles, the dependencies, or any other component involved to trigger a recompilation (build scripts). According to Matthias, people involved were: Matthias, Touko, Axel, Kishore, and Isak. Regarding myself, I am sure that my changes have not triggered this problem. Probably, everyone involved should meet online on the next Pencil Code office hours, Wednesday 16th of September,  to organize the debugging procedure - or alternatively communicate via the mailing list.

Thank you and best greetings,
Philippe.

Matthias Rheinhardt

unread,
Sep 8, 2026, 4:08:16 PM (3 days ago) Sep 8
to pencil-co...@googlegroups.com

Hi,


the phenomenon of alternating unnecessary recompilation has disappeared on Roihu, at least for sample corona, after the last update of Makefile.depend. Repeated pc_build without source changes behaves as expected:


 pc_build FFLAGS+=-I/appl/soft/spack/core/v2026_03/x86_64/gcc152_ec/install_dir/zen5/gcc-15.2.0/hdf5-1.14.6-2d66cw/include

Found config file </users/mreinhar/git/pencil-code/config/compilers/GNU-GCC_MPI.conf>

Running make '-j' 'FFLAGS_DOUBLE=-fdefault-real-8 -fdefault-double-8' 'CFLAGS_DOUBLE=-DDOUBLE_PRECISION' 'LD_MPI=' 'CFLAGS_FFTW3=' 'FFLAGS_FFTW3=' 'LD_FFTW3=' 'CFLAGS_FFTW2=' 'FFLAGS_FFTW2=' 'LD_FFTW2=' 'FC=mpif90' 'F77=mpif77' 'FFLAGS=-O' 'LDFLAGS_HELPER=-dynamic' 'FFLAG_HEAP_ALLOC=-fmax-stack-var-size=512000 -fno-stack-arrays' 'OMPFFLAGS=-fopenmp' 'OMPLFLAGS=-lgomp' 'PPFLAGS=-cpp' 'FSTD_95=-std=f95' 'FSTD_2003=-std=f2003' 'FSTD_2008=-std=f2008' 'FSTD_2018=-std=f2018' 'MODULE_PREFIX=__' 'MODULE_INFIX=_MOD_' 'MODULE_SUFFIX=' 'CC=mpicc' 'CSTD=-std=c99' 'CFLAGS=-DFUNDERSC=1' 'FFLAGS+=-I/appl/soft/spack/core/v2026_03/x86_64/gcc152_ec/install_dir/zen5/gcc-15.2.0/hdf5-1.14.6-2d66cw/include' 'default_to_be'

MAKING src/Makefile.inc

=====  make FROM_PARENT=src/ -f Makefile.src code =====

make[1]: Entering directory '/users/mreinhar/git/pencil-code/samples/corona/src'

HDF5_PATH not set

Compiler: gfortran

GCC version: 15.2.0

Makefile.src:3023: GCC version > 9 ==> allowing argument mismatch in mpicomm.f90, noparticles_mpicomm.f90, syscalls.f90 and fftpack.f90.

HDF5 compiler and linker in /appl/soft/spack/core/v2026_03/x86_64/gcc152_ec/install_dir/zen5/gcc-15.2.0/hdf5-1.14.6-2d66cw/bin/h5pfc.

make[2]: Entering directory '/users/mreinhar/git/pencil-code/samples/corona/src'

HDF5_PATH not set

Compiler: gfortran

GCC version: 15.2.0

Makefile:3028: GCC version > 9 ==> allowing argument mismatch in mpicomm.f90, noparticles_mpicomm.f90, syscalls.f90 and fftpack.f90.

make[2]: Leaving directory '/users/mreinhar/git/pencil-code/samples/corona/src'

make -f Makefile.src  start.o run.o start.x run.x

make[2]: Entering directory '/users/mreinhar/git/pencil-code/samples/corona/src'

HDF5_PATH not set

Compiler: gfortran

GCC version: 15.2.0

Makefile.src:3023: GCC version > 9 ==> allowing argument mismatch in mpicomm.f90, noparticles_mpicomm.f90, syscalls.f90 and fftpack.f90.

make[2]: 'start.o' is up to date.

make[2]: 'run.o' is up to date.

make[2]: 'run.x' is up to date.

make[2]: Leaving directory '/users/mreinhar/git/pencil-code/samples/corona/src'

make[1]: Leaving directory '/users/mreinhar/git/pencil-code/samples/corona/src'


Norlx51 yet to be tested.

Best, 
Matthias

Von: 'Philippe-A. Bourdin' via pencil-code-discuss <pencil-co...@googlegroups.com>
Gesendet: Dienstag, 8. September 2026 20:19:34
An: pencil-code-discuss
Betreff: Problem in the Makefile
 
--
You received this message because you are subscribed to the Google Groups "pencil-code-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pencil-code-dis...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pencil-code-discuss/36ff55e9-6cae-4dd0-92a1-a7193a501cc7n%40googlegroups.com.

Matthias Rheinhardt

unread,
Sep 8, 2026, 4:15:18 PM (3 days ago) Sep 8
to pencil-co...@googlegroups.com

Same on norlx51: no unnecessary recompilation.


M.


Von: 'Philippe-A. Bourdin' via pencil-code-discuss <pencil-co...@googlegroups.com>
Gesendet: Dienstag, 8. September 2026 20:19:34
An: pencil-code-discuss
Betreff: Problem in the Makefile
 

Philippe-A. Bourdin

unread,
Sep 8, 2026, 5:13:44 PM (3 days ago) Sep 8
to pencil-code-discuss
Dear Matthias,

thanks for looking into it.
What was the change and what actually caused the problem?

Best greetings,
Philippe

Matthias Rheinhardt

unread,
Sep 9, 2026, 6:12:04 AM (2 days ago) Sep 9
to pencil-co...@googlegroups.com

Hi,


last change in Makefile.depend was adding the dependencies of hydro and density on kt_transport. No explanation why this was able to suppress the unwanted recompilation.


Best,

Matthias


Von: 'Philippe-A. Bourdin' via pencil-code-discuss <pencil-co...@googlegroups.com>
Gesendet: Dienstag, 8. September 2026 23:13:44
An: pencil-code-discuss
Betreff: Re: Problem in the Makefile
 
Reply all
Reply to author
Forward
0 new messages