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
Compiling duration
Moderators: RoccoMarco, lbednarz, utzig, tfAteba, barthess
Re: Compiling duration
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
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
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
$ 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
- Prof. Dr. YoMan
- Posts: 57
- Joined: Thu May 24, 2012 11:00 am
- Been thanked: 1 time
Re: Compiling duration
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.
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.
- Giovanni
- Site Admin
- Posts: 14457
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1076 times
- Been thanked: 922 times
- Contact:
Re: Compiling duration
@Giovanni, you can read what -r does here.
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
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
- Prof. Dr. YoMan
- Posts: 57
- Joined: Thu May 24, 2012 11:00 am
- Been thanked: 1 time
Re: Compiling duration
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
I'm on a linux system. I did take the demos/ARMCM4-STM32F407-LWIP-USB-FATFS demo:
~ Tectu
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
- Prof. Dr. YoMan
- Posts: 57
- Joined: Thu May 24, 2012 11:00 am
- Been thanked: 1 time
Re: Compiling duration
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.
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.
Who is online
Users browsing this forum: No registered users and 59 guests