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

problem with OpenMP routine.

changhee
Principiante
1.514 Vistas
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 Respuestas
Steven_L_Intel1
Empleados
1.514 Vistas
You didn't INCLUDE the OpenMP definitions file, so the routine is implicitly REAL.

Steve
changhee
Principiante
1.514 Vistas
Thanks steve.
You're right.
I've forgot typing 'use omp_lib' .

Changhee
Responder