我正在编译库AGMG。编译使用mpi的库(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发现:
MPIopt = -I/usr/lib/openmpi/include/
MPIlib = -lmpi
:
$ ls /usr/lib/openmpi/include/mpi.h
/usr/lib/openmpi/include/mpi.h
所以我在Makefile中写道:
但是从来没有那么少,当我尝试编译时,出现以下错误:
:~/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 和其他要求的问题。 scalap发现:
$ dpkg -L libscalapack-mpi-dev
/.
/usr
/usr/lib
/usr/lib/libscalapack-openmpi.a
腮腺炎在/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
这建立它。谢谢你的回复!
谢谢!这告诉我如何去做! -L/Path/to/Library.a -llibName! – Oz123 2012-03-06 07:33:20