How to set number of parallel jobs in ROS2 building?

Hi,

I notice that ROS2 building set parallel jobs as “-j8 -l8”. I’d like to know if ROS2 provides arguments to increase number of parallel jobs in building.

Thank you.

You can either set the environment variable MAKEFLAGS or you can pass arbitrary arguments to make using ament build --make-flags ....

Just to confirm my understanding, parallel build for each package is supported by the toolchain itself and that is what OP is asking about, but parallel build for more than one package is not yet supported by ament, right?

Correct.

ament build has an option --parallel which also processes packages in parallel. There are known race conditions though (Parallel build waiting for package forever · Issue #145 · ament/ament_tools · GitHub). We still use the feature on ci.ros2.org to speed up the builds. There is no configuration option to specify a limit for the packages processed in parallel.

1 Like

@dirk-thomas Thanks for the confirmation. Didn’t know that ament parallel actually work. How frequently does this issue repro?
I think you have an extra 0 in the issue number, the issue is #145 https://github.com/ament/ament_tools/issues/145

Hard to quantify. I would say less than 5%. Otherwise we would run into it more frequently on the the buildfarm.

Thanks for pointing it out, the 0 was supposed to be a ) :wink:

Hi @dirk-thomas, it works. Thanks a lot!