安装Fortran库Expokit(Windows / Ubuntu)

时间:2018-07-03 20:16:54

标签: fortran cygwin gfortran

我正在寻找执行矩阵指数的方法,这显然适合于Expokit库。遗憾的是,与Lapack或OpenMP不同,它很难从Cygwin或Mingw for Windows安装。因此,我从here下载了该库,但是一旦解压缩,它就完全由.f文件组成,几乎没有使用它们的指导。我在网上找到的唯一网站没有多用(Fortran Wiki),因为它没有任何迹象表明Expokit库是如何链接的。

对于在Windows上安装Expokit的任何指导,如果在Windows不适合的情况下在Ubuntu上安装Expkit,我将不胜感激。

进行成熟的建议更改并在Ubuntu上运行'make sample_d',我得到如下所示的日志。我认为这意味着示例已成功编译,但是我不知道这如何使我能够将Expokit用作Fortran程序中的库。有人可以为此提供指导吗?

XX:~/programs/expokit/expokit/fortran$ make sample_d
f77 -O3 -c blas.f
blas.f:404:72:

    10 assign 30 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:409:19:

    20    go to next,(30, 50, 70, 110)
                   1
Warning: Deleted feature: Assigned GOTO statement at (1)
blas.f:411:72:

       assign 50 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:420:72:

       assign 70 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:427:72:

       assign 110 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1621:72:

    10 assign 30 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1628:19:

          go to next,(30, 50, 70, 90, 110)
                   1
Warning: Deleted feature: Assigned GOTO statement at (1)
blas.f:1630:72:

       assign 50 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1639:72:

       assign 70 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1644:72:

   100 assign 110 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1671:72:

    85 assign 90 to next
                                                                        1
Warning: Deleted feature: ASSIGN statement at (1)
blas.f:1689:16:

       go to next,(  50, 70, 90, 110 )
                1
Warning: Deleted feature: Assigned GOTO statement at (1)
f77 -O3 -c lapack.f
f77 -o sample_d sample_d.o clock.o expokit.o mataid.o blas.o lapack.o 

1 个答案:

答案 0 :(得分:1)

由于非标准格式语句,您的Fortran编译器无法编译文件sample_d.f。同一文件的源代码提供了在发生这种情况时如何修复该文件的说明:

 9001 format( <mprint>(1X,D11.4) )    
*--- Some compliers (e.g., g77) generate 'Unsupported FORMAT specifier' 
* with the specification above. In this case, simply use this form: 
* 9001 format( 5(1X,D11.4) )

如果您注释上方的第一行(添加*作为该行的第一个字符)而取消注释最后一行(删除开头的*),则错误应消失。


我认为运行make sample_d除了确保创建目标文件以及可以编译示例程序并将其链接以创建有效的二进制文件之外,没有什么特别的意义。 / p>

首先,您应该知道,您已经使用它们的Makefile调用案例3编译了Expokit和示例程序,其中所需的BLAS和LAPACK子例程分别由文件blas.o和lapack.o提供。从Expokit提供的.f对等文件中获取。

# Among the 3 possibilities below, uncomment the appropriate
# case for your environment and comment the others.

# case 1: works when LAPACK and BLAS are installed.
OBJLIBS =
LIBS    = -llapack -lblas

# case 2: works when LAPACK is not installed but BLAS is.
#LIBS    = -lblas
#OBJLIBS = lapack.o

# case 3: works when neither LAPACK nor BLAS are installed.
#OBJLIBS = blas.o lapack.o
#LIBS   =

如果您的系统已经具有BLAS和LAPACK库,则它们很可能比blas.o和lapack.o中的库更优化,您可能需要更改Makefile中的大小写(添加/删除前导{{ 1}}来注释/取消注释#OBJLIBS)的适当定义,以便您可以使用系统BLAS和LAPACK。

为了在Fortran程序中使用Expokit,您需要从源代码中调用相关的子例程(请参阅Expokit论文以及expokit.f和mataid.f的源代码,以了解提供的子例程)然后最简单的方法是将以下内容添加到您的链接行中

  1. 目标文件:LIBS,后跟Expokit Makefile中活动expokit.o mataid.o变量中列出的所有目标文件(如果有);和
  2. 库:Expokit Makefile的活动OBJLIBS变量中列出的所有库(如果有的话)。