| View previous topic :: View next topic |
| Author |
Message |
kk1999
Joined: 23 Dec 2012 Posts: 1
|
Posted: Wed Dec 26, 2012 6:59 am Post subject: Problem with max available threads when using openMP |
|
|
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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Mon Jan 07, 2013 2:56 pm Post subject: |
|
|
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 |
|
 |
|