-parallel

-parallel

brunocalado's picture

I am trying to use -parallel feature.

I create the program and the env vars. But when I compile I got this:

../src/main.f90:(.text+0x2b): undefined reference to `__kmpc_begin' ../src/main.f90:(.text+0x35): undefined reference to `__kmpc_global_thread_num' ../src/main.f90:(.text+0x4b): undefined reference to `__kmpc_ok_to_fork' ../src/main.f90:(.text+0x70): undefined reference to `__kmpc_fork_call' ../src/main.f90:(.text+0x80): undefined reference to `__kmpc_serialized_parallel' ../src/main.f90:(.text+0xe4): undefined reference to `__kmpc_end_serialized_parallel' ../src/main.f90:(.text+0x126): undefined reference to `__kmpc_end' ../src/main.f90:(.text+0x1a2): undefined reference to `__kmpc_for_static_init_4' ../src/main.f90:(.text+0x2cd): undefined reference to `__kmpc_for_static_fini' 

7 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
TimP (Intel)'s picture

You should use ifort -parallel throughout, so that the references to OpenMP and pthread libraries are passed automatically through the linker script.

brunocalado's picture
Quoting - tim18 You should use ifort -parallel throughout, so that the references to OpenMP and pthread libraries are passed automatically through the linker script.

I did it.

I am under linux using eclipse with photran. I enable the option parallel.

But I still getting the same message.

Nuno S.'s picture

Hi
I'm having similar problems. I've recently installed the 2013 full pack, and was trying to use Intel's -guide -parallel feature on one of my fortran programs. It compiles perfectly (with flag -parallel ) even with the suggested changes from -guide but when linking (with flag -parallel) it complains and gives the following error messages

minim.f:(.text+0x7e6): undefined reference to `__kmpc_global_thread_num'
minim.f:(.text+0x809): undefined reference to `__kmpc_ok_to_fork'
minim.f:(.text+0x86c): undefined reference to `__kmpc_fork_call'
minim.f:(.text+0xad7): undefined reference to `__kmpc_for_static_init_4'
minim.f:(.text+0xcdd): undefined reference to `__kmpc_critical'
minim.f:(.text+0xd03): undefined reference to `__kmpc_end_critical'
minim.f:(.text+0xd10): undefined reference to `__kmpc_for_static_fini'

What could be wrong here? How to fix this?

Kevin Davis (Intel)'s picture

Nuno - are you also using eclipse/photran?

What’s wrong is the appropriate OpenMP library was not included in the link. If you are not using eclipse/photran and link using “ld” then the link is lacking the required libs. ld does not understand the -parallel option. The preferred/recommended fix is to use the “ifort” driver with the -parallel option to link (instead of ld) to ensure the appropriate libraries are linked.

If you cannot use the ifort driver to link, then include the appropriate libraries with ld. On your ld command line, try including: -Bstatic -lifcoremt -Bdynamic -liomp5 (these are only differences in libs linked by ifort when -parallel is used)

Nuno S.'s picture

disregard my last post. I was rechecking my Makefile and it wasn't calling the -parallel flag on linking. Fixed and linked fine. Testing the program now and it is using more than 1 core. Thanks Intel, this is a very nice feature.

Kevin Davis (Intel)'s picture

Glad to hear that.

Login to leave a comment.