How to use the Lapack compatibility interface in C language

25 views
Skip to first unread message

Arturo Ges

unread,
Jul 10, 2023, 5:34:13 AM7/10/23
to SLATE User
Dear Slate users,

Is it possible to use the Lapack compatibility interface in C programs?
I have not find any header file that declares prototypes for functions such as "slate_dgemm".

We are targeting CPU only, using GCC or Intel icc, with MKL.
What header files shall we include? What are the flags that should be added in the compile command?

Thanks in advance!

Asim YarKhan

unread,
Jul 11, 2023, 8:50:29 AM7/11/23
to Arturo Ges, SLATE User
Hi Arturo,

Currently, there is no header file for the SLATE LAPACK API,

The LAPACK compatibility API can be used in the same way that one would use the Fortran LAPACK interface directly from C.
When using the Fortran interface directly, the Fortran function prototypes are usually declared with the desired name mangling.
For example, if the Fortran name mangling adds underscores, then the function definition (from C) would be
 int dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);

To use the SLATE compatibility API, you need to prepend the function declaration and call with "slate_"
int slate_dgetrf_(int *m, int *n, double *a, int *lda, int *ipiv, int *info);
This will call the SLATE dgetrf implementation.

At link time, the SLATE libraries need to precede the MKL libraries. eg.
....  -lslate_lapack_api -lslate -llapackpp -lblaspp -lmkl_gf_lp64 -lmkl_sequential -lmkl_core

See the example in the SLATE repository at:
The comment lines at the top contain a suggestion of how to compile this example.

There is additional information in the README file here:

Regards,
Asim YarKhan



--
You received this message because you are subscribed to the Google Groups "SLATE User" group.
To unsubscribe from this group and stop receiving emails from it, send an email to slate-user+...@icl.utk.edu.
To view this discussion on the web visit https://groups.google.com/a/icl.utk.edu/d/msgid/slate-user/37ca1b21-9d43-498c-a857-774ca49d9aa0n%40icl.utk.edu.

Arturo Ges

unread,
Jul 12, 2023, 6:35:54 AM7/12/23
to SLATE User, Asim YarKhan, SLATE User, Arturo Ges
Hi Asim,

The information you provided has been very useful.

We started compiling the example with the minimum compile command, and introduced step by step the rest of our compiling environment and variables.

Our problem was that we were using a compiler wrapper that internally was adding Intel libs to the command line before the libs we were specifying in the Makefiles. We think that MKL was loaded before the compatibility library. We have corrected the order of libs and it is working.

Problem solved.
Thanks a lot!
Reply all
Reply to author
Forward
0 new messages