MPI_Type_indexed Exercise

 

There is a real array A(16) assigned with

      data a  /1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
     &         9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0 /

and there is a real array B(6), which is unassigned.


Please derive a new date_type using the MPI_Type_indexed routine so that on each process the array B will receive the elements of 6th to 9th, the 13th and the 14th in Array (A(i),i=1,16). 


Also, please modify this program to replace the indexed type with the hindexed type.

You may want to use these MPI routines in your solution:


      MPI_TYPE_INDEXED
      MPI_TYPE_COMMIT 
      MPI_SEND 
      MPI_RECV