- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have some fortran code that has a pure function making calls to the lapack library (in particular, zgetrf and zgetrs), but then I was getting the following error:
Any procedure referenced in a PURE procedure, including one referenced via a defined operation or assignment, must have an explicit interface and be declared PURE. [ZGETRF]
call zgetrf(N, N, Mat, N, ipiv, info)
This led me to search and discover that MKL has an interface for lapack and/or it's own definitions of the library (I'm still confused on what it actually does have after reading through the documentation)
Anyway, I've trying a couple things: first I tried this tool to use mkl which led me to have
ifort -mkl
LIBS += -L${MKLROOT}/lib -Wl,-rpath,${MKLROOT}/lib -lmkl_rt -lpthread -lm -ldl
This compiled fine and I made an external call DGESV more or less following this example .
However, when I was going back to trying the functions I need to use, I was getting the same error.
Then I tried following the documentation here (page 57 in particular, relating to the Fortran 95 Interface). Which I followed the steps of making the interface and removed the previous flags above and added the following flags:
MKLROOT = ~/Documents/projects/mkl-lapack
LIBS += -I${MKLROOT}/include/intel64/lp64 -L${MKLROOT}/lib -libmkl_lapack95_lp64
Once again it compiled fine, but then I got the same error as stated above.
At this point, I think I'm getting lost in the documentation and after reading this post, one of the comments does describe that mkl is it's own math library.
So my question is how do I properly link to the routines ZGETRF and ZGETRS such that it can work within a pure function either from lapack or mkl.
Any help is appreciated, thank you!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You probably did not include a "USE LAPACK95" statement in the source file of your pure procedure/function from which calls are made to ZGETRF/ZGETRS. The lapack95.mod file is generated from the source file lapack.f90 in the MKL include directory, and contains PURE attributes in the interfaces of those routines for which that attribute is applicable.
If, instead, you used the include file mkl_lapack.fi, that would not work since that file is intended for use with Fortran-77, and the PURE attribute was not available in that version of Fortran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So after adding the "use lapack95" to my file I got an error of "library not loaded : @rpath/libmkl_intel_lp64.dylib" which then looking into my lib directory I noticed the files are for .a files. Forgot to mention that I'm working on a Mac OSX machine.
I tried seeing if there was a "make dylibintel64 ..." option for making the lapack interface which doesn't seem to work or be in the documentation. I also tried adding a -dynamiclib flag into the makefile of the mkl lapack interface, but that just produced errors. Is there a way to properly compile the libraries so make can access them?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The last Mac that I had ran OS7.6, so I have zero experience with those aspects of OSX that differ from their Linux/Unix counterparts.
For several years now, MKL has come with the BLAS95 and Lapack libraries pre-built for use with Intel compilers, so you should not need to build *95* MKL libraries yourself. Simply follow the MKL Link Line Advisor for your setup, and link using the command line that it provides.
If, for some reason, you do build those libraries, you should not corrupt the makefile with incorrect alterations. For instance, the linker flag -llibxyz would initiate a search for a library file with the name liblibxyz.a .
I think that you did make some progress, in that you are now seeing linker errors instead of compilation errors.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Could you please share your minimal reproducible code sample?
Also, kindly specify your macOS version and oneAPI/parallel studio version.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Just a quick reminder to share the above details.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have not heard back from you. So, I will close this thread. Feel free to post a new question if you require further assistance from Intel.
Thanks,
Rahul
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page