execution with 2 cores

General OpenMP discussion

execution with 2 cores

Postby moktar_bouain » Tue Apr 03, 2012 4:44 pm

Hi all,

I am new to the forum and I would like to know some information about OpenMP.
I am trying to build a program that it runs sequentially in one processor and at a certain moment it starts parallel execution (the program run with two processor).Like that:

CPU 0 : instruction 1 {
CPU 0 : instruction 2
. sequential execution
CPU 0 : instruction n }

CPU 0 : instruction n+1 {
CPU 1 : instruction n+2
. parallel execution

CPU 0 : instruction n+m-1
CPU 1 : instruction n+m }
So, with OpenMp can I configure my program to make each thread has a core to execute??


Re: execution with 2 cores

Postby james » Wed Apr 04, 2012 7:59 pm

The point of OpenMP is to define regions of code that will be run in parallel.
Posts: 54
Joined: Fri May 16, 2008 9:27 am

Re: execution with 2 cores

Postby moktar_bouain » Thu Apr 05, 2012 4:05 am

Thank you for your repply.

So, can I affect the threads to cores??.
Thread master runs on the Core 1.
Thread 2 runs on the core 2.

Or the scheduling of tasks will be manage automatically by the scheduler of OpenMP?


Re: execution with 2 cores

Postby MarkB » Fri Apr 06, 2012 4:33 am

The scheduling of OpenMP threads to physical cores is normally under the control of the OS's scheduling policy.
Explicitly binding threads to cores cannot (yet) be done portably in OpenMP, but there are often OS- or compiler-specific
mechanisms for doing this. Setting OMP_PROC_BIND to true can help ensure that your threads do not migrate during
Posts: 746
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 5 guests