Discussion:
Problem compiling an MPI program
(too old to reply)
c***@gmail.com
2008-05-11 14:40:45 UTC
Permalink
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
Michael Hofmann
2008-05-13 13:59:07 UTC
Permalink
Post by c***@gmail.com
...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/
Don't mix header files from different MPI libraries. Just use the ones
coming with the installed library (mpich-nt).
Post by c***@gmail.com
...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
Have you followed the "Quick Start" guide?
http://www-unix.mcs.anl.gov/mpi/mpich1/docs/mpichntman/mpichntman.htm

Especially, "Configuring":
http://www-unix.mcs.anl.gov/mpi/mpich1/docs/mpichntman/node6.htm

and "Making and running an example":
http://www-unix.mcs.anl.gov/mpi/mpich1/docs/mpichntman/node7.htm


Michael
c***@gmail.com
2008-05-13 15:47:25 UTC
Permalink
Thank you Michael..Those links really help..Thanks
c***@gmail.com
2008-05-20 07:15:04 UTC
Permalink
Hi again...I compiled the application succesfull...But now i have
another problem...I want to debug de application...I want to debug it
beacuse I want to know how it's working how it is distributed on
mutiple processes...Does anyone know how to do that? I'm using Visual
Studio 2005, Intel Compier 10 and MPICH-2...What else do i
need?..Thank you
Michael Hofmann
2008-05-21 08:22:26 UTC
Permalink
Post by c***@gmail.com
Hi again...I compiled the application succesfull...But now i have
another problem...I want to debug de application...I want to debug it
beacuse I want to know how it's working how it is distributed on
mutiple processes...Does anyone know how to do that? I'm using Visual
Studio 2005, Intel Compier 10 and MPICH-2...What else do i
need?..Thank you
http://search.msn.com/results.aspx?q=3Dvisual+studio+2005+parallel+debug=
ging

http://www.google.com/search?hl=3Den&q=3Dvisual+studio+2005+parallel+deb=
ugging


Michael
c***@gmail.com
2008-05-21 10:20:35 UTC
Permalink
Post by c***@gmail.com
Hi again...I compiled the application succesfull...But now i have
another problem...I want to debug de application...I want to debug it
beacuse I want to know how it's working how it is distributed on
mutiple processes...Does anyone know how to do that? I'm using Visual
Studio 2005, Intel Compier 10 and MPICH-2...What else do i
need?..Thank you
http://search.msn.com/results.aspx?q=visual+studio+2005+parallel+debu...
http://www.google.com/search?hl=en&q=visual+studio+2005+parallel+debu...
Michael
I've check those links.. The main problem is that my application is
written in Fortran...And Visual Studio don't have debug support for
Fortran..I must use something else..Do you know somthing about this
one?
Thank you
Herman D. Knoble
2008-05-21 14:18:05 UTC
Permalink
On Wed, 21 May 2008 03:20:35 -0700 (PDT), ***@gmail.com wrote:

-|On May 21, 4:22 pm, "Michael Hofmann" <***@s2000.tu-
-|chemnitz.de> wrote:
-|> > Hi again...I compiled the application succesfull...But now i have
-|> > another problem...I want to debug de application...I want to debug it
-|> > beacuse I want to know how it's working how it is distributed on
-|> > mutiple processes...Does anyone know how to do that? I'm using Visual
-|> > Studio 2005, Intel Compier 10 and MPICH-2...What else do i
-|> > need?..Thank you
-|>
-|> http://search.msn.com/results.aspx?q=visual+studio+2005+parallel+debu...
-|>
-|> http://www.google.com/search?hl=en&q=visual+studio+2005+parallel+debu...
-|>
-|> Michael
-|I've check those links.. The main problem is that my application is
-|written in Fortran...And Visual Studio don't have debug support for
-|Fortran..I must use something else..Do you know somthing about this
-|one?
-|Thank you

If you are willing to use the Windows Command Prompt instead of
Visual Studio, and G95, the mpiSim debugging package:

http://ftp.aset.psu.edu/pub/ger/fortran/mpiSim/mpiSim.html

may be of help.

Skip Knoble
c***@gmail.com
2008-05-21 15:14:30 UTC
Permalink
Post by Herman D. Knoble
If you are willing to use the Windows Command Prompt instead of
http://ftp.aset.psu.edu/pub/ger/fortran/mpiSim/mpiSim.html
may be of help.
Skip  Knoble
I already read about this. But the problem is i must use fortran 77.
I olso read about TotalView that can be implemented with mpiexec but
that software require Linux...I'm using Windows i know that this
probably sucks in this MPI domain...But there must be an windows
alternative for debugging Fortran 77 parallel applications!!!..Is
there any?!
Herman D. Knoble
2008-05-21 15:26:17 UTC
Permalink
On Wed, 21 May 2008 08:14:30 -0700 (PDT), ***@gmail.com wrote:

-|
-|> If you are willing to use the Windows Command Prompt instead of
-|> Visual Studio, and G95, the  mpiSim debugging package:
-|>
-|> http://ftp.aset.psu.edu/pub/ger/fortran/mpiSim/mpiSim.html
-|>
-|> may be of help.
-|>
-|> Skip  Knoble
-| I already read about this. But the problem is i must use fortran 77.
-|I olso read about TotalView that can be implemented with mpiexec but
-|that software require Linux...I'm using Windows i know that this
-|probably sucks in this MPI domain...But there must be an windows
-|alternative for debugging Fortran 77 parallel applications!!!..Is
-|there any?!

You might consider using thet F77 to F90 converter:
ftp://ftp.numerical.rl.ac.uk/pub/MandR/convert.f90

Skiip
Michael Hofmann
2008-05-22 07:13:12 UTC
Permalink
Post by c***@gmail.com
I've check those links.. The main problem is that my application is
written in Fortran...And Visual Studio don't have debug support for
Fortran..I must use something else..Do you know somthing about this
one?
Sorry, my experiences with Visual Studio etc. are very limited ("press F5 for debugging") and I don't know whether a proper installed Intel Visual Fortran enables Fortran debugging support in Visual Studio or not. If not and you still want/need to use Visual Studio, have a look at "PGI Visual Fortran". It claims to "fully integrate" into VS 2005 and provide "GUI parallel debugging/profiling".

If you can resign to use the Visual Stuff, you can use cygwin to get a linux-like environment in Windows and gdb for debugging. Utilizing the Intel Fortran Compiler should be possible. Parallel debugging with gdb is also not impossible, but requires some experiences.


Michael
c***@gmail.com
2008-05-22 14:16:39 UTC
Permalink
Post by Michael Hofmann
Post by c***@gmail.com
I've check those links.. The main problem is that my application is
written in Fortran...And Visual Studio don't have debug support for
Fortran..I must use something else..Do you know somthing about this
one?
Sorry, my experiences with Visual Studio etc. are very limited ("press F5 for debugging") and I don't know whether a proper installed Intel Visual Fortran enables Fortran debugging support in Visual Studio or not. If not and you still want/need to use Visual Studio, have a look at "PGI Visual Fortran". It claims to "fully integrate" into VS 2005 and provide "GUI parallel debugging/profiling".
Thank you guys...I think i'll go for PGI like you said Michael...even
that i have to use OpenMP instead of MPI
Post by Michael Hofmann
If you can resign to use the Visual Stuff, you can use cygwin to get a linux-like environment in Windows and gdb for debugging. Utilizing the Intel Fortran Compiler should be possible. Parallel debugging with gdb is also not impossible, but requires some experiences.
Michael
Loading...