当我这样做的时候:
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
发布于 2014-12-03 16:05:12
It链接错误。当对库和可执行文件(f77、f90)使用不同的fortran编译器时,通常会出现这些依赖项。尝试使用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
https://stackoverflow.com/questions/27261934
复制相似问题