PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Problem with max available threads when using openMP

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Licenses and Installation
View previous topic :: View next topic  
Author Message
kk1999



Joined: 23 Dec 2012
Posts: 1

PostPosted: Wed Dec 26, 2012 6:59 am    Post subject: Problem with max available threads when using openMP Reply with quote

Hi all,
I have installed the workstation 12.10 for evaluating openMP of pgfortran. But the maximum available threads given by the compiler is always 1, while other compilers(gfortran and ifort) return the correct value(8). Is there anything wrong with my installation? By the way, my computer's cpu is Intel i7 930. The OS running on my PC is fedora 17. Thanks!

Below is the simple code to test maximum threads available.

Code:

PROGRAM test_parallel_env
USE omp_lib

IMPLICIT NONE
INTEGER(omp_integer_kind)::max_treads ! The max number of threads

max_threads=omp_get_max_threads()
WRITE(*,*)max_threads

END PROGRAM test_parallel_env


CPU INFO
Code:

[kepu@kepu-desktop Parallel]$ grep "model name" /proc/cpuinfo
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
model name   : Intel(R) Core(TM) i7 CPU         930  @ 2.80GHz
[kepu@kepu-desktop Parallel]$


Test Result
Code:

[kepu@kepu-desktop Parallel]$ pgfortran -mp test_parallel_env.f90 -o test_parallel_env.o
[kepu@kepu-desktop Parallel]$ ./test_parallel_env.o
            1
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6072
Location: The Portland Group Inc.

PostPosted: Mon Jan 07, 2013 2:56 pm    Post subject: Reply with quote

Hi kk1999,

By default, the number threads is set to 1. To change the default to use all available cores, please use the flag "-mp=allcores". You can also set the environment variable "OMP_NUM_THREADS" to the number of threads to use.

Code:
% pgfortran -mp test_parallel_env.f90 -o test_parallel_env.o -V12.10
% test_parallel_env.o
            1
% setenv OMP_NUM_THREADS 8
% test_parallel_env.o
            8

% pgfortran -mp=allcores test_parallel_env.f90 -o test_parallel_env.o -V12.10
% unsetenv OMP_NUM_THREADS
% test_parallel_env.o
            8
% setenv OMP_NUM_THREADS 4
% test_parallel_env.o
            4


Hope this helps,
Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Licenses and Installation All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group