Monday, 30 April 2007

Using Multi/Dual Core Processors with Platform Builder

If you’re lucky enough to have a dual core development PC, try adding this to your PC environment variables to enable parallel builds on both CPUs:

set BUILD_MULTIPROCESSOR=2

You’ll then see in taskmanager that your CPU usage goes up to 100% now instead of just past 50%!

5 comments:

David said...

I've added this environment variable but my CPU usage still sticks around 50-54%. I have a Core 2 Duo processor.

I added the variable under the XP System Properties/Advanced/Environment Variables, then created a new System Variable with Variable Name=BUILD_MULTIPROCESSOR and Variable Value=2.

Am I doing something wrong? Thanks for this tip - I'm anxious to get it working.

David said...

Nevermind - I found the option for CE 6.0. In VS2005, it is found under TOOLS/OPTIONS/Platform Builder/OS Design/General.

You can set PB to detect the # of processors, or manually select the # of processors to use.

Thanks for the tip!

GraemeW said...

No problem, i'm still waiting to upgrade my machine to a quad core... ;)

Dan McCarty said...

I just spent an hour tracking down some weird PB build problems (CE50) where components built out of order and traced it back to this change.

I'm using a hyperthreaded P4. So in my case PB spawns off two threads. The problem is that in a build scenario where components are dependent on each other (e.g., a driver with MDD and PDD sides) the one with the dependency might finish first and fail to link because the other one hasn't finished building!

Definitely not a hot tip!

(Or at least, you should put some major caveats here.)
You might be able to build on

GraemeW said...

Yes there can be issues with building on multi cpus, lookup SYNCHRONIZE_DRAIN and SYNCHRONIZE_BLOCK in the docs.

Put SYCHRONIZE_DRAIN=1 at the top of the sources file for the
build item that relies on any dependencies.