Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Simple way to use Multi-Cores

Author
Message
Scottie Dog
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location:
Posted: 4th Nov 2009 11:59 Edited at: 4th Nov 2009 12:00
Using Multi-Cores.

Visual C++ Express by default generates code that works on one thread and on one core of your processor.

I came across an easy way of multi-coring your work out. OMP


Say for example we process through a list of Objects and do a little work on each one, normally we would work on the first, complete that and then start work on the second.... and so on.
What if we could get core one of the machine to work on the first few and core two to work on the next few (at the SAME time).

This basic example has a few requirements. The data processed works in it own little discrete space (i.e. we arnt sorting the data or changing variables that might be accessed by other lines of the data). All that is possible, but you will need to explore omp for yourself....

To Use:

Inside the Properties Page -> Configuration Properties -> C/C++ -> Language screen - set OpenMP Support to Yes (/openmp)


Say we have the following code....


To multi-core it...



How simple is that!

The compiler will do the rest. Nice thing is - doesnt matter if you are on a quad or duel core, it will use what is available.

More information is of course available, but I will leave that up to you to find.
_Pauli_
AGK Developer
15
Years of Service
User Offline
Joined: 13th Aug 2009
Location: Germany
Posted: 4th Nov 2009 12:46
I can't test it right now, because I'm on my crappy single-core laptop at the moment, but if this works like this then it's AWESOME!!!

Didn't know OpenMP at all before. I guess it's open-source right?

Now the plot thickens, the fps decreases, and the awesomeness goes through the roof.

Login to post a reply

Server time is: 2024-10-01 16:32:18
Your offset time is: 2024-10-01 16:32:18