Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: mattn2 on October 14, 2012, 08:57:06 pm
-
Hi,
we are looking for a way to get the amount of cpus in a codeblocks variable that can be used in the custom makefile parameters
something like:
$make -r -R -j $cpus -f $makefile $target
is something like this available?
thanks a lot
martin
-
I think per project variables (http://wiki.codeblocks.org/index.php?title=Per-project_variables) is what you are looking for.
-
Hi,
we are looking for a way to get the amount of cpus in a codeblocks variable that can be used in the custom makefile parameters
something like:
$make -r -R -j $cpus -f $makefile $target
is something like this available?
thanks a lot
martin
On linux you should be able to use something like (note the backticks):
$make -r -R -j `getconf _NPROCESSORS_ONLN` -f $makefile $target
-
Isn't it a bit odd that a compiler that supports multiple CPUs doesn't have a switch to detect the number of CPUs?
-
it's not the compiler, but make
on windows i could also use the env var %NUMBER_OF_PROCESSORS% - but i'm looking for a portable way to handle this.
-
You could try something like:
$make -r -R -j $if(PLATFORM == PLATFORM_MSW){%NUMBER_OF_PROCESSORS%}{`getconf _NPROCESSORS_ONLN`} -f $makefile $target
the linux part should work, but I'm not sure about the windows part, you might need someting similar to linux' "echo".
-
thanks - but there is also mac - which does this again a little bit different. and c::b must already know the amount of cpus, no?
-
wxWidgets has a static function to determine the umber of cpu's, but I don't know how good it works.
But it could surely be used to add a cpu_count macro, that can be used wherever macro-/variable-expansion is done.
-
wxWidgets has a static function to determine the umber of cpu's, but I don't know how good it works.
But it could surely be used to add a cpu_count macro, that can be used wherever macro-/variable-expansion is done.
We have also a setting for the number of cpus used for building, this could be provided here.
-
wxWidgets has a static function to determine the umber of cpu's, but I don't know how good it works.
But it could surely be used to add a cpu_count macro, that can be used wherever macro-/variable-expansion is done.
We have also a setting for the number of cpus used for building, this could be provided here.
Both could be provided:
the number of CPU's determined by wxw and the number of parallel processes for building set by the user in the compiler options dialog.
-
wxWidgets has a static function to determine the umber of cpu's, but I don't know how good it works.
It works pretty well - I am using it in another of my projects (You meant the static wxThread based method, right?)
-
wxWidgets has a static function to determine the umber of cpu's, but I don't know how good it works.
It works pretty well - I am using it in another of my projects (You meant the static wxThread based method, right?)
Yes
-
Yes
Reminds me: Recently had the chance to work on a 16 core "enterprise PC". What a mind-blowing fast compilation of everything you do there with C::B, having setup 16 parallel build processes. Also, the wxThread methods worked fine there, too. Now all I need is somebody giving me enough money because I want to have such a beast, too. :-)
-
Yes
Reminds me: Recently had the chance to work on a 16 core "enterprise PC". What a mind-blowing fast compilation of everything you do there with C::B, having setup 16 parallel build processes. Also, the wxThread methods worked fine there, too. Now all I need is somebody giving me enough money because I want to have such a beast, too. :-)
That's more or least what I need too, with at least 32 GB of Ram.
An alternative would be a quadcore laptop with 32 GB installable Ram.
-
Moar cores, moar...
Jen: why would you need so much ram? ;D
-
Jen: why would you need so much ram? ;D
Did you even compile on a RAM drive? If not - now you know, why... ;D
BTW: The computer I was on had 128GB of RAM.
(Maybe we should either split the topic or just shut up... ;-))
-
Jens: why would you need so much ram? ;D
I have several virtual machines to test and compile and they benefit more from ram than from cpu's.
More cores are of course much better, but I need a laptop to be more flexible/mobile.
And laptops with up to 32 GB and a quadcore are common and not too expensive.
-
Did you even compile on a RAM drive? If not - now you know, why... ;D
No, what is the difference in comparison to a desktop (7200rpm produced in the last 2-3 years) hard disk?
I would have upgraded to a ssd, but looking at the reports on the internet, there is no big difference, that's why I've not upgraded.
As far as I can tell disk performance will be important only to the linking phase.