Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

OpenMP thread number

schrackzone
Beginner
910 Views
I'm a new user of OpenMP and have run into a problem. I'm using the Intel Fortran for Linux l_fce_8.1.029 on Fedora Core 4 SMP 64 bit on a new Dell dual-core em64t. The omp_get_thread_num() returns 0 in all threads.

program omptest
print *, "Hello parallel world from threads:"
call omp_set_num_threads(2)
print '(I6)', omp_get_num_threads()
print *
!$omp parallel
print '(I6)', omp_get_thread_num()
!$omp end parallel
print *, "Back to the sequential world."
end


omptest : omptest.o
ifort -openmp -o omptest omptest.o
omptest.o : omptest.f90
ifort -openmp -c omptest.f90


[root@sc430-1 test]# make
ifort -openmp -c omptest.f90
ifort: Command line warning: openmp requires C style preprocessing; using fpp to preprocess
omptest.f90(6) : (col. 6) remark: OpenMP DEFINED REGION WAS PARALLELIZED.
ifort -openmp -o omptest omptest.o
[root@sc430-1 test]# ./omptest
Hello parallel world from threads:
0

0
0
Back to the sequential world.

I even tried to set the number of thread with the call omp_set_num_threads() but get the same results.
Interesting thing is that 2 threads are started for the number of processors but the thread number is always 0.

Thanks.
0 Kudos
2 Replies
schrackzone
Beginner
910 Views
Oh well, never mind. I made 32 bit integer explicit function declarations for the omp functions and everything works fine.

Thanks.
0 Kudos
schrackzone
Beginner
910 Views
Maybe I'm the only one that didn't know this..
include 'omp_lib.h'
0 Kudos
Reply