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

undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'

fbaralli
Beginner
1,243 Views
Hi,
I'm having problems porting my code under RedHat 32bit.
I'm linking against two static libraries that are using MKL. I need to link statically and use the sequential MKL. My link line is like that:
/opt/intel/composerxe/bin/icpc -DNDEBUG -w0 -O3 -inline-level=2 -fomit-frame-pointer -xHost CMakeFiles/dpca_test.dir/dpca_test.cpp.o -o /usr/local/src/RTPSAS_mk2/bin/Release/dpca_test -rdynamic /usr/local/src/RTPSAS_mk2/lib/Release/libMUSCLEMissionDataManager.a /usr/local/src/RTPSAS_mk2/lib/Release/libMUSCLEDPCALib.a -Wl,-Bstatic -lmkl_intel -lmkl_sequential -lmkl_core -Wl,-Bdynamic /opt/boost/boost_1_45_0/stage/lib/libboost_thread.a /opt/boost/boost_1_45_0/stage/lib/libboost_system.a /opt/boost/boost_1_45_0/stage/lib/libboost_regex.a /opt/boost/boost_1_45_0/stage/lib/libboost_iostreams.a /opt/boost/boost_1_45_0/stage/lib/libboost_filesystem.a /opt/boost/boost_1_45_0/stage/lib/libboost_date_time.a -lpthread

which produces the followingerrors:
/opt/intel/mkl/lib/ia32/libmkl_core.a(_def_dfti_create_sr1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_def_dfti_create_sc1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4_dfti_create_sr1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4_dfti_create_sc1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4p_dfti_create_sr1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4p_dfti_create_sc1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m_dfti_create_sr1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m_dfti_create_sc1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m3_dfti_create_sr1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m3_dfti_create_sc1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_avx_dfti_create_sr1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_avx_dfti_create_sc1d.o): In function `commit':
../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
/opt/intel/mkl/lib/ia32/libmkl_core.a(_def_dfti_create_sr1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_def_dfti_create_sc1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4_dfti_create_sr1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4_dfti_create_sc1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4p_dfti_create_sr1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4p_dfti_create_sc1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m_dfti_create_sr1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m_dfti_create_sc1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m3_dfti_create_sr1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_p4m3_dfti_create_sc1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_avx_dfti_create_sr1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sr1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_r2c_1d_omp'/opt/intel/mkl/lib/ia32/libmkl_core.a(_avx_dfti_create_sc1d.o): In function `commit':../../../../dft/kernel/0ref/dfti_create_sc1d.c:(.text+0x15): undefined reference to `mkl_dft_commit_node_s_c2c_1d_omp'
I use Intel C++ Compser for Linux version2011.0.084 and I already tried to change the link line according to the link advisor with no luck. Any idea?
Thanks for your help
Francesco
0 Kudos
1 Solution
Vladimir_Petrov__Int
New Contributor III
1,243 Views
Francesco,

Please try the following modified link line:

/opt/intel/composerxe/bin/icpc -DNDEBUG -w0 -O3 -inline-level=2 -fomit-frame-pointer -xHost CMakeFiles/dpca_test.dir/dpca_test.cpp.o -o /usr/local/src/RTPSAS_mk2/bin/Release/dpca_test -rdynamic /usr/local/src/RTPSAS_mk2/lib/Release/libMUSCLEMissionDataManager.a /usr/local/src/RTPSAS_mk2/lib/Release/libMUSCLEDPCALib.a -Wl,--start-group $(MKLROOT)/lib/ia32/mkl_intel.a $(MKLROOT)/lib/ia32/mkl_intel_sequential.a $(MKLROOT)/lib/ia32/mkl_core.a -Wl,--end-group -Wl,-Bdynamic /opt/boost/boost_1_45_0/stage/lib/libboost_thread.a /opt/boost/boost_1_45_0/stage/lib/libboost_system.a /opt/boost/boost_1_45_0/stage/lib/libboost_regex.a /opt/boost/boost_1_45_0/stage/lib/libboost_iostreams.a /opt/boost/boost_1_45_0/stage/lib/libboost_filesystem.a /opt/boost/boost_1_45_0/stage/lib/libboost_date_time.a -lpthread

I assume here that MKLROOT is properly set to MKL root.

Please note that start/end-group clauses are essential.

Please also note that you will not get MKL level threading with mkl_intel_sequential.a.

Best regards,
-Vladimir

View solution in original post

0 Kudos
9 Replies
Vladimir_Petrov__Int
New Contributor III
1,244 Views
Francesco,

Please try the following modified link line:

/opt/intel/composerxe/bin/icpc -DNDEBUG -w0 -O3 -inline-level=2 -fomit-frame-pointer -xHost CMakeFiles/dpca_test.dir/dpca_test.cpp.o -o /usr/local/src/RTPSAS_mk2/bin/Release/dpca_test -rdynamic /usr/local/src/RTPSAS_mk2/lib/Release/libMUSCLEMissionDataManager.a /usr/local/src/RTPSAS_mk2/lib/Release/libMUSCLEDPCALib.a -Wl,--start-group $(MKLROOT)/lib/ia32/mkl_intel.a $(MKLROOT)/lib/ia32/mkl_intel_sequential.a $(MKLROOT)/lib/ia32/mkl_core.a -Wl,--end-group -Wl,-Bdynamic /opt/boost/boost_1_45_0/stage/lib/libboost_thread.a /opt/boost/boost_1_45_0/stage/lib/libboost_system.a /opt/boost/boost_1_45_0/stage/lib/libboost_regex.a /opt/boost/boost_1_45_0/stage/lib/libboost_iostreams.a /opt/boost/boost_1_45_0/stage/lib/libboost_filesystem.a /opt/boost/boost_1_45_0/stage/lib/libboost_date_time.a -lpthread

I assume here that MKLROOT is properly set to MKL root.

Please note that start/end-group clauses are essential.

Please also note that you will not get MKL level threading with mkl_intel_sequential.a.

Best regards,
-Vladimir
0 Kudos
fbaralli
Beginner
1,243 Views
Vladimir,
thank you I'll try it tomorrow morning (GMT +1)
I use the sequential MKL because my app is threaded by means of boost threads and from what I understood of the MKL user guide that is incompatible with the multithreaded MKL (via OpenMP). Is this correct?
Best Regards
Francesco
0 Kudos
TimP
Honored Contributor III
1,243 Views
If boost makes the MKL calls in its own threaded region, you probably want mkl_sequential to avoid over-subscribing threads; the boost threading might be more efficient if it allows the MKL functions to work on several cases in parallel.
My concern with your link line is that you must place the MKL static library function scans after any boost functions which call MKL; otherwise references which come later won't be satisfied.
0 Kudos
fbaralli
Beginner
1,243 Views
Vladimir,
thank you for the hint, it worked but with some changes, the "correct" string for my case was:
Wl,--start-group $MKLROOT/lib/ia32/libmkl_intel.a $MKLROOT/lib/ia32/libmkl_sequential.a $MKLROOT/lib/ia32/libmkl_core.a -Wl,--end-group -lpthread

at the very end of the link command.
The downside for me is that I use CMAKE to compile my quite large application and I now have to go through my FindMKL.cmake script to check where I can add the --start-group --end-group statements.
Please note that also the MKL link line advisor does not match with the naming convention of the MKL library files because it does not add the "lib" prefix the the static libraries (it should either be $MKLROOT/lib/ia32/libmkl_sequential.a or -L$MKLROOT/lib/ia32/ -lmkl_sequential ) my two cents....

Best regards
Francesco
0 Kudos
fbaralli
Beginner
1,243 Views
Tim,
MKL is called from the app main thread. The boost thread is used to receive data in parallel and store them in a thread-safe queue.
The same code is supposed to run in an embedded system (Intel Core2 L7400) where there is probably not a big advantage in going for a threaded MKL, but also in multiprocessor Xeon based workstation where there is probably room for speed improvement with parallel MKL. Do you agree with that?
Best regards
Francesco
0 Kudos
barragan_villanueva_
Valued Contributor I
1,243 Views
Quoting fbaralli
Please note that also the MKL link line advisor does not match with the naming convention of the MKL library files because it does not add the "lib" prefix the the static libraries (it should either be $MKLROOT/lib/ia32/libmkl_sequential.a or -L$MKLROOT/lib/ia32/ -lmkl_sequential ) my two cents....

Hi,

Please try updated version of MKL Link Line Advisor.
BTW, for yours case it recommends now:

--start-group $(MKLROOT)/lib/ia32/libmkl_intel.a $(MKLROOT)/lib/ia32/libmkl_sequential.a $(MKLROOT)/lib/ia32/libmkl_core.a -Wl,--end-group -lpthread

0 Kudos
fbaralli
Beginner
1,243 Views
Hi Victor,
I think there is a mismatch between my MKL file structure and the advisor. If libraries are invoked via their absolute pathname their name must start with the lib prefix (i.e. libmkl_core.a instead of mkl_core.a). mkl_core.a does not exist in my $MKLROOT/lib/ia32 directory.
Francesco
0 Kudos
barragan_villanueva_
Valued Contributor I
1,243 Views
Francesco,

Thanks for finding out a bug. Will fix ASAP.
0 Kudos
Gennady_F_Intel
Moderator
1,243 Views
Francesco, the mismatch has been fixed. You can check it right now.
0 Kudos
Reply