I made several wrappers to LAPACK, so I am basically familiar with the mechanism of calling Fortran based LAPACK programs from Julia. I would like to call now subroutines from another Fortran library (called SLICOT), which heavily relies on LAPACK and BLAS calls. I wonder if this is possible, relying on the already compiled LAPACK and BLAS codes used inside Julia. I would like to avoid compiling LAPACK and BLAS as separate libraries (which I guess would be possible).
I thank in advance for any hint on how to approach this problem. And sorry if such a question has been already answered.
You will need to build a library of the “slicot” package anyway. At least in linux, the inclusion of lapack or blas libraries in that process reduces to adding a flag to the compilation (-llapack and -lblas, if I remember well) because these libraries can be installed, already compiled, with standard package managers. With that in place, I do not think there is any more practical alternative than that.
Is there any specific scenario in which this does not seem a good alternative?
In Julia, you need to call a library routine using ccall, for example,
ccall((function_name, library), ...
Here 'library is the name of my library, say SLICOT, and function_nameis the name of the routine. But, I wonder how the internal calls to LAPACK are resolved and where the information on the Julia library "libopenblas64_" (which contains the LAPACK library routines in the directoryjulia\bin` on my Windows computer) can be provided.
subroutine uselapack(M,A)
implicit none
double precision :: M(4,4), A(4)
! For dsyev
double precision :: work(12)
integer :: info
! Computing the eigenvalues 'A' and eigenvectors 'M' of the M matrix
call dsyev('V','U',4,M,4,A,work,12,info)
end subroutine uselapack
In the long run it would be nice to have a Yggdrasil build script for SLICOT, which could automatically build a SLICOT_jll package with precompiled binaries for every Julia platform. Given this, it would be much easier to build Julia packages on top of SLICOT, maybe starting with a SLICOT.jl package to provide some higher-level interfaces.
(There was an early Slicot.jl package from 6 years ago that started putting together SLICOT wrappers, but Julia has changed so much since 2014 that one would probably be better off mostly starting over.)
This is a very interesting information. Incidentaly, today, the NICONET association, who cares for SLICOT, decided to follow my proposal and make the last version of SLICOT, an open software under a MIT licence (similar to LAPACK) in GITHUB. Until now, only version 4.5 was in GITHUB under a GPL license.
I am also interested in exactly the same library (namly SLICOT). But i just started to play around with wrapping of c/fortran libraries in julia. Can you please provide an Link to the information NICONET wants tp make the last version of SLICOT an open software under a MIT licence? Thanks in advance. Thanks also for the information already posted here.