- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a function implemented in e.g. myfunc.f and this implementation invokes lapack functions e.g. DGEQRF, how can I ensure that the linking is done with MKL?
My ultimate goal is to reuse some fortran functions (QR update) from C and that all the invokations they do to e.g. LAPACK end up hitting MKL.
I am using cmake and this is what I do but I am not sure it is actually linking to MKL ... can anyone please confirm this is all I need to do to ensure that these fortran utilities are linked to MKL?
# >>>>>>>>>>>>>>> begin snippet CMakeLists.txt
set(HAVE_INTEL_MKL ${MKL_FOUND})
if (MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
link_directories(${MKL_LIBRARY_DIRS})
endif()
add_library(qr_updates
src/addcols.f
src/addcolsq.f
src/delcols.f
src/delcolsq.f
)
if (MKL_FOUND)
target_link_libraries(qr_updates ${MKL_LIBRARIES})
endif()
# <<<<<<<<<<<<<<<< end snippet CMakeLists.txt
TIA,
Best regards,
Giovanni
I have a function implemented in e.g. myfunc.f and this implementation invokes lapack functions e.g. DGEQRF, how can I ensure that the linking is done with MKL?
My ultimate goal is to reuse some fortran functions (QR update) from C and that all the invokations they do to e.g. LAPACK end up hitting MKL.
I am using cmake and this is what I do but I am not sure it is actually linking to MKL ... can anyone please confirm this is all I need to do to ensure that these fortran utilities are linked to MKL?
# >>>>>>>>>>>>>>> begin snippet CMakeLists.txt
set(HAVE_INTEL_MKL ${MKL_FOUND})
if (MKL_FOUND)
include_directories(${MKL_INCLUDE_DIRS})
link_directories(${MKL_LIBRARY_DIRS})
endif()
add_library(qr_updates
src/addcols.f
src/addcolsq.f
src/delcols.f
src/delcolsq.f
)
if (MKL_FOUND)
target_link_libraries(qr_updates ${MKL_LIBRARIES})
endif()
# <<<<<<<<<<<<<<<< end snippet CMakeLists.txt
TIA,
Best regards,
Giovanni
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Giovanni,
We usually use makefile, seldom use cmake to build MKL application. But i guess the compile and link model should be same.
A simplecommand to build a mkl application is like
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE -lmkl_solver_lp64_sequential.a
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_sequential.a
-lmkl_core.a-l-l-l -Wl,--end-group -lpthread
static linking of user code myprog.f, sequential version of sparse solver, and
sequential Intel MKL supporting LP64 interface.
You may modify themaccording to cmake syntax.
Some doc for your reference:
1. Intel Math Kernel Library Link Line Advisor
3. Linking Applications With Intel MKL Version 10.0
And mkl lapack fortran example and build custom dll example are under MKL install directory:
for example,
C:\Program Files (x86)\Intel\Composer XE 2011 SP1\mkl\tools\builder
C:\Program Files (x86)\Intel\Composer XE 2011 SP1\mkl\examples
Hope it helps,
Ying H.
We usually use makefile, seldom use cmake to build MKL application. But i guess the compile and link model should be same.
A simplecommand to build a mkl application is like
ifort myprog.f -L$MKLPATH -I$MKLINCLUDE -lmkl_solver_lp64_sequential.a
-Wl,--start-group -lmkl_intel_lp64.a -lmkl_sequential.a
-lmkl_core.a-l-l-l -Wl,--end-group -lpthread
static linking of user code myprog.f, sequential version of sparse solver, and
sequential Intel MKL supporting LP64 interface.
You may modify themaccording to cmake syntax.
Some doc for your reference:
1. Intel Math Kernel Library Link Line Advisor
3. Linking Applications With Intel MKL Version 10.0
And mkl lapack fortran example and build custom dll example are under MKL install directory:
for example,
C:\Program Files (x86)\Intel\Composer XE 2011 SP1\mkl\tools\builder
C:\Program Files (x86)\Intel\Composer XE 2011 SP1\mkl\examples
Hope it helps,
Ying H.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Ying,
Thank you for your answer.
I managed to get it working using CMake can call third party fortran routines from my C and those routines end up invoking MKL no problems.
Best Regards,
Giovanni
Thank you for your answer.
I managed to get it working using CMake can call third party fortran routines from my C and those routines end up invoking MKL no problems.
Best Regards,
Giovanni
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