Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

Symbol Lookup Error

Christopher_R_3
Beginner
1,132 Views

When I try to call this function:

void vslTest(int N){
  double W;
  VSLStreamStatePtr stream;
  vslNewStream(&stream,VSL_BRNG_MT19937,20);
  vdRngGaussian(VSL_RNG_METHOD_GAUSSIAN_BOXMULLER,stream,N,W,0.0f,1.0f);
  vslDeleteStream(&stream);
  printf("passed");
}

I get the following error:

/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_vml_avx2.so: undefined symbol: mkl_serv_allocate

This is with Intel Parallel Studio 2016 and the compilation command:

icc -Wall -std=c99 -shared -g -o euler_maruyama.so -fPIC -mkl euler_maruyama.c 

This is on CentOS7. The function is then called in Julia via:

N = 100
W = Vector{Float64}(N)
ccall((:vslTest,"path/to/library/euler_maruyama.so"),Void,(Cint,),N)

I am pretty confident in the Julia code (I use this part a lot for calling C libraries), and so I am pretty sure this is a problem with my use or compilation of MKL. Compiler variables are set as:

source /opt/intel/bin/compilervars.sh intel64 > /dev/null
source /opt/intel/vtune_amplifier_xe_2016/amplxe-vars.sh > /dev/null
source /opt/intel/inspector_xe_2016/inspxe-vars.sh > /dev/null
source /opt/intel/advisor_xe_2016/advixe-vars.sh > /dev/null

Sorry I am pretty new at this so please let me know what other information would be helpful. (Note: In the post below I changed the function slightly to have no input argument, int output, and in its own file vslTest.c)

 

0 Kudos
4 Replies
VipinKumar_E_Intel
1,132 Views

I just tried your build line in an RHEL box and couldn't reproduce. 

Can you try linking to mkl with various libs, and you can refer our Linkline advisor tool, believing you have set the env. variables already, using either compilervar.sh or mklvars.sh?

https://software.intel.com/sites/products/mkl/mkl_link_line_advisor.htm

 

0 Kudos
Christopher_R_3
Beginner
1,132 Views

Some extra information. For some reason compiling for use with a debugger works, but only for the static object. The compiler commands are from the link line advisor for the second set.

[crackauc@crackauc EMtest]$ icc vslTest.c -g -Wall -mkl -o vslTest.o
[crackauc@crackauc EMtest]$ ./vslTest.o
passed
[crackauc@crackauc EMtest]$ icc vslTest.c -Wall -mkl -o vslTest.o
[crackauc@crackauc EMtest]$ ./vslTest.o
Segmentation fault (core dumped)
[crackauc@crackauc EMtest]$ ./vslTest.o
Segmentation fault (core dumped)
[crackauc@crackauc EMtest]$ icc vslTest.c  -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_sequential.a -Wl,--end-group -lpthread -lm -DMKL_ILP64 -I${MKLROOT}/include -g -o vslTest.o
[crackauc@crackauc EMtest]$ ./vslTest.o
passed
[crackauc@crackauc EMtest]$ icc vslTest.c  -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential -lpthread -lm  -DMKL_ILP64 -I${MKLROOT}/include -shared -fPIC -o vslTest.so
[crackauc@crackauc EMtest]$ ./vslTest.so
Segmentation fault (core dumped)
[crackauc@crackauc EMtest]$ icc vslTest.c  -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_core -lmkl_sequential -lpthread -lm  -DMKL_ILP64 -I${MKLROOT}/include -shared -fPIC -g -o vslTest.so
[crackauc@crackauc EMtest]$ ./vslTest.so
Segmentation fault (core dumped)

 

0 Kudos
Christopher_R_3
Beginner
1,132 Views

Another thing to note is that when I try to link as follows all of the references are undefined. Here is a snippet, it keeps going though. Don't know if this is another symptom of the same problem. This compilation code is from the example: https://software.intel.com/en-us/node/528677

[crackauc@crackauc EMtest]$ icc vslTest.c -lmkl_intel_lp64 -lmkl_core -ltbb -lstdc++ -lpthread -lm
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_scscsm'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_zgetrf'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_dbsrmm'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_blas_cgerc'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_serv_xerbla'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_cunmqr'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_ddiamm'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_dlacpy'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_psol_fwgath_pardiso_mic'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_lp64_sp_ch_blkslvs_ooc_pardiso'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_serv_domain_set_num_threads'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_scsrmultd'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_dpptrf'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_dpttrs'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_ctpunpack'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_sparse_s_mm_i4'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_slv_omp_cmplx'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_cgetrf'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_spttrs'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_lapack_sgetrfnpi'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_serv_get_dynamic'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_vml_serv_threader_s_1i_c_1o'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_lapack_clahpf'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_blas_dcopy'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_ch_blkldl_ooc_omp_pardiso'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_scsrmv'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_sskysv'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_lp64_blkl_omp_mic_cmplx'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_sp_psol_bwscat_pardiso'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_lp64_sp_c_psol_fwgath_pardiso'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_sp_psol_fwgath_pardiso_mic'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_zdiatrsv'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_cspblas_dcsrsymv'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_lp64_blkslv_unsym_ooc_pardiso'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_blas_dgemm'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_lapack_zgelqf_pf'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_core.so: undefined reference to `mkl_pds_sp_diag_pardiso'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_blas_sgemm_batch'
/opt/intel/compilers_and_libraries_2016.0.109/linux/mkl/lib/intel64/libmkl_intel_lp64.so: undefined reference to `mkl_spblas_lp64_mkl_cspblas_sbsrgemv'

 

0 Kudos
Christopher_R_3
Beginner
1,132 Views

Another odd update. Interestingly, the code works when I offload it to the Xeon Phi (with attribute tags and the like). Now I'm really confused!

0 Kudos
Reply