我正在尝试编译库AGMG。
并行示例的 make 文件如下所示:
# MPIopt = -I/... (where to find mpif.h)
# MUMPSPopt = -I/... (where to find files to be included by
# applications using MUMPS)
# MUMPSlib = -l... (link reference for MUMPS)
# SCALAP = -l... (link reference for SCALAPACK, needed by MUMPS)
# BLASLAPACK= -l... (link reference for LAPACK & BLAS)
# MPIlib = -l... (link reference for MPI)
在我的 Debian mpif.h 上找到:
$ ls /usr/lib/openmpi/include/mpi.h
/usr/lib/openmpi/include/mpi.h
所以我在 Makefile 中写道:
MPIopt = -I/usr/lib/openmpi/include/
MPIlib = -lmpi
但是,当我尝试编译时,我得到以下错误:
:~/AGMG_3.0/Example_par$ make
cd ../SRC;make dpar
make[1]: Entering directory `AGMG_3.0/SRC'
make[1]: Nothing to be done for `dpar'.
make[1]: Leaving directory `AGMG_3.0/SRC'
gfortran-4.4 -O4 -o Example_par Example_par.o ../SRC/dagmg_par.o -lmpi
Example_par.o: In function `MAIN__':
Example_par.f90:(.text+0x77): undefined reference to `mpi_init_'
....
....
....
dagmg_par.f90:(.text+0x19fc9): undefined reference to `mpi_comm_rank_'
dagmg_par.f90:(.text+0x19fdd): undefined reference to `mpi_comm_size_'
collect2: ld returned 1 exit status
make: *** [Example_par] Error 1
我现在很困惑,我尝试过成功的尝试,但是我遇到了 scaplap 和其他要求的问题。发现鳞片:
$ dpkg -L libscalapack-mpi-dev
/.
/usr
/usr/lib
/usr/lib/libscalapack-openmpi.a
mumps 在 /usr/lib/libsmumps.a 中找到,头文件在 /usr/include/smumps_c.h
那么我该如何把所有这些放在一起呢?
我知道对于更高级的 fortran 或 C 开发人员来说,这将是微不足道的......
在此先感谢您的帮助。
编辑:我把完整的 Makefile 定义放在这里,希望它可以帮助其他人:
MPIopt = -I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib -L/usr/lib/openmpi/lib -pthread
MPIlib = -lmpi_f90 -lmpi_f77 -lmpi
MUMPSPopt = -I/usr/lib/libsmumps.a -I/usr/lib/libdmumps.a
MUMPSlib = -lsmumps -ldmumps
BLASLAPACK=-L/usr/lib -llapack -lblas
BLASLAPACK=-L/usr/lib -llapack -lblas
SCALAP = -L/usr/lib/libscalapack-openmpi.a -lscalapack-openmpi
F90=gfortran-4.6
这构建了它。感谢您的回复!