<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#ffffff" text="#000000">
<big><tt>Hi everyone,<br>
<br>
I've been using Fortran90 + MPICH2 for a while and I'm trying now to
broadcast complex variables amongst the processes. I've just learned
about the MPI_DOUBLE_COMPLEX datatype, but I'm not able to use it
properly... Here is the simple test program I've been using:<br>
<br>
program MPI_cmplx<br>
<br>
use MPI<br>
implicit none<br>
integer :: MPI_ID, MPI_size, MPI_err<br>
complex(8) :: z1, z2<br>
<br>
! Initialize
------------------------------------------------------------------<br>
<br>
call MPI_INIT(MPI_err)<br>
call MPI_COMM_RANK(MPI_COMM_WORLD,MPI_ID,MPI_err)<br>
call MPI_COMM_SIZE(MPI_COMM_WORLD,MPI_size,MPI_err)<br>
<br>
! Broadcast
-------------------------------------------------------------------
<<< THIS WORKS<br>
<br>
z1 = (0.0d0,0.0d0)<br>
if(MPI_ID == 0) then<br>
z1 = (1.5d0,0.5d0)<br>
write(*,*) "BCAST with count=1*MPI_DOUBLE_COMPLEX:", z1<br>
endif<br>
call MPI_BCAST(z1,1,MPI_DOUBLE_COMPLEX,0,MPI_COMM_WORLD,MPI_err)<br>
call MPI_BARRIER(MPI_COMM_WORLD,MPI_err)<br>
if(MPI_ID /= 0) then<br>
write(*,*) "Proc.", MPI_ID, " received", z1<br>
endif<br>
call MPI_BARRIER(MPI_COMM_WORLD,MPI_err)<br>
<br>
! Reduce
----------------------------------------------------------------------
<<< THIS DOESN'T WORK<br>
<br>
if(MPI_ID == 0) then<br>
write(*,*)<br>
write(*,*) "REDUCE with count=1*MPI_DOUBLE_COMPLEX"<br>
endif<br>
z1 = (1.5d0,0.5d0)<br>
z1 = z1 + cmplx(MPI_ID,MPI_ID)<br>
z2 = (0.0d0,0.0d0)<br>
call MPI_BARRIER(MPI_COMM_WORLD,MPI_err)<br>
write(*,*) "Proc.", MPI_ID, " has", z1<br>
call MPI_BARRIER(MPI_COMM_WORLD,MPI_err)<br>
if(MPI_ID == 0) then<br>
call MPI_REDUCE(z1,z2,1,MPI_DOUBLE_COMPLEX,MPI_SUM,0,MPI_COMM_WORLD)<br>
write(*,*) "Sum is", z2<br>
endif<br>
<br>
! End
-------------------------------------------------------------------------<br>
<br>
call MPI_FINALIZE(MPI_err)<br>
end program MPI_cmplx<br>
<br>
<br>
Could anyone help me on this please?<br>
Thanks in advance,<br>
<br>
Antonin<br>
<br>
<br>
</tt></big>
</body>
<br />--
<br />This message has been scanned for viruses and
<br />dangerous content by
<a href="http://www.mailscanner.info/"><b>MailScanner</b></a>, and is
<br />believed to be clean.
</html>