MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Pages: 1

f205v
Dumper
Reged: 09/21/03
Posts: 193
Loc: Switzerland
Send PM


MAKE - the -j option
#350653 - 02/24/16 11:16 PM


Dear all,
can someone please be so kind and give me a layman explanation of the -j option in MAKE command?
I do understand that it's something related to my CPU, but would like to understand what the number after the -j means, and what would be the best for me.

Thanks in advance for your help.



Ciao
f205v



TafoidAdministrator
I keep on testing.. testing.. testing... into the future!
Reged: 04/19/06
Posts: 3135
Loc: USA
Send PM


Re: MAKE - the -j option new [Re: f205v]
#350660 - 02/25/16 01:36 AM


> Dear all,
> can someone please be so kind and give me a layman explanation of the -j option in
> MAKE command?
> I do understand that it's something related to my CPU, but would like to understand
> what the number after the -j means, and what would be the best for me.
>
> Thanks in advance for your help.

-j [num], --jobs[=num] Allow num jobs at once; infinite jobs with no argument.

The general accepted amount to put in there is number of CPU cores +1 for anything 2 cores or more.
Dual core cpu? -j3
Quad core cpu? -j5
Dual-Quad core? -j9

Also, if you have large amounts of RAM you sometimes can add 1 or more to the value. In the end, it allows for faster compiling by using all CPU cores to accomplish the tasks. Just be wary of slower HD's or other media - you may not be able to be successful with those settings mentioned. Other utilities, too, might interfere (real time virus scanning, GIT caching (depending on client) or anything else that might fight for control over new files being created.



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9711
Loc: ECV-197 The Orville
Send PM


Re: MAKE - the -j option new [Re: Tafoid]
#350684 - 02/25/16 05:30 PM


Tafoid's generally right, with the caveat that you should have 1 GB of RAM per CPU core for that formula to work out well compiling MAME. So for instance, on the Raspberry Pi 2 which has 4 CPU cores but 1 GB RAM total you obviously wouldn't want to run -j5 (and I've personally confirmed that that's a *really* bad idea).



Dullaron
Diablo III - Dunard #1884
Reged: 07/22/05
Posts: 6118
Loc: Fort Worth, Tx
Send PM


Re: MAKE - the -j option new [Re: Tafoid]
#350702 - 02/26/16 04:17 AM Attachment: core-i5.png 8 KB (0 downloads)


> The general accepted amount to put in there is number of CPU cores +1 for anything 2
> cores or more.
> Dual core cpu? -j3
> Quad core cpu? -j5
> Dual-Quad core? -j9

Core i5 -j6

[ATTACHED IMAGE]

Attachment



W11 Home 64-bit + Nobara OS / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 64 GB



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2257
Send PM


Re: MAKE - the -j option new [Re: Dullaron]
#350724 - 02/26/16 03:38 PM


> > The general accepted amount to put in there is number of CPU cores +1 for anything
> 2
> > cores or more.
> > Dual core cpu? -j3
> > Quad core cpu? -j5
> > Dual-Quad core? -j9
>
> Core i5 -j6

Wrong.

Core i3 has 2 cores. -j3
Core i5 has either 2 cores or 4 cores depending on the model. -j3 or -j5
Core i7 has from 4 cores to 8 cores depending on the model.. -j9 to -j17



Olivier Galibert
Semi-Lurker
Reged: 09/21/03
Posts: 398
Send PM


Re: MAKE - the -j option new [Re: MooglyGuy]
#350737 - 02/26/16 09:50 PM


> Core i7 has from 4 cores to 8 cores depending on the model.. -j9 to -j17

Not convinced my system would like -j17 that much...

Also, if you have enough memory to have everything in cache, -j8 is better, it avoids conflicts between threads.

OG.



krick
Get Fuzzy
Reged: 02/09/04
Posts: 4235
Send PM


Re: MAKE - the -j option new [Re: Olivier Galibert]
#350752 - 02/27/16 04:16 AM


Does it matter if your CPU has "fake" cores via hyperthreading?



GroovyMAME support forum on BYOAC



Robbbert
Sir
Reged: 08/21/04
Posts: 3180
Loc: A long way from you
Send PM


Re: MAKE - the -j option new [Re: krick]
#350756 - 02/27/16 04:39 AM


-



f205v
Dumper
Reged: 09/21/03
Posts: 193
Loc: Switzerland
Send PM


Re: MAKE - the -j option new [Re: R. Belmont]
#350767 - 02/27/16 12:33 PM


Thanks to everyone for the kind answers.
After a few trials I think I will stick to -j5, because I have an i5 with 4 cores and 16GB of RAM.



Ciao
f205v



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2257
Send PM


Re: MAKE - the -j option new [Re: Robbbert]
#350772 - 02/27/16 02:53 PM


> > Does it matter if your CPU has "fake" cores via hyperthreading?
>
> I have a i7-2600 which I believe is 4 cores but shows as 8 in Task Manager. And, I
> can confirm that -j8 is much faster than -j4.

Correct. With enough CPU cores, you quickly end up with a bottleneck on disk I/O when compiling. This is sort of the perfect situation for hyperthreading, because while a given thread is blocked while waiting to either read from or write to the disk, another thread can be swapped in.



redk9258
Regular
Reged: 09/21/03
Posts: 3968
Loc: Troy, Illinois USA
Send PM


Re: MAKE - the -j option new [Re: MooglyGuy]
#350787 - 02/27/16 07:58 PM


I'm guessing an SSD would speed things up too.



Robbbert
Sir
Reged: 08/21/04
Posts: 3180
Loc: A long way from you
Send PM


Re: MAKE - the -j option new [Re: redk9258]
#350796 - 02/27/16 10:11 PM


-



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2257
Send PM


Re: MAKE - the -j option new [Re: redk9258]
#350818 - 02/28/16 08:57 AM


> I'm guessing an SSD would speed things up too.

In all seriousness, it depends. If you're running a reasonably new i7 and you throw all cores plus hyperthreads at it, then an SSD will help. However, even older models i7 will be bottlenecked on the CPU, and an SSD will have next to no speed increase.

I know this because I had a late 2010-model Dell tower with a 3.2GHz i7 in it, and after throwing a 250GB SSD into it, compiling MAME was not faster in the slightest. However, on my new machine that has 6 cores and is a more modern revision of i7, it's a hell of a lot faster on the SSD than if I compile off my spinning disk.



krick
Get Fuzzy
Reged: 02/09/04
Posts: 4235
Send PM


Re: MAKE - the -j option new [Re: MooglyGuy]
#350825 - 02/28/16 11:58 AM


If you have a LOT of ram, compiling on a RAM disk might speed things up by reducing disk I/O, but you'd have some overhead from initially copying the source tree to the RAM disk before building.



GroovyMAME support forum on BYOAC



MooglyGuy
Renegade MAME Dev
Reged: 09/01/05
Posts: 2257
Send PM


Re: MAKE - the -j option new [Re: krick]
#350831 - 02/28/16 03:35 PM


> If you have a LOT of ram, compiling on a RAM disk might speed things up by reducing
> disk I/O, but you'd have some overhead from initially copying the source tree to the
> RAM disk before building.

Well, with needing roughly a gigabyte per compile thread, you'll end up needing even more RAM than for just the scratch disk. Plus, using a RAM disk would lower the amount of memory bandwidth available for use by the compile threads, so it could end up being a wash or even slower.



Roberto Fresca
Cuernito Rules!...
Reged: 08/12/04
Posts: 285
Send PM


Re: MAKE - the -j option new [Re: Robbbert]
#351371 - 03/09/16 05:48 PM


> > Does it matter if your CPU has "fake" cores via hyperthreading?
>
> I have a i7-2600 which I believe is 4 cores but shows as 8 in Task Manager. And, I
> can confirm that -j8 is much faster than -j4.

With -j4 you're using 3 of the 4 cores...

Robbie.



-- Risen from my grave --



Roberto Fresca
Cuernito Rules!...
Reged: 08/12/04
Posts: 285
Send PM


Re: MAKE - the -j option new [Re: MooglyGuy]
#351372 - 03/09/16 05:51 PM


> > > The general accepted amount to put in there is number of CPU cores +1 for
> anything
> > 2
> > > cores or more.
> > > Dual core cpu? -j3
> > > Quad core cpu? -j5
> > > Dual-Quad core? -j9
> >
> > Core i5 -j6
>
> Wrong.
>
> Core i3 has 2 cores. -j3
> Core i5 has either 2 cores or 4 cores depending on the model. -j3 or -j5
> Core i7 has from 4 cores to 8 cores depending on the model.. -j9 to -j17

Core i7 from 2 cores to...
Some laptops have this cheap processor...

Robbie.



-- Risen from my grave --



Dullaron
Diablo III - Dunard #1884
Reged: 07/22/05
Posts: 6118
Loc: Fort Worth, Tx
Send PM


Re: MAKE - the -j option new [Re: MooglyGuy]
#351423 - 03/10/16 10:15 AM


> Core i5 has either 2 cores or 4 cores depending on the model. -j3 or -j5

Oh ok. I change it to -j5. Who ever it was at the bannister had been wrong then.



W11 Home 64-bit + Nobara OS / AMD Radeon RX 5700 XT / AMD Ryzen 7 3700X 8-Core 3.59 GHz / RAM 64 GB



R. Belmont
Cuckoo for IGAvania
Reged: 09/21/03
Posts: 9711
Loc: ECV-197 The Orville
Send PM


Re: MAKE - the -j option new [Re: Robbbert]
#351608 - 03/15/16 04:50 PM


> > Does it matter if your CPU has "fake" cores via hyperthreading?
>
> I have a i7-2600 which I believe is 4 cores but shows as 8 in Task Manager. And, I
> can confirm that -j8 is much faster than -j4.

With a 2600 and multithreading enabled -j9 is the right way to go, assuming you have at least 8 GB of RAM.

Edited by R. Belmont (03/15/16 04:51 PM)



Dullaron
Diablo III - Dunard #1884
Reged: 07/22/05
Posts: 6118
Loc: Fort Worth, Tx
Send PM


I gonna bookmark this. Very useful to me. new [Re: f205v]
#351611 - 03/15/16 07:40 PM


When I get a new computer in the future then I will came here to check the list.


Pages: 1

MAMEWorld >> Programming
View all threads Index   Threaded Mode Threaded  

Extra information Permissions
Moderator:  Pi 
0 registered and 3 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 3446