Symbol lookup error: undefined symbol: mkl_vsl_serv_threader_for

Symbol lookup error: undefined symbol: mkl_vsl_serv_threader_for

I am getting the following runtime error : symbol lookup error: /opt/intel/mkl/lib/intel64/libmkl_gf_ilp64.so: undefined symbol: mkl_vsl_serv_threader_for 

I probably have to update my 'LD_LIBRARY_PATH' but I can't seem to figure out what path is missing. Any ideas? Thanks

13 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Joseph,
yes, please check the LD_LIBRARY_PATH first of all or try to use the existing scripts: \bin\mklvars.sh intel64 for setting all required paths.
in the case if these settings will not help - give us the linking line you use for building this application.
here is the link to the MKL Linker Adviser for your reference:
http://software.intel.com/sites/products/mkl/

--Gennady

Quote:

Gennady Fedorov (Intel) wrote:

Joseph,
yes, please check the LD_LIBRARY_PATH first of all or try to use the existing scripts: \bin\mklvars.sh intel64 for setting all required paths.
in the case if these settings will not help - give us the linking line you use for building this application.
here is the link to the MKL Linker Adviser for your reference:
http://software.intel.com/sites/products/mkl/

--Gennady

Hi Gennady,

Thank you for your response i tried using mklvars.sh intel 64 to set any required paths but I still get the same error. The following is the linking line I have used

-L/opt/intel/mkl/lib/intel64 -lmkl_scalapack_ilp64 -lmkl_cdft_core -lmkl_gf_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_ilp64 -ldl -lpthread -lm -L/opt/intel/lib/intel64 -liomp5

Hi,
We have checked the problem with the latest version 11.0 update1 and see no problems.
We have used on of VSL example ( vsldbasicstats.f ) from \examples\vslf\source\ directory.
Would you please check if you can build and execute this example too and please let us know the results.
in the case if any further problem - please give us your example for checking the problem on our side.

one more note - you use ILP64 interfaces, therefore you need to add the following compiler options:
-fdefault-integer-8 -m64

--Gennady

Quote:

Gennady Fedorov (Intel) wrote:

Hi,
We have checked the problem with the latest version 11.0 update1 and see no problems.
We have used on of VSL example ( vsldbasicstats.f ) from \examples\vslf\source\ directory.
Would you please check if you can build and execute this example too and please let us know the results.
in the case if any further problem - please give us your example for checking the problem on our side.

one more note - you use ILP64 interfaces, therefore you need to add the following compiler options:
-fdefault-integer-8 -m64

--Gennady

Hi Gennady,

Thanks again fro your response. It seems that I get the runtime error whenever i compile Fortran with gfortran (4.6.3), however when I compile with ifort, the error is not there. That is very weird. The program I am trying to build with MKL is NWChem a computational chemistry software you can download the source http://www.nwchem-sw.org/download.php?f=Nwchem-6.1.1-src.2012-06-27.tar.gz (it is GPL) .
This is the bash script you will need to use to buld the application (you will need to run the script inside the "src" directory)


#!/bin/bash

export NWCHEM_TOP=/home/doudou/Programs/nwchem-6.1.1-mkl

export NWCHEM_TARGET=LINUX64

export USE_MPI=y

export USE_MPIF=y

export USE_MPIF4=y

export MPI_LOC=/home/doudou/Programs/OpenMPI

export LIBMPI="-lmpi_f90 -lmpi_f77 -lmpi -lpthread"

export MPI_LIB=$MPI_LOC/lib

export MPI_INCLUDE=$MPI_LOC/include

export LARGE_FILES=TRUE

export NWCHEM_MODULES=all

export MKLROOT=/opt/intel/mkl

export BLASOPT="-L$MKLROOT/lib/intel64 -lmkl_scalapack_ilp64 -lmkl_cdft_core -lmkl_gf_ilp64 -lmkl_intel_thread -lmkl_core -lmkl_blacs_intelmpi_ilp64 -ldl -lpthread -lm -L/opt/intel/lib/intel64 -liomp5"

make clean

make FC=gfortran FFLAGS="-fdefault-integer-8 -m64"  nwchem_config

make FC=gfortran FFLAGS="-fdefault-integer-8 -m64"  HAS_BLAS=yes

Thanks again for your help

Bild des Benutzers mecej4

If you want help with compiling a huge application (~80 MB of source code) with GFortran, you should probably seek that help elsewhere.

If you can make up a small example that encapsulates the build problems that you experienced and establish that there is, indeed, a problem with a specific set of MKL routines, you could post that here.

Quote:

mecej4 wrote:

If you want help with compiling a huge application (~80 MB of source code) with GFortran, you should probably seek that help elsewhere.

If you can make up a small example that encapsulates the build problems that you experienced and establish that there is, indeed, a problem with a specific set of MKL routines, you could post that here.

I dont need help with compiling with gfortran (in case you have not read the title of thread), the code compiles fine nad I am able to link all the libraries fine, except when it was compiled with gfortran I get a runtime error, I dont get this error with ifort.

Bild des Benutzers Ronald W Green (Intel)

first, that symbol is in libmkl_intel_thread, at least in the version of MKL packaged with the Composer XE 2013 (aka compiler 13.0 compilers) so perhaps something foobar is going on with your build since you claim you have that lib in your link line.  Make sure to 'make distclean' or something equivalent, maybe even going back to the configure step. 

you have not mentioned what compiler version you are using, nor have you said if you 'source /opt/intel/bin/compilervars.sh intel64', which is essential.

-m64 is for Mac OS and for gcc compatibilty.  For Intel Fortran for Linux, I'd suspect you need these options, but do check with NWChem gurus:

-integer-size 64 -mc-model medium -dynamic-intel

along with the other options (you showed the gfortran options, not the options you're using for Intel - what are those?)

ron

Bild des Benutzers Andrey Tikhonov

Hello. I had the same problem, except for I didn't use gfortran, I used g++.

The problem is that the resulting binary is not linked with libmkl_intel_thread, and neither is libmkl_gf_ilp64 - you can check it with ldd.

The workaround is as follows:

LD_PRELOAD=/path/to/libmkl_core.so:/path/to/libmkl_intel_thread.so your-program

Bild des Benutzers Andrey Tikhonov

You can force ld to link to this libraries by using --no-as-needed switch, like this:

ld obj1.o obj2.o -lfoo -lbar --no-as-needed -lmkl_core -lmkl_intel_thread

Hi, 

   I am having the very same problem of "libmkl_intel_lp64.so: undefined symbol: mkl_vsl_serv_threader_for", I have tried all the suggested stuff on this post and could not get the code running, here I am describing what I am trying to do.

The code I am trying to run is -- 

#define min(x,y) (((x) < (y)) ? (x) : (y))

#include <stdio.h>
#include <stdlib.h>
#include "mkl.h"
#include <time.h>

int main()
{
    time_t t;
    double *A, *B, *C;
    int m, n, k, i, j;
    double alpha, beta;

    printf ("\n This example computes real matrix C=alpha*A*B+beta*C using \n"
            " Intel® MKL function dgemm, where A, B, and  C are matrices and \n"
            " alpha and beta are double precision scalars\n\n");

    m = 100, k = 20, n = 1000;
    //m = 20000, k = 200, n = 100;
    printf (" Initializing data for matrix multiplication C=A*B for matrix \n"
            " A(%ix%i) and matrix B(%ix%i)\n\n", m, k, k, n);
    alpha = 1.0; beta = 0.0;

    printf (" Allocating memory for matrices aligned on 64-byte boundary for better \n"
            " performance \n\n");
    A = (double *)mkl_malloc( m*k*sizeof( double ),64);
    B = (double *)mkl_malloc( k*n*sizeof( double ),64);
    C = (double *)mkl_malloc( m*n*sizeof( double ),64);
    if (A == NULL || B == NULL || C == NULL) {
      printf( "\n ERROR: Can't allocate memory for matrices. Aborting... \n\n");
      free(A);
      free(B);
      free(C);
      return 1;
    }

    printf (" Intializing matrix data \n\n");
    for (i = 0; i < (m*k); i++) {
        A[i] = (double)(i+1);
    }

    for (i = 0; i < (k*n); i++) {
        B[i] = (double)(-i-1);
    }

    for (i = 0; i < (m*n); i++) {
        C[i] = 0.0;
    }

    printf (" Computing matrix product using Intel® MKL dgemm function via CBLAS interface \n\n");
    t = clock();
    cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
                m, n, k, alpha, A, k, B, n, beta, C, n);
    printf ("\n Computations completed.\n\n");

    t = clock() - t;
    printf (" time taken is %f \n", ((float)t)/1000.0);
    printf (" Top left corner of matrix A: \n");
    for (i=0; i<min(m,6); i++) {
      for (j=0; j<min(k,6); j++) {
        printf ("%12.0f", A[j+i*k]);
      }
      printf ("\n");
    }

    printf ("\n Top left corner of matrix B: \n");
    for (i=0; i<min(k,6); i++) {
      for (j=0; j<min(n,6); j++) {
        printf ("%12.0f", B[j+i*n]);
      }
      printf ("\n");
    }

    printf ("\n Top left corner of matrix C: \n");
    for (i=0; i<min(m,6); i++) {
      for (j=0; j<min(n,6); j++) {
        printf ("%12.5G", C[j+i*n]);
      }
      printf ("\n");
    }

    printf ("\n Deallocating memory \n\n");
    mkl_free(A);
    mkl_free(B);
    mkl_free(C);

    printf (" Example completed. \n\n");
    return 0;
}

Here are the list of things I did along with the results I got.

~/.bashrc has this line 

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64:/opt/intel/composer_xe_2013_sp1.0.080/compiler/lib/intel64

1.1. Compiler command: - g++ -I/opt/intel/mkl/include -O3 -Wall -c -m64 -fmessage-length=0 -MMD -MP -MF"checkMKL_DGEMM.d" -MT"checkMKL_DGEMM.d" -o "checkMKL_DGEMM.o" "../checkMKL_DGEMM.cpp"

1.2. Linker command: g++ -L/opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64 -o "mklMatrixMul" checkMKL_DGEMM.o -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -L/opt/intel/composer_xe_2013_sp1.0.080/compiler/lib/intel64 -liomp5 -ldl -lpthread -lm

1.3. Result on running:  symbol lookup error: /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so: undefined symbol: mkl_vsl_serv_threader_for

1.4. Result of running ldd ./mklMatrixMul: 

linux-vdso.so.1 =>  (0x00007fffde182000)
    libmkl_intel_lp64.so => /opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64/libmkl_intel_lp64.so (0x00007fb5908e2000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb590507000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb590303000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fb591007000)

1.5 Result of using LD_PRELOAD=opt/intel/mkl/lib/intel64/libmkl_intel_thread.so:opt/intel/mkl/lib/intel64/libmkl_core.so ./mklMatrixMul

symbol lookup error: /opt/intel/mkl/lib/intel64/libmkl_core.so: undefined symbol: pthread_mutex_trylock

 

Then I tried the options specified on the Intel linker option finder.

2.1 Compiler ---- g++ -c -DMKL_ILP64 -m64 -I/opt/intel/composer_xe_2013_sp1.0.080/mkl/include -Wall -O3 -o foo.o checkMKL_DGEMM.cpp

2.2 Linker -----  g++ -o foo foo.o -L/opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64 -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -liomp5 -ldl -lpthread -lm

2.3 ldd ----- 

linux-vdso.so.1 =>  (0x00007fff2a1fe000)
    libmkl_intel_ilp64.so => /opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64/libmkl_intel_ilp64.so (0x00007ffb038d1000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffb034f6000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ffb032f2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007ffb03fe7000)

2.4 ./foo results in /opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64/libmkl_intel_ilp64.so: undefined symbol: mkl_vsl_serv_threader_for

 

So, you can see I have tried almost everything that was suggested on this post and elsewhere, can anyone help me that, I have a 30 day free-trial version of MKL installed on 64 bit Ubuntu, i7-2720 QM processor.

Any help will be deeply appreciated

Did you ever find a solution to this problem? I am attempting to compile and link a program with gcc and am receiving the same error. 

Thank  abhishek s and Andrey Tikhonov much for giving us the hint. We suspect some GCC versions on Ubuntu deployed --as-needed behavior as default.

This option tells linker did not add DT_NEEDED ELF flag for all specified libraries but only for libraries with symbols used in the test. Thus the correlated library are not loaded at runtime and executable fails with runtime error.

Please see http://software.intel.com/en-us/forums/topic/499180

The solution is to add --no-as-needed in command line. 

g++ -L/opt/intel/composer_xe_2013_sp1.0.080/mkl/lib/intel64 -o "mklMatrixMul" checkMKL_DGEMM.o -Wl,--no-as-needed -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -L/opt/intel/composer_xe_2013_sp1.0.080/compiler/lib/intel64 -liomp5 -ldl -lpthread -lm. 

Best Regards,
Ying 

Melden Sie sich an, um einen Kommentar zu hinterlassen.