openDsh / dash

Join us on Slack! https://join.slack.com/t/opendsh/shared_invite/zt-la398uly-a6eMH5ttEQhbtE6asVKx4Q
GNU General Public License v3.0
256 stars 80 forks source link

detect CPU cores count and utilize while building project #88

Open egisz opened 3 years ago

egisz commented 3 years ago

Description:

Improve build speed. Detect core count and set accordingly cmake and make command line params.

Checklist:

icecube45 commented 3 years ago

Might not be a great idea on pi systems with lower memory (especially with memory split applied), where they lack the memory to properly support the multicore compilation

egisz commented 3 years ago

I agree, but still it could be beneficial for ones who have more RAM. It's possible to detect RAM size and limit cores to 2 in case it's < 4GB.

$free -g | grep "Mem:" | awk '{print $2}'

returns RAM size in GB.

What do you think?

icecube45 commented 3 years ago

Detection of RAM is a good idea, but I'd adjust the parameters. Personally on my Pi (1GB), I compile with one thread, otherwise there's a chance it freezes up due to memory constraints. Others can chime in here, but I'd adjust the parameters to 1 thread if <1GB

stefan-sherwood commented 3 years ago

I would try compiling it with different threading options and measure the high water mark for memory consumption and adjust the script accordingly.

Now that my change to not require an extreme memory split has been merged, we can probably change the default for everyone.

memtech3 commented 3 years ago

What about making it an interactive option in the install script that defaults to no after 5 seconds with a note not to use it on INSERT SPECS THAT DON'T WORK HERE? Or maybe have it as part of a separate install script?

akhil11naseem commented 1 year ago

This would be useful when cross-compiling for the Pi on a different host (I cross-compile on WSL2 on Windows).