Setting the number of processors used

General OpenMP discussion

Setting the number of processors used

Postby ferreira pj » Fri Nov 09, 2007 10:43 am

Hi, can someone please tell me how to set the number of processors that will be used to run the paralleled program? I searched in the openmp website but couldn't find nothing...

Thanks
and sorry about the bad english.

edit: i forgot to say... in fortran language please.
ferreira pj
 
Posts: 3
Joined: Fri Nov 09, 2007 10:35 am

Re: Setting the number of processors used

Postby lfm » Thu Nov 15, 2007 2:39 am

You can set the number of threads to be used with the environment variable OMP_NUM_THREADS. You can set the number of threads to be used for following parallel regions with omp_set_num_threads() . In Fortran you probably want to include 'omp.h' or use the module omp_lib (use omp_lib).

You cannot control the number of physical processors/cores available for OpenMP threads; that is a function of the operating system and its environment.

-- Larry
lfm
 
Posts: 135
Joined: Sun Oct 21, 2007 4:58 pm
Location: OpenMP ARB

Re: Setting the number of processors used

Postby ferreira pj » Thu Nov 15, 2007 2:35 pm

thanks larry
ferreira pj
 
Posts: 3
Joined: Fri Nov 09, 2007 10:35 am

Re: Setting the number of processors used

Postby ferreira pj » Tue Nov 20, 2007 12:09 pm

And changing a bit the question... can someone tell me how to set the number of physical processors/cores used to run a program in linux operating system?

Thanks
and sorry again about the bad english.
ferreira pj
 
Posts: 3
Joined: Fri Nov 09, 2007 10:35 am


Return to Using OpenMP

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot] and 5 guests