CMake 3.7.2 and parallel builds

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

CMake 3.7.2 and parallel builds

Dave Flogeras
I've recently upgraded to CMake 3.7.2 (and gnu make-4.2.1). Now, when I execute 'make -j5 NightlyBuild', I get the following new (to me) warning:

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

If I downgrade make back to the previous version, 4.1-r1 (the -r1 is Gentoo), the warning goes away again.

If I use CMake-3.6.3 (my previous version) with make-4.2.1, the warning is still there.

Is this a known issue?  Is it something I am doing wrong in my scripts?

Thanks,
Dave

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Paul Smith
On Fri, 2017-01-27 at 15:45 -0400, Dave Flogeras wrote:

> I've recently upgraded to CMake 3.7.2 (and gnu make-4.2.1). Now, when
> I execute 'make -j5 NightlyBuild', I get the following new (to me)
> warning:
>
> "gmake[4]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule."
>
> If I downgrade make back to the previous version, 4.1-r1 (the -r1 is
> Gentoo), the warning goes away again.
>
> If I use CMake-3.6.3 (my previous version) with make-4.2.1, the
> warning is still there.
>
> Is this a known issue?  Is it something I am doing wrong in my
> scripts?

My suspicion is that somehow the recursion is invoking an older version
of make.  In GNU make 4.2 the jobserver interface was stabilized and
published, so that other build tools could take advantage of it (if
desired); for example if your linker is multithreaded it could
participate in the jobserver feature, obtaining jobserver tokens for its
threads so it didn't overwhelm the system during linking.

As part of this the command-line interface between a parent make and its
sub-makes was changed.  This means that if a parent make tries to invoke
a sub-make and they have different versions there may be an
incompatibility.

Normally this is very difficult to do because GNU make sets the MAKE
variable to the version of make which is currently running (as best it
can determine it) and everyone should be invoking submakes using the
$(MAKE) variable.

But, perhaps something in your setup is confounding this normal
behavior.

You can try adding "VERBOSE=1" to your make invocation and look at the
way sub-makes are invoked and see if there's anything odd-looking about
it.

If that's not it, I'm not sure what the problem is but perhaps the
VERBOSE=1 will help diagnose it anyway.
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Dave Flogeras
Hey Paul

On Sat, Jan 28, 2017 at 10:43 AM, Paul Smith <[hidden email]> wrote:
My suspicion is that somehow the recursion is invoking an older version
of make.  In GNU make 4.2 the jobserver interface was stabilized and
published, so that other build tools could take advantage of it (if
desired); for example if your linker is multithreaded it could
participate in the jobserver feature, obtaining jobserver tokens for its
threads so it didn't overwhelm the system during linking.

I scoured this system, and others that run make 4.2.1, and that is the only version of make in my PATH.


You can try adding "VERBOSE=1" to your make invocation and look at the
way sub-makes are invoked and see if there's anything odd-looking about
it.

If that's not it, I'm not sure what the problem is but perhaps the
VERBOSE=1 will help diagnose it anyway.

I tried with "make -j5 VERBOSE=1 NightlyBuild" but didn't see anything indicative on the console, or in the cmake output files that shed any light for me.

What's weirder (and I forgot to mention) is that if I just build the project normally outside of my regression testing script (ie. "make -j5"), I don't get the jobserver warning.


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Nils Gladitz-2
On 29.01.2017 13:29, Dave Flogeras wrote:

I tried with "make -j5 VERBOSE=1 NightlyBuild" but didn't see anything indicative on the console, or in the cmake output files that shed any light for me.

What's weirder (and I forgot to mention) is that if I just build the project normally outside of my regression testing script (ie. "make -j5"), I don't get the jobserver warning.

FWIW I don't think -j does anything when you build the NightlyBuild target given that that make invocation is not the one directly performing the actual build.
The only command being run by the NightlyBuild target would be "ctest -D NightlyBuild" (nothing to parallelize when there is only one command).
CTest would spawn another make process for the build.

Nils

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Dan Liew
In reply to this post by Dave Flogeras
> What's weirder (and I forgot to mention) is that if I just build the project
> normally outside of my regression testing script (ie. "make -j5"), I don't
> get the jobserver warning.

The reason for this error message from make is given at [1].

I've seen something like this before when my build used "Unix
Makefiles" as the generator and the build invoked an external build
system as a `add_custom_command()` that also used makefiles to do its
build.

The problem was that make (in the outer most build system, i.e. the
CMake generated) one was setting the `MAKEFLAGS` environment variable
to do communicate various bits of information to handle recursive
makefiles (see [2]). This works fine until the CMake generated
makefiles invoked the external build system with `MAKEFLAGS` being
set.

My solution was to strip `MAKEFLAGS` out of the environment when
invoking the `make` command externally.

This isn't exactly your problem but it may help you figure out what is
wrong. My guess is that the sub-make isn't being invoked correctly.

[1] https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
[2] https://www.gnu.org/software/make/manual/html_node/Options_002fRecursion.html
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Dave Flogeras
In reply to this post by Nils Gladitz-2
On Sun, Jan 29, 2017 at 9:53 AM, Nils Gladitz <[hidden email]> wrote:
FWIW I don't think -j does anything when you build the NightlyBuild target given that that make invocation is not the one directly performing the actual build.
The only command being run by the NightlyBuild target would be "ctest -D NightlyBuild" (nothing to parallelize when there is only one command).
CTest would spawn another make process for the build.

Nils

Good point, I checked with the older version of make (4.1) and even though it doesn't issue the warning, it is not building my project in parallel.

I guess that brings up the obvious question:  how does one use this target and take advantage of multiple processors?  Basically, I'm calling it within a python loop that permutes various projects and configurations (release/debug/shared/static...) then puts the results on a self-hosted CDash server with make NightlySubmit.

I thought it used to parallelize the builds, but the script is a few years old and I wouldn't bet my life on it.

Dave

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Nils Gladitz-2

On 01/30/2017 02:26 PM, Dave Flogeras wrote:

On Sun, Jan 29, 2017 at 9:53 AM, Nils Gladitz <[hidden email]> wrote:
FWIW I don't think -j does anything when you build the NightlyBuild target given that that make invocation is not the one directly performing the actual build.
The only command being run by the NightlyBuild target would be "ctest -D NightlyBuild" (nothing to parallelize when there is only one command).
CTest would spawn another make process for the build.

Nils

Good point, I checked with the older version of make (4.1) and even though it doesn't issue the warning, it is not building my project in parallel.

I guess that brings up the obvious question:  how does one use this target and take advantage of multiple processors?  Basically, I'm calling it within a python loop that permutes various projects and configurations (release/debug/shared/static...) then puts the results on a self-hosted CDash server with make NightlySubmit.

I don't know how to do this with the generic dashboard targets ... assuming no one else does either you could give CTest script mode a try (ctest -S).
In script mode the ctest_build() command has a FLAGS option which takes build tool specific options like -j.

Nils

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: CMake 3.7.2 and parallel builds

Dave Flogeras
On Mon, Jan 30, 2017 at 9:38 AM, Nils Gladitz <[hidden email]> wrote:

I don't know how to do this with the generic dashboard targets ... assuming no one else does either you could give CTest script mode a try (ctest -S).
In script mode the ctest_build() command has a FLAGS option which takes build tool specific options like -j.

Nils

My lazy way out was to just switch to using the ninja generator for my test farm.  It doesn't solve the real problem (if any), but it gets the results I wanted.  Thanks for all the help anyway guys.

Dave

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...