Makefile multiple processor issue


#1

Hello,
When run

make release -j16

I noticed that make was running slow and saw this message in the output:

gmake[4]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.

I don’t see this warning and make runs much faster (presumably using all 16 processes)
when I just run

make -j16

When I googled this error, the first hit is “Telltale signs that your make file is broken”.
I don’t know anything about make files, but it would be nice to make with multiple processors.

-Magali


#2

When using multiple processors during the build process, you can specify to build in release mode during the cmake configuration by adding -DCMAKE_BUILD_TYPE=Release.

There may be a way to successfully run make release -j16, but I have always just used the above procedure.


#3

Yeah, you can not use make release -j X. What I normally do is that I type make release and wait until things start compiling. Then I ctrl+C and compile with make -j X.


#4

Yes, this is an oddity I don’t know how to fix either the proper way.
What happens is that when you call ‘make release’ or ‘make debug’, it
calls ‘cmake’ internally which calls ‘make’ without argument – i.e., an
implied -j1. So it uses only one processor to compile.

My workaround is to call
make release
wait for a couple of seconds, then hit ‘Ctrl-C’, and then do
make -j16
The first of these switches from whatever mode you had to release mode,
the second of these commands then compiles everything in the then
selected mode (now “release”) with 16 processors.

Same if you want to switch back to debug mode, of course:
make debug
…wait…wait… Ctrl-C
make -j16

Not elegant, but works.

Best
W.


#5

Maybe https://github.com/geodynamics/aspect/pull/2800 is a neat workaround?


#6

Thanks John - I can definitely do this.
-Magali