Caduchon
Caduchon

Reputation: 5231

Is there a way to obtain the version of liblapack.a?

I installed lapack 3.4.2 and 3.5.0 by compiling them with cmake. In my installation dir of lapack 3.5.0 I find a file ./pkgconfig/lapack.pc saying Version: 3.4.2. So I'm not sure I really installed lapack 3.5.0 there.

Is there a way to obtain the version of lapack directly form the lib liblapack.a (or LAPACK.lib under Windows) ? For example from a routine in the library or with a specific tool ?

Upvotes: 3

Views: 1730

Answers (2)

Daniel McDonald
Daniel McDonald

Reputation: 81

If you don't want to compile anything, you can do this in Python:

ATL-MBP-MAC4:~ dmcdonald$ python3
Python 3.4.2 (default, Jan 29 2015, 06:34:22) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> from ctypes.util import *
>>> lapack = CDLL(find_library("lapack"))
>>> major, minor, patch = c_int(), c_int(), c_int()
>>> lapack.ilaver(byref(major), byref(minor), byref(patch))
0
>>> print("{0}.{1}.{2}".format(major.value, minor.value, patch.value))
3.2.1

Upvotes: 2

francis
francis

Reputation: 9817

The lapack function ilaver() is made for you !

Its prototype is self-explaining :

subroutine ilaver   (   integer     VERS_MAJOR,
    integer     VERS_MINOR,
    integer     VERS_PATCH 
)   

Here are two programs demonstrating how to use it :

  • in a fortran program, complied by gcc main.f90 -o main -llapack

    PROGRAM VER
    IMPLICIT NONE
    
      INTEGER major, minor, patch
      CALL ilaver( major,minor, patch )
      WRITE(*,*) "LAPACK ",major,".",minor,".",patch
    END PROGRAM VER
    
  • In a c program, compiled by gcc main.c -o main -llapack

    #include <stdio.h>
    
    extern ilaver_(int* major,int* minor,int* patch);
    
    int main()
    {
    
        int major=0;
        int minor=0;
        int patch=0;
    
        ilaver_(&major,&minor,&patch);
    
        printf("lapack %d.%d.%d\n",major,minor,patch);
    }
    

Upvotes: 2

Related Questions