Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

problem with OpenMP routine.

changhee
Beginner
562 Views
Hi.

My problem is that the openmp routine, 'omp_get_thread_num()' yields wrong result.

I'm using ifl 7.1 on windows server 2003.

I set the enviroment variable, OMP_NUM_THREADS to 8, and then ran the following openmp program.

program hello
integer num
write(6, *) "hello parallel world from threads ! "
!$omp parallel
num=omp_get_thread_num()
write(6, *) 'omp_num: ',num
!$omp end parallel
end

Starting the program above, I saw the following.

hello parallel world from threads !
omp_num: -2147483648
omp_num: -2147483648
omp_num: -2147483648
omp_num: -2147483648
omp_num: -2147483648
omp_num: -2147483648
omp_num: -2147483648
omp_num: -2147483648

The routine, 'omp_get_thread_num()' yield wrong result. In other words, the integer variable, 'num' must lie between 0 and 7.

Any ideas what the problem can be?

Thanks
0 Kudos
2 Replies
Steven_L_Intel1
Employee
562 Views
You didn't INCLUDE the OpenMP definitions file, so the routine is implicitly REAL.

Steve
0 Kudos
changhee
Beginner
562 Views
Thanks steve.
You're right.
I've forgot typing 'use omp_lib' .

Changhee
0 Kudos
Reply