views:

168

answers:

2

I'm compiling a large HPC system written in Fortran using the Intel compiler (ifort). There are about several hundred individual modules and they all compile fine, but the linker throws up this error:

phys_grid.o(.text+0x91b2): In function `phys_grid_mp_assign_chunks_':
: undefined reference to `_mm_idivrem_epi32'

The _mm_idivrem_epi32 seems to be a result of the compiler's automatic vectorization, but if the compiler generated it, why am I getting this error? Do I need to link in some additional library?

Update:

Using nm, I was able to trace the function to libsvml but linking with that didn't help. Now herein seems to lie the problem: ia32intrin.h declares the function as follows:

__m128i __cdecl _mm_idivrem_epi32(__m128i * r, __m128i v1, __m128i v2); //__svml_idivrem4

But from nm's output, the symbol in the library is __svml_idivrem4. According to the header file, these are the same functions, but can I tell this to the linker?

A: 

My guess is that the source file in question (phys_grid.f90?) doesn't have an implicit none statement. Without that, ifort will just assume there must be a routine somewhere matching that profile, and merrily compile it up and hand it to the linker for resolution.

Of course your next job is going to be to go find the code for that missing routine, or to figure out WTH it does so you can rewrite it.

T.E.D.
+1  A: 

Recourse to Google points me to a file, on my Mac:

/Developer/opt/intel/Compiler/11.1/080/include/ia32intrin.h

which contains a declaration of a symbol

_mm_idivrem_epi32

So it does look as if you are missing a linkage or include.

High Performance Mark
Mine doesn't have it, but I'm running version 9.1, and it looks like you have 11.1. Casablanca, what version of the compiler are you running?
T.E.D.
I'm using version 11.1. Indeed the header file Mark mentioned contains the declaration for _mm_idivrem_epi32, but I'm still trying to figure out exactly which library I need to link with.
casablanca