next up previous
Next: Creating the general datatype Up: Redistribution of block-cyclic data Previous: Example of redistribution

Skeleton code for redistribution


Skeleton Code

 subroutine redist (a, b, m, r, k, tag, dtype, comm)
 integer a(*), b(*)
 integer m, r, k, tag, dtype, comm
 logical flag
 integer ierr, errcode, p, myrank, newtype
 parameter (errcode=20)

 call mpi_initialized (flag, ierr)
 if (.not.flag) call mpi_abort (comm, errcode, ierr)
 call mpi_comm_size (comm, p, ierr)
 call mpi_comm_rank (comm, myrank, ierr)

 CREATE DATATYPE

 COMMUNICATE DATA in k STEPS

 call mpi_type_free (newtype, ierr)
 return
 end



David W Walker
Mon Jan 20 11:10:22 GMT 1997