Newsgroups: comp.parallel.mpi
From: zmc@quanta.dcrt.nih.gov (Zhuo Min Chen)
Subject: MPI does allow passing argument
Organization: National Institutes of Health
Date: Mon, 13 May 1996 18:39:58 GMT
Message-ID: <1996May13.183958.3983@alw.nih.gov>

 I have just done what you intended. That is pass cpu_id and ncpu
down to sub functions. However, be aware that if your sub functions
has included 'mpi.h' or mpif.h,  your arguements have to bear different
names as those in common block

      subroutine fft3dcos(nx,ny,nz,seq,coef,taskid,ncpu)
      implicit none
      include 'mpif.h'
      call dtime(cputime)
      call MPI_bcast(coef,nx*ny*nz,MPI_REAL8,0,
     $     MPI_COMM_WORLD,ierr)
      call dtime(cputime)
      commtime(1) = cputime(1)
      if (taskid .eq. 0) then
         write(*,*) ' Three Stage Computation times  ',
     $        real(comptime(1)), real(comptime(2)), real(comptime(3))
         write(*,*) ' Three Stage Communication times',
     $        real(commtime(1)), real(commtime(2)), real(commtime(3))
         write(*,*) ' Total   Computation times: ',
     $        real(comptime(1)+comptime(2)+comptime(3))
         write(*,*) ' Total Communication times: ',
     $        real(commtime(1)+commtime(2)+commtime(3))
      end if

Notice taskid is local, MPI_Bcast is used the same way as MPI_Scatter


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 Dr. Zhuo Min (jimmy) Chen                  |  Home No      : (301) 330-4533
 http://quanta.dcrt.nih.gov/~zmc            |  Work No/Voice: (301) 402-2072
 National Institutes of Health              |  1 Page Fax   : (301) 402-2072
 DCRT, Building 12 A, Room 2046             |  Fax          : (301) 402-2867
 Bethesda, MD 20892                         |  e-mail: zmc@quanta.dcrt.nih.gov
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

