有没有办法获取liblapack.a的版本?
Is there a way to obtain the version of liblapack.a?
我通过使用 cmake 编译安装了 lapack 3.4.2 和 3.5.0。在我的 lapack 3.5.0 安装目录中,我找到一个文件 ./pkgconfig/lapack.pc
说 Version: 3.4.2
。所以我不确定我是否真的在那里安装了 lapack 3.5.0。
有没有办法直接从库liblapack.a(或Windows下的LAPACK.lib)获取lapack的版本?例如来自库中的例程或使用特定工具?
lapack 功能 ilaver()
为您量身打造!
它的原型是不言自明的:
subroutine ilaver ( integer VERS_MAJOR,
integer VERS_MINOR,
integer VERS_PATCH
)
这里有两个演示如何使用它的程序:
在一个fortran程序中,由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
在c程序中,由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);
}
如果你不想编译任何东西,你可以在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
我通过使用 cmake 编译安装了 lapack 3.4.2 和 3.5.0。在我的 lapack 3.5.0 安装目录中,我找到一个文件 ./pkgconfig/lapack.pc
说 Version: 3.4.2
。所以我不确定我是否真的在那里安装了 lapack 3.5.0。
有没有办法直接从库liblapack.a(或Windows下的LAPACK.lib)获取lapack的版本?例如来自库中的例程或使用特定工具?
lapack 功能 ilaver()
为您量身打造!
它的原型是不言自明的:
subroutine ilaver ( integer VERS_MAJOR,
integer VERS_MINOR,
integer VERS_PATCH
)
这里有两个演示如何使用它的程序:
在一个fortran程序中,由
编译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
在c程序中,由
编译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); }
如果你不想编译任何东西,你可以在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