Search code examples
linkerfortranopenmpgfortran

What is the "_8" postfix that is appended when linking openmp library fortran calls?


I'm compiling and trying to link together a couple of libraries, one issue that seems to arise is that a call to openmp in Fortran, like for example.

!$    CALL omp_set_num_threads(foo)

ends up looking for a symbol

> nm dmumpsmex.mexa64 | grep omp_set_num
                 U omp_set_num_threads_8_@@OMP_1.0

that is with a _8 extension appended, and I wonder where that comes from and what it signifies?


Solution

  • These distinguish the individual specific procedures for the generic procedures in the library. This one is for 8-byte integers as the argument.

    You can test calling both, here with hard-wired kinds 4 and 8, but you can try any other kind selection (e.g. 1_int32 and 1_int64):

      use omp_lib
    
      call omp_set_num_threads(1_4)
      call omp_set_num_threads(1_8)
    end
    

    And you will get

             U omp_set_num_threads_@OMP_1.0
             U omp_set_num_threads_8_@OMP_1.0
    

    when compiled with gfortran, which uses the libgomp library.