Page 2 of 4
Re: Compiling duration
Posted: Wed Feb 13, 2013 12:44 pm
by Tectu
Do you only have three physical CPU cores?
The -j option flag dosen't tell make how many cores it shall use, it tells how many jobs shall be created. For the best performance it's recommended to use cpu cores + 1. Therefore -j5 for a four core machine. You can get this out of the documentation.
The other thing to consider is that when using a dual core which has two threads per core it might be better to just create three make jobs instead of five. But this is OS dependend.
~ Tectu
Re: Compiling duration
Posted: Wed Feb 13, 2013 1:15 pm
by goeck
I have two cores with two hyperthreads .. as Intel calls it, right?
I actually just copied the settings that came up, when telling Eclipse to use 4 processors under "Preferences"->"C\C++"->"Build": Behaviour : Build Settings: Enable Parallel Build
As far as I was concerned the j Flag tells make to use more than one job. Here is the man page,
http://linux.die.net/man/1/make which doesn't show the facts you mentioned. To me it seems, that 4 jobs can be distributet onto four cores, which runs smoothly then.
Anyway, I will adapt the settings, as not everybody own exactly 4 cores, right. Thanks for the hint.
Cheers
Re: Compiling duration
Posted: Wed Feb 13, 2013 10:32 pm
by gmb42
FYI timings on an i7, I primed the caches with a 'make' before these tests:
$ time make
make: Nothing to be done for `all'.
real 3m23.188s
user 0m45.067s
sys 2m36.545s
$ time make -r
make: Nothing to be done for `all'.
real 0m0.821s
user 0m0.310s
sys 0m0.420s
$ time make -j
make: Nothing to be done for `all'.
real 3m17.816s
user 0m45.380s
sys 2m30.664s
$ time make -j 5
make: Nothing to be done for `all'.
real 2m54.113s
user 0m39.858s
sys 2m12.240s
Re: Compiling duration
Posted: Thu Feb 14, 2013 9:09 am
by Prof. Dr. YoMan
You should add -r to all makes using windows. I am building any example projects in ~5sec with a i5-2500 on ssd with make -j -r.
ARMCM3-STM32F107 with some additions (five c files and headers).
...
Build Finished (took 5s.197ms)
The key is the -r and i dont see any drawbacks because of it.
Re: Compiling duration
Posted: Thu Feb 14, 2013 9:34 am
by Giovanni
What -r exactly does? should I add that to default projects?
Giovanni
Re: Compiling duration
Posted: Thu Feb 14, 2013 10:08 am
by Tectu
@Giovanni, you can read what -r does
here.
Code: Select all
-r, --no-builtin-rules
Eliminate use of the built-in implicit rules. Also clear out the
default list of suffixes for suffix rules.
I wouldn't recommend adding that to the default makefile.
@goeck: I must search the article about why amount of threads + 1 is the optimum for the -j flag. There is a reason. It has something to do with the scheduling.
~ Tectu
Re: Compiling duration
Posted: Thu Feb 14, 2013 10:12 am
by Prof. Dr. YoMan
I guess it is a bug in make on windows with -r. Its way to much difference with the flag set or not.
Re: Compiling duration
Posted: Thu Feb 14, 2013 11:12 am
by Tectu
I'm on a linux system. I did take the demos/ARMCM4-STM32F407-LWIP-USB-FATFS demo:
Code: Select all
[tectu@TecTop ARMCM4-STM32F407-LWIP-FATFS-USB]$ time make -j5
real 0m5.916s
user 0m19.247s
sys 0m1.510s
Code: Select all
[tectu@TecTop ARMCM4-STM32F407-LWIP-FATFS-USB]$ time make -j5 -r
real 0m5.906s
user 0m18.917s
sys 0m1.667s
~ Tectu
Re: Compiling duration
Posted: Thu Feb 14, 2013 12:08 pm
by Prof. Dr. YoMan
Windows:
ARMCM3-STM32F107 with some additions (five c files and headers).
make -r -j4
Build Finished (took 5s.197ms)
make -j4
Build Finished (took 28s.785ms)
Most of the time is spend directly after the call of make. When the compiling finally starts, it is as fast as with -r.
Re: Compiling duration
Posted: Thu Feb 14, 2013 1:18 pm
by Tectu
How comes that you have such a big difference then?
~ Tectu