Dear LAM users,
I installed LAM on my dual-xeon Linux box as root, then logged in as a
common user.
Firstly, I "export PATH=$PATH:/opt/lam/bin". "mpif77 -showme" gives the
following
ifort -I/opt/lam/include -pthread -L/opt/lam/lib -llamf77mpi -lmpi -llam
-lutil
Then I compiled my first MPI program (attached below) using "mpif77
first.f90".
I got:
/usr/bin/ld:first.f90: file format not recognized; treating as linker script
/usr/bin/ld:first.f90:1: parse error
collect2: ld returned 1 exit status
mpif77: No such file or directory
Seems mpif77 is trying to call g77 to compile my free-format F90 program.
But I did "export FC=ifort" before I compile lam.
Anyway, I "export LAMHF77=ifort". This time I got:
/tmp/ifortI9TJ6x.o(.text+0x21): In function `MAIN__':
: undefined reference to `mpi_init_'
/tmp/ifortI9TJ6x.o(.text+0x35): In function `MAIN__':
: undefined reference to `mpi_comm_rank_'
/tmp/ifortI9TJ6x.o(.text+0x49): In function `MAIN__':
: undefined reference to `mpi_comm_size_'
/tmp/ifortI9TJ6x.o(.text+0x62): In function `MAIN__':
: undefined reference to `mpi_type_contiguous_'
/tmp/ifortI9TJ6x.o(.text+0x71): In function `MAIN__':
: undefined reference to `mpi_type_commit_'
/tmp/ifortI9TJ6x.o(.text+0xd6): In function `MAIN__':
: undefined reference to `mpi_send_'
/tmp/ifortI9TJ6x.o(.text+0x12f): In function `MAIN__':
: undefined reference to `mpi_recv_'
/tmp/ifortI9TJ6x.o(.text+0x208): In function `MAIN__':
: undefined reference to `mpi_finalize_'
Seems the libmpi.a is not linked.
What may cause the above error messages?
Thanks in advance.
YY Sun
===============================================
first.f90
===============================================
PROGRAM MAIN
include "mpif.h"
INTEGER :: ierr,irank,nproc,ides,itag,i
INTEGER :: istat(MPI_STATUS_SIZE)
DOUBLE COMPLEX :: pi
DOUBLE PRECISION :: a,b,tmp
a=4.0
b=1.0
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD,irank,ierr)
call MPI_COMM_SIZE(MPI_COMM_WORLD,nproc,ierr)
call MPI_TYPE_CONTIGUOUS(2,MPI_DOUBLE_PRECISION,MPI_DOUBLE_COMPLEX,ierr)
call MPI_TYPE_COMMIT(MPI_DOUBLE_COMPLEX,ierr)
IF (irank.NE.0) THEN
ides=0
itag=irank
tmp=a*ATAN(b)
pi=CMPLX(tmp,tmp+b)
call MPI_SEND(pi,1,MPI_DOUBLE_COMPLEX,ides,itag,MPI_COMM_WORLD,ierr)
ELSE
DO i=1,nproc-1
itag=i
call
MPI_RECV(pi,1,MPI_DOUBLE_COMPLEX,MPI_ANY_SOURCE,itag,MPI_COMM_WORLD,istat,ierr)
print *, 'message from process ',i
print *, ' pi = ',pi
END DO
END IF
call MPI_FINALIZE(ierr)
END PROGRAM MAIN
_________________________________________________________________
Download games, logos, wallpapers and lots more at MSN Mobile!
http://www.msn.com.sg/mobile/
|