Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reworked Makefiles to allow for parallel builds via make -j #76

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jmc734
Copy link

@jmc734 jmc734 commented Aug 31, 2015

Before, builds couldn't be done with more than one Make job because of race conditions on the library files (i.e. multiple jobs trying to write to the same .a file at the same time). In order to prevent this, the compilation and the archiving phases of the build process were broken into two separate phases. The first, compilation, can be done as concurrently as desired because there are no dependencies. The second phase, archiving, must be done sequentially though because the files related to each library are nicely separated into subdirectories of src/, the Makefiles for those subdirectories (both phases) can be run concurrently to each other.

I did some very crude benchmarking of these changes. I used the Linux time(1) utility and averaged the values for three runs.

Current Build Process (make):
real 5m20.482s
user 0m6.782s
sys 0m9.327s

New Build Process (make -j 4):
real 2m28.016s
user 0m7.1297s
sys 0m11.431s

So in my environment, I am getting more than a 50% speedup from these changes. You'll notice that both the user and sys time went up after the changes though. I would venture to say that this is because of the additional overhead related to my method of splitting up the two build phases. Regardless, the real time improvement is significant.

Additionally, I compared the libraries generated using the old build process and the new build process using the procedure described in this Gist. In addition to the shell commands, a tar.gz file containing the outputs is attached. As you can see, the generated libraries are identical (disregarding ordering of object files within the libraries).

jmc734 added 3 commits August 28, 2015 16:10
This allows Make to utilize parallelism via jobs when building, and for that matter cleaning, the individual "projects"
Allows for parallel execution (via make -j) by separating the compilation from the archiving phase thus preventing race conditions on the .a files

Conflicts:
	src/Makefile
	src/ioDevice/Makefile
@jmc734
Copy link
Author

jmc734 commented Aug 31, 2015

If you don't choose to accept these changes, you should at least consider the changes in my fixed_build branch. There were some targets in src/basic/Makefile that had been moved to the functors directory that were breaking the build.

@doughodson
Copy link
Owner

Thanks for the work on this. I'm getting ready to leave town on travel
and will be back in a week -- I'll try to take a look at as soon as
possible. Again, thanks, looks like a nice performance improvement!

On 08/31/2015 02:04 PM, Jacob McDonald wrote:

If you don't choose to accept these changes, you should at least
consider the changes in my fixed_build
https://github.com/jmc734/OpenEaagles/tree/fixed_build branch. There
were some targets in src/basic/Makefile that had been moved to the
functors directory that were breaking the build.


Reply to this email directly or view it on GitHub
#76 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants