2 C second - test program that sends an array of floats from the first process
3 C of a group to the last, using send and recv
9 integer rank, size, to, from, tag, count, i, ierr
11 integer st_source, st_tag, st_count
13 integer status(MPI_STATUS_SIZE)
14 double precision data(100)
17 C print *, 'about to call comm rank'
18 call MPI_COMM_RANK( MPI_COMM_WORLD, rank, ierr )
19 C print *, rank, 'about to call comm size'
20 call MPI_COMM_SIZE( MPI_COMM_WORLD, size, ierr )
21 print *, 'Process ', rank, ' of ', size, ' is alive'
28 if (rank .eq. src) then
35 call MPI_SEND( data, count, MPI_DOUBLE_PRECISION, to, tag,
36 & MPI_COMM_WORLD, ierr )
37 print *, rank, ' sent'
38 print *, (data(i),i=1,10)
39 elseif (rank .eq. dest) then
43 call MPI_RECV(data, count, MPI_DOUBLE_PRECISION, from, tag,
44 & MPI_COMM_WORLD, status, ierr )
46 call MPI_GET_COUNT( status, MPI_DOUBLE_PRECISION,
48 st_source = status(MPI_SOURCE)
49 st_tag = status(MPI_TAG)
51 print *, 'Status info: source = ', st_source,
52 & ' tag = ', st_tag, ' count = ', st_count
53 print *, rank, ' received', (data(i),i=1,10)
56 call MPI_FINALIZE( ierr )
57 print *, 'Process ', rank, ' exiting'