2014-12-03 64 views
0

当我这样做:编译问题例如ScaLAPACK的应用

mpif77 example1.f -L scalapack/scalapack-1.8.0/ -lscalapack -L scalapack/blacs/BLACS/LIB -l:blacsF77init_MPI-LINUX-0.a -l:blacs_MPI-LINUX-0.a -l:blacsF77init_MPI-LINUX-0.a -L scalapack/blas/BLAS/ -l:blas_LINUX.a -L scalapack/lapack/ -llapack -L/cm/shared/apps/gcc/4.4.6/lib64/ -lgfortran 

我得到:

scalapack//blas_LINUX.a(xerbla.o): In function `xerbla_': 
xerbla.f:(.text+0x66): undefined reference to `_gfortran_transfer_character_write' 
xerbla.f:(.text+0x76): undefined reference to `_gfortran_transfer_integer_write' 
collect2: ld returned 1 exit status 

难道是用的东西在其中库链接的顺序?

How to Run Example Program Using MPI

回答

1

它链接错误。这些依赖性通常是在为库和可执行文件使用不同的fortran编译器时才产生的(f77,f90)。尝试使用mpif90来编译您的示例。

您可以测试使用:

$ mpif77 --showme 
gfortran -I/usr/lib/openmpi/include -pthread -L/usr/lib -L/usr/lib/openmpi/lib -lmpi_f77 -lmpi -ldl -lhwloc 
$ mpif90 --showme 
gfortran -I/usr/lib/openmpi/include -pthread -L/usr/lib -L/usr/lib/openmpi/lib -lmpi_f90 -lmpi_f77 -lmpi -ldl -lhwloc 

唯一的区别是-lmpi_f90