These are chat archives for symengine/symengine

27th
Jun 2016
Srajan Garg
@srajangarg
Jun 27 2016 09:44
Should we add in #pragma once to our headers.
http://stackoverflow.com/questions/373142/what-techniques-can-be-used-to-speed-up-c-compilation-times (1st answer, under guard conditions)
But I found some others which say it doesn't really make a difference (http://gamesfromwithin.com/physical-structure-and-c-part-2-build-times)
Srajan Garg
@srajangarg
Jun 27 2016 09:53
Also can somebody read "Single Compilation Unit" here (it's the last topic). Thoughts?
I think Piranha does this too?
Francesco Biscani
@bluescarni
Jun 27 2016 09:56
piranha is all headers, so you are actually (re)compiling everything each time. it's different from the single compilation unit technique, but similar in the end
you might be interested in this https://github.com/sakra/cotire if you are trying to reduce build times
I think it might help for a project like symengine
Srajan Garg
@srajangarg
Jun 27 2016 09:59
Hmm looks interesting, has all of what I was reading about
It won't help with Piranha? Have you tried it out?
Francesco Biscani
@bluescarni
Jun 27 2016 09:59
you should get an idea if it works fairly quickly, as it does not require many modifications
I tried it and it did not help, but again, Piranha is all headers and heavily templated and I am not sure those techniques apply much in such a case
Srajan Garg
@srajangarg
Jun 27 2016 11:27

I tried the unified approach here. Also numer_denom.cpp and parser.cpp were removed from both before testing (were causing some problems in the unified case). The builds were run after git clean -dfx with cmake -DBUILD_BENCHMARKS=no -DBUILD_TESTS=no.

time make (unified)
Scanning dependencies of target symengine
[ 33%] Building CXX object symengine/CMakeFiles/symengine.dir/symengine_rcp.cpp.o
[ 66%] Building CXX object symengine/CMakeFiles/symengine.dir/unified.cpp.o
[100%] Linking CXX static library libsymengine.a
[100%] Built target symengine

real    0m19.944s
user    0m19.800s
RAM usage : peaks at 7.8% with an average of about 7.7% (of 8GB)

time make (master)
Scanning dependencies of target symengine
[  2%] Building CXX object symengine/CMakeFiles/symengine.dir/symengine_rcp.cpp.o
[  5%] Building CXX object symengine/CMakeFiles/symengine.dir/basic.cpp.o
...
[100%] Linking CXX static library libsymengine.a
[100%] Built target symengine

real    0m53.168s
user    0m50.428s
RAM usage : peaks at 4.4% with an average of about 3.5% (of 8GB)

The difference is pretty significant. A good 60% decrease.

Francesco Biscani
@bluescarni
Jun 27 2016 11:28
how about memory usage?
Srajan Garg
@srajangarg
Jun 27 2016 11:28
How can I monitor that? (what do you mean)
Francesco Biscani
@bluescarni
Jun 27 2016 11:29
quick and dirty way, just fire up top in another terminal :)
Srajan Garg
@srajangarg
Jun 27 2016 11:35
Updated
Francesco Biscani
@bluescarni
Jun 27 2016 11:36
looks pretty good, I would've expected higher usage
but still, this unified approach means that while developing you need to recompile everything each time you change anything right?
Srajan Garg
@srajangarg
Jun 27 2016 11:41
Yes, but I feel it's worth it. Atleast for me, half the time I'm working with headers which anyways leads to recompile the whole thing.
Srajan Garg
@srajangarg
Jun 27 2016 16:27
@isuruf @certik do you think that this is a viable change, that we can actually use?
Isuru Fernando
@isuruf
Jun 27 2016 16:28
Is this faster than a parallel build? make -j4?
Srajan Garg
@srajangarg
Jun 27 2016 16:45
time make (master)
real    1m2.542s

time make -j2 (master)
real    0m35.912s

time make (experimental)
real    0m24.014s
On my machine. My CPU has 2 cores (http://stackoverflow.com/a/2500791), I feel make -j4 on a 4 core CPU will do better than the unified approach.
Isuru Fernando
@isuruf
Jun 27 2016 16:46
What does make -j4 give you?
Srajan Garg
@srajangarg
Jun 27 2016 16:47
time make -j4 (master)
real    0m33.422s