c***@gmail.com
2008-05-11 14:40:45 UTC
Hello guys...I've browse the internet to find some answers but
useless...I hope you can help me...I've installed Visual Studio 2005
and Intel Fortran Compiler 10 in Windows XP...No problems with the
instalations...
I've tryed to run the first program i've found in the book USING MPI
(http://www-unix.mcs.anl.gov/mpi/usingmpi/usingmpi-1st/index.html) but
it give me an error "Error 1 error LNK2019: unresolved external symbol
_MPI_INIT referenced in function _MAIN__ pi.obj
"
...The program is:
program main
include 'mpif.h'
double precision PI25DT
parameter (PI25DT = 3.141592653589793238462643d0)
double precision mypi, pi, h, sum, x, f, a
integer n, myid, numprocs, i, rc
c function to integrate
f(a) = 4.d0 / (1.d0 + a*a)
call MPI_INIT( ierr )
call MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
print *, "Process ", myid, " of ", numprocs, " is alive"
sizetype = 1
sumtype = 2
10 if ( myid .eq. 0 ) then
write(6,98)
98 format('Enter the number of intervals: (0 quits)')
read(5,99) n
99 format(i10)
endif
call MPI_BCAST(n,1,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
c check for quit signal
if ( n .le. 0 ) goto 30
c calculate the interval size
h = 1.0d0/n
sum = 0.0d0
do 20 i = myid+1, n, numprocs
x = h * (dble(i) - 0.5d0)
sum = sum + f(x)
20 continue
mypi = h * sum
c collect all the partial sums
call MPI_REDUCE(mypi,pi,1,MPI_DOUBLE_PRECISION,MPI_SUM,0,
$ MPI_COMM_WORLD,ierr)
c node 0 prints the answer.
if (myid .eq. 0) then
write(6, 97) pi, abs(pi - PI25DT)
97 format(' pi is approximately: ', F18.16,
+ ' Error is: ', F18.16)
endif
goto 10
30 call MPI_FINALIZE(rc)
stop
end
...I found the mpif.h (pi.f and mpif.h could be found at this addres
ftp://info.mcs.anl.gov/pub/mpi/usingmpi-1st/examples/simplempi/ )and i
put it in project directory...but it seems that this is not
enough...Looks like it needs more linked files...
Then i've changed the mpif.h file that came with the program and i've
put the mpih.h file that i've found after I installed the MPICH found
at http://www-unix.mcs.anl.gov/mpi/mpich1/mpich-nt/...Now the program
compile but when i try to run the exe file it give me this error
"MPI_COMM_RANK : Null communicator"....A need some help...Thank you
useless...I hope you can help me...I've installed Visual Studio 2005
and Intel Fortran Compiler 10 in Windows XP...No problems with the
instalations...
I've tryed to run the first program i've found in the book USING MPI
(http://www-unix.mcs.anl.gov/mpi/usingmpi/usingmpi-1st/index.html) but
it give me an error "Error 1 error LNK2019: unresolved external symbol
_MPI_INIT referenced in function _MAIN__ pi.obj
"
...The program is:
program main
include 'mpif.h'
double precision PI25DT
parameter (PI25DT = 3.141592653589793238462643d0)
double precision mypi, pi, h, sum, x, f, a
integer n, myid, numprocs, i, rc
c function to integrate
f(a) = 4.d0 / (1.d0 + a*a)
call MPI_INIT( ierr )
call MPI_COMM_RANK( MPI_COMM_WORLD, myid, ierr )
call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
print *, "Process ", myid, " of ", numprocs, " is alive"
sizetype = 1
sumtype = 2
10 if ( myid .eq. 0 ) then
write(6,98)
98 format('Enter the number of intervals: (0 quits)')
read(5,99) n
99 format(i10)
endif
call MPI_BCAST(n,1,MPI_INTEGER,0,MPI_COMM_WORLD,ierr)
c check for quit signal
if ( n .le. 0 ) goto 30
c calculate the interval size
h = 1.0d0/n
sum = 0.0d0
do 20 i = myid+1, n, numprocs
x = h * (dble(i) - 0.5d0)
sum = sum + f(x)
20 continue
mypi = h * sum
c collect all the partial sums
call MPI_REDUCE(mypi,pi,1,MPI_DOUBLE_PRECISION,MPI_SUM,0,
$ MPI_COMM_WORLD,ierr)
c node 0 prints the answer.
if (myid .eq. 0) then
write(6, 97) pi, abs(pi - PI25DT)
97 format(' pi is approximately: ', F18.16,
+ ' Error is: ', F18.16)
endif
goto 10
30 call MPI_FINALIZE(rc)
stop
end
...I found the mpif.h (pi.f and mpif.h could be found at this addres
ftp://info.mcs.anl.gov/pub/mpi/usingmpi-1st/examples/simplempi/ )and i
put it in project directory...but it seems that this is not
enough...Looks like it needs more linked files...
Then i've changed the mpif.h file that came with the program and i've
put the mpih.h file that i've found after I installed the MPICH found
at http://www-unix.mcs.anl.gov/mpi/mpich1/mpich-nt/...Now the program
compile but when i try to run the exe file it give me this error
"MPI_COMM_RANK : Null communicator"....A need some help...Thank you