Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.

C Interface to LAPACK Proposal

Todd_R_Intel
Employee
1,561 Views

A proposal for a C interface to LAPACK was put together by Michael Chuvelev and Greg Henry of Intel Corporation on 30 September, 2008. Both are members of the Intel Math Kernel Library team. It is our desire that this early draft attract other folks in the numerical analysis community who would like to collaborate on a joint proposal offered to the larger community. We are open to both collaboration and generic feedback, both of which can be done by using the e-mail addresses given at the top of the document attached. We require permission to use feedback, so please let us know if we have your permission. After initial feedback and collaboration is decided upon, the preamble in the document would be removed, and each authors affiliation (as footnotes) and e-mail (if desired) would be used instead.

From the document:

Introduction

This proposal details a C interface to LAPACK in many ways consistent with the C interface to the Legacy BLAS (CBLAS). This documents format and contents are based on the C interface to the Legacy BLAS document. There have been several prior proposals for a C interface for LAPACK, but these are all vastly different from the CBLAS. For instance, the CLAPACK, available at NetLib (http://www.netlib.org) has a FORTRAN interface with C source, and is useful for those who want to build LAPACK but dont have a FORTRAN compiler. Remi Delmas has another proposal at http://icl.cs.utk.edu/~delmas/lapwrapc.html, but it doesnt support matrices in row major order such as is done in the CBLAS and in most C programs.


UPDATE
: The proposal has been updated to include an API that allows user management of work arrays. Minor fixes have also been made and exceptions to a few rules have been called out.

UPDATE 6/11/2010: The document has change considerably to include contributions from members of the LAPACK team. This interface is now a part of Intel MKL 10.3 Beta.

0 Kudos
13 Replies
bo-gao
Beginner
1,561 Views

Will MKL ever consider adding a C++ class library for matrices and vectors? It would make everything much cleaner and easier to use.

Why should a user worry about whether a matrix is stored as a Fortran or C array? It is just a waste of time.

Scientific computing needs a C++ standard for matrices and vectors, and I hope Intel would help to promote it.

0 Kudos
Shane_S_Intel
Employee
1,561 Views
Quoting - bo-gao

Will MKL ever consider adding a C++ class library for matrices and vectors? It would make everything much cleaner and easier to use.

Why should a user worry about whether a matrix is stored as a Fortran or C array? It is just a waste of time.

Scientific computing needs a C++ standard for matrices and vectors, and I hope Intel would help to promote it.

We have had feature requests for C++ class libraries. The effort associated with doing this work is considerable and the impact to performance not always positive. This may be a feature we consider adding toMKL in the future, but we do not have concrete plansto add itat this time. If you have specific feedbackon this proposal, namely a C interface for LAPACK, please provide it to the authors.

Thanks, Shane

0 Kudos
shachris23
New Contributor I
1,561 Views

We have had feature requests for C++ class libraries. The effort associated with doing this work is considerable and the impact to performance not always positive. This may be a feature we consider adding toMKL in the future, but we do not have concrete plansto add itat this time. If you have specific feedbackon this proposal, namely a C interface for LAPACK, please provide it to the authors.

Thanks, Shane

Hi Shane,

I believe that it probably would be more practical if Intel MKL developers make an official support for one of the many existing C++ matrix libraries. I believe the criteria for picking the matrix/vector should be:

1) Actively maintained and well-known.

2) Should be well designed

I have read through so many C++ matrix implementations, and I think Boost::uBlas implementation is probably the most logical choice for Intel to pick. I believe uBlas matches the above critierias mentioned. Also, we all know that Boost library is the library that has the most chance of being integrated into the C++ standard. I dont think Intel could go wrong with picking Boost.

just my 2 cents.

0 Kudos
Todd_R_Intel
Employee
1,561 Views
The proposal (attached above) has been updated to include an API that allows user management of work arrays. Also, exceptions to a few rules have been called out and minor fixes made.

-Todd

0 Kudos
harold_bien
Beginner
1,561 Views
Just a quick suggestion that's not directly related - instead of using C++ OOP, have you considered using specific C++ features such as function overloading to make the interface much easier to use as opposed to prefixing the functions with the data type? This would then also permit, for example, the use of template functions to call "C-based" LAPACK. This should not have any performance impact if implemented as inline function calls, a la IPP C++ interface (which, by the way, should be publicized much more and integrated into the official documentation as opposed to simply being an "example").
0 Kudos
Jianshi_Huang
Beginner
1,561 Views
Hi Todd,

I'd like to know when the C interface would be available. Will the source code also be available?

We definitely want to use the C interface but since some platforms we need to support does not have Intel MKL so it will not be very useful if the source can not be used to build with other LAPACK implementations.


Cheers,
Jianshi


Quoting - Todd Rosenquist (Intel)

A proposal for a C interface to LAPACK was put together by Michael Chuvelev and Greg Henry of Intel Corporation on 30 September, 2008. Both are members of the Intel Math Kernel Library team. It is our desire that this early draft attract other folks in the numerical analysis community who would like to collaborate on a joint proposal offered to the larger community. We are open to both collaboration and generic feedback, both of which can be done by using the e-mail addresses given at the top of the document attached. We require permission to use feedback, so please let us know if we have your permission. After initial feedback and collaboration is decided upon, the preamble in the document would be removed, and each authors affiliation (as footnotes) and e-mail (if desired) would be used instead.

UPDATE: The proposal has been updated to include an API that allows user management of work arrays. Minor fixes have also been made and exceptions to a few rules have been called out.

From the document:

Introduction

This proposal details a C interface to LAPACK in many ways consistent with the C interface to the Legacy BLAS (CBLAS). This documents format and contents are based on the C interface to the Legacy BLAS document. There have been several prior proposals for a C interface for LAPACK, but these are all vastly different from the CBLAS. For instance, the CLAPACK, available at NetLib (http://www.netlib.org) has a FORTRAN interface with C source, and is useful for those who want to build LAPACK but dont have a FORTRAN compiler. Remi Delmas has another proposal at http://icl.cs.utk.edu/~delmas/lapwrapc.html, but it doesnt support matrices in row major order such as is done in the CBLAS and in most C programs.


0 Kudos
Gregory_H_Intel
Employee
1,561 Views

I probably cannot say when the C Interface to LAPACK will be available, but I can tell you that we are actively engaged with discussions with the LAPACK group on it, as well as actively involved with its development. Also, it is our hope to post a reference version of this interface to NETLIB, so that it will be freely available to developers on all platforms, including those that Intel MKL does not yet support.

0 Kudos
Jianshi_Huang
Beginner
1,561 Views

I probably cannot say when the C Interface to LAPACK will be available, but I can tell you that we are actively engaged with discussions with the LAPACK group on it, as well as actively involved with its development. Also, it is our hope to post a reference version of this interface to NETLIB, so that it will be freely available to developers on all platforms, including those that Intel MKL does not yet support.


I see. That will be helpful.


0 Kudos
Rhys_Ulerich
New Contributor I
1,561 Views
All-in-all the proposal looks quite good. I appreciate the effort you've all put in. This will help me immensely.

I disagree with the choice of using const chars instead of enums to handle the concepts on page 2. Using enums is consistent with CBLAS, preserves type information, and allows sophisticated IDES/editors to autocomplete appropriate choices. Selecting const char fails on all three counts.

The argument that "...[const char] also allows for the simplest conversion from the FORTRAN codes" certainly holds, but I doubt that the main user of your C LAPACK standard will be someone porting existing Fortran code.

Anyone who's sophisticated enough to dig through LAPACK routine naming conventions is sophisticated enough to dig through a couple of enums.

- Rhys
0 Kudos
UL_HPC_Sysadmins
Beginner
1,561 Views

fyi. MKL is one of many LAPACKE-compatible Linear Algebra libraries provided automatically via EasyBuild [1], nominally the fastest one on Intel-derived hardware.

Let's hope that people will eventually find the value of delivering the interfaces in automated ways, and standardize across defined namespaces, eg. using $EBROOTIMKL in their Makefiles, writing easyconfigs for reproducible builds across many platforms etc; as you can see it is very trivial to deliver all possible MKL interfaces in a very automated way:

fgeorgatos@e-cluster1-10:~$ module av imkl

------------------ /opt/apps/HPCBIOS.20130715/modules/all ------------------
imkl/10.2.6.038 imkl/10.3.6.233 imkl/11.0.3.163
imkl/10.3.10.319 imkl/11.0.1.117 imkl/11.0.4.183
imkl/10.3.12.361 imkl/11.0.2.146 imkl/11.0.5.192
fgeorgatos@e-cluster1-10:~$

enjoy, F.

[1] http://hpcugent.github.io/easybuild/

0 Kudos
SergeyKostrov
Valued Contributor II
1,561 Views
The thread poped up a couple days ago from "archives" and I think it makes sense to continue discussion. >>Will MKL ever consider adding a C++ class library for matrices and vectors? It would make everything much cleaner and >>easier to use. >> >>Why should a user worry about whether a matrix is stored as a Fortran or C array? It is just a waste of time. >> >>Scientific computing needs a C++ standard for matrices and vectors, and I hope Intel would help to promote it. My question is: Are there any C/C++ libraries ( also could be called as C/C++ wrappers ) around MKL C-like functions? Thanks.
0 Kudos
Ying_H_Intel
Employee
1,561 Views

Hi Sergey and all,

Thank you for bring the topic discussion back.  Just update the current status:

C Interface to Lapack is avaiable in MKL 10.3.  Please see the article http://software.intel.com/en-us/articles/c-interface-support-for-lapack

and the below is a few existing open source C++ template libraries list  we collect.  The C++ library can be linked with Intel® MKL and allows using highly abstracted C++ classes to perform matrix/vector operations, linear algebra factorizations etc. achieving about the same performance as MKL library provides.

http://software.intel.com/en-us/articles/intelr-mkl-and-c-template-libraries.

You are welcomed to add the list if you know more.

Best Regards,

Ying

0 Kudos
SergeyKostrov
Valued Contributor II
1,561 Views
>>...C Interface to Lapack is avaiable in MKL 10.3. Please see the article >>http://software.intel.com/en-us/articles/c-interface-support-for-lapack >>... >>http://software.intel.com/en-us/articles/intelr-mkl-and-c-template-libraries. >>... Thanks, Ying and I take a look.
0 Kudos
Reply