- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to use the function mkl_dcscmm in my C++ code. I am using the gnu compiler and linker. When the linking stage begins I use this call:
g++ -ansi -pedantic -Wall -O3 netlist.o domain.o createMats.o main.o -o circuit libs/SuperLU_3.0/libsuperlu_3.0.a -Llibs/imkl/mkl/lib/em64t libs/imkl/mkl/lib/em64t/libmkl_intel_lp64.a libs/imkl/mkl/lib/em64t/libmkl_intel_thread.a libs/imkl/mkl/lib/em64t/libmkl_core.a libs/imkl/mkl/lib/em64t/libguide.a -lpthread -lm
and the output is full of errors that look like this:
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x7b0): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_cspblas_dcsrmmgen'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x828): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_dcsrmmgen'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x8d4): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_cspblas_dcsrmmtr'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x96b): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_dcsrmmtr'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0xd09): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_cspblas_dcsrmmskew'
I tried grepping through the mkl lib directory for things like mkl_spblas_lp64_cspblas_dcsrmmtr and I found that they are referenced in these files:
Binary file libmkl_core.a matches
Binary file libmkl_gnu_thread.a matches
Binary file libmkl_intel_thread.a matches
Binary file libmkl_sequential.a matches
Binary file libmkl_def.so matches
Binary file libmkl_gnu_thread.so matches
Binary file libmkl_intel_thread.so matches
Binary file libmkl_mc.so matches
Binary file libmkl_p4n.so matches
Binary file libmkl_sequential.so matches
None of these actually look like they contain the definitions I'm looking for and when I include the ones not already included I get other linking errors. The example in the mkl/examples/spblas is only for fortran and I have included all the files that it uses. Any suggestions?
g++ -ansi -pedantic -Wall -O3 netlist.o domain.o createMats.o main.o -o circuit libs/SuperLU_3.0/libsuperlu_3.0.a -Llibs/imkl/mkl/lib/em64t libs/imkl/mkl/lib/em64t/libmkl_intel_lp64.a libs/imkl/mkl/lib/em64t/libmkl_intel_thread.a libs/imkl/mkl/lib/em64t/libmkl_core.a libs/imkl/mkl/lib/em64t/libguide.a -lpthread -lm
and the output is full of errors that look like this:
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x7b0): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_cspblas_dcsrmmgen'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x828): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_dcsrmmgen'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x8d4): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_cspblas_dcsrmmtr'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0x96b): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_dcsrmmtr'
libs/imkl/mkl/lib/em64t/libmkl_core.a(_def_mkl_dcscmm_lp64.o)(.text+0xd09): In function `mkl_spblas_lp64_def_mkl_dcscmm':
: undefined reference to `mkl_spblas_lp64_cspblas_dcsrmmskew'
I tried grepping through the mkl lib directory for things like mkl_spblas_lp64_cspblas_dcsrmmtr and I found that they are referenced in these files:
Binary file libmkl_core.a matches
Binary file libmkl_gnu_thread.a matches
Binary file libmkl_intel_thread.a matches
Binary file libmkl_sequential.a matches
Binary file libmkl_def.so matches
Binary file libmkl_gnu_thread.so matches
Binary file libmkl_intel_thread.so matches
Binary file libmkl_mc.so matches
Binary file libmkl_p4n.so matches
Binary file libmkl_sequential.so matches
None of these actually look like they contain the definitions I'm looking for and when I include the ones not already included I get other linking errors. The example in the mkl/examples/spblas is only for fortran and I have included all the files that it uses. Any suggestions?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As there are circular references in the MKL libraries, for static linking, you must either repeat the list of libraries 3 times (more, if in wrong order), or set the -Wl,--begin-group .... -Wl, --end-group (or equivalent) flags, as shown in the MKL docs. If those options go wrong, it could be a problem with out of date binutils or gcc.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks! That worked. I don't know why I didn't see that before. I had used those lines before for a different example I was working with.
For those interested, here is the linking line that worked for me:
g++ -ansi -pedantic -Wall -O3 netlist.o domain.o createMats.o main.o -o circuit libs/SuperLU_3.0/libsuperlu_3.0.a -Llibs/imkl/mkl/lib/em64t libs/imkl/mkl/lib/em64t/libmkl_intel_lp64.a -Wl,--start-group libs/imkl/mkl/lib/em64t/libmkl_intel_thread.a libs/imkl/mkl/lib/em64t/libmkl_core.a -Wl,--end-group libs/imkl/mkl/lib/em64t/libguide.a -lpthread -lm
For those interested, here is the linking line that worked for me:
g++ -ansi -pedantic -Wall -O3 netlist.o domain.o createMats.o main.o -o circuit libs/SuperLU_3.0/libsuperlu_3.0.a -Llibs/imkl/mkl/lib/em64t libs/imkl/mkl/lib/em64t/libmkl_intel_lp64.a -Wl,--start-group libs/imkl/mkl/lib/em64t/libmkl_intel_thread.a libs/imkl/mkl/lib/em64t/libmkl_core.a -Wl,--end-group libs/imkl/mkl/lib/em64t/libguide.a -lpthread -lm

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page