allen@radiative.com

Incorrect symbol generated for omp_set_num_threads

Discussion created by allen@radiative.com on Jun 2, 2011
Latest reply on Sep 15, 2013 by juaneco2710

I'm using the 4.2.5.1 FORTRAN compiler on a code with extensive OpenMP directives. In some cases the compiler generates the incorrect symbol for the OpenMP intrinsic set_omp_num_threads; instead of generating "omp_set_num_threads_", the compiler adds an extra _ to the external symbol: omp_set_num_threads__. This results in an undefined external at link time.  I'm attaching a highly reduced set of source code, but it is a strange problem: Sometimes the compiler generates the (correct?) external omp_set_num_threads_ and sometimes it generates (incorrectly?) omp_set_num_threads__. Even something as simple as changing the name of a variable or deleting a line of code can cause it to generate omp_set_num_threads__, which is not resolved by the linker.

So, for example, using the four source files:

openf95 -mp mess.f90 strin.f90 writp.f90 fmp.f90

yields

/tmp/cco.8qaBUa: In function `b00_':
fmp.f90:94: undefined reference to `omp_set_num_threads__'
collect2: ld returned 1 exit status

Hopefully, I can attach the code to this message with the correct file names.

Outcomes