Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29261 Обсуждение

OMP_GET_THREAD_NUM() returns NaN

anishtain4
Начинающий
918Просмотр.
I was working with OpenMP sometimes ago and it was working good, today when I wanted to check something back this function returns NaN value!! even a hello project gets like it:

[bash]program test

I=10
!$OMP PARALLEL NUM_THREADS(5)
  PRINT*,I,OMP_GET_THREAD_NUM()
!$OMP END PARALLEL

END PROGRAM test[/bash]
it prints five time "10 Nan" what can be wrong? any probability some files got damaged? Fix option didn't work
0 баллов
1 Решение
TimP
Почетный участник III
918Просмотр.
You need
USE omp_lib

You can't get away with allowing default data typing into this.

Просмотреть решение в исходном сообщении

3 Ответы
TimP
Почетный участник III
919Просмотр.
You need
USE omp_lib

You can't get away with allowing default data typing into this.
anishtain4
Начинающий
918Просмотр.
Yeah that`s it, Thank youuuu
mecej4
Почетный участник III
918Просмотр.
According to the implicit typing rules of Fortran, a variable/function starting with (A-H, O-Z) is of type real. Thus, the integer result returned by the function is being interpreted as an IEEE real, which produces the NaNs that you saw.

Either USE the OMP module as TimP told you, or declare OMP_GET_THREAD_NUM as INTEGER.
Ответить