我正在編譯庫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