Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

Subject: [OMPI users] Problem on 3D contiguous array with MPI_TYPE_VECTOR
From: christophe petit (christophe.petit09_at_[hidden])
Date: 2011-12-11 07:06:17


Hello,

I try to use MPI for solving the Fourier equation in 3D. In the code, I
have the following parameters :

number of domains on Ox : x_domains
number of domains on Oy : y_domains
number of domains on Oz : z_domains

size of grid on Ox: size_x
size of grid on Oy: size_y
size of grid on Oz: size_z

elements per Ox domain : xcell=(size_x/x_domains)
elements per Oy domain : ycell=(size_y/y_domains)
elements per Oz domain : zcell=(size_z/z_domains)

Total sizes of the 3D grid (including the ghost cells) :

size_tot_x=size_x+2*x_domains+2
size_tot_y=size_y+2*y_domains+2
size_tot_z=size_z+2*z_domains+2

------------------------------------------------------------

I have determined the coordinates of corners of each box as function of the
rank process "me" :

I have "xs(me)" (x start), "xe(me)" (x end), "ys(me)", "ye(me)", "zs(me)"
and "ze(me)".

Moreover, I have defined 3 types of matrix ( Oxz plan, Oxy and 0yz ) for
the intercommunication between the processes. I am not sure about *the
distance between two elements* in the following definition of the *matrix
type* :
----------------------------------------------------------------------------------------------------------------------
! Creation of "Matrix" type :

   call MPI_TYPE_VECTOR (nb_columns, nb_rows,* step_between_two_elements* ,
MPI_DOUBLE_PRECISION ,* matrix_type *,code)
-----------------------------------------------------------------------------------------------------------------------

Here are the part of the code where I have defined the 3 types of Matrix :

-----------------------------------------------------------------------------------------------------------------------
! Create matrix data type to communicate on horizontal Oxz plan

      CALL MPI_TYPE_VECTOR( xcell, zcell, *size_tot_y*,
MPI_DOUBLE_PRECISION &
         , matrix_type_oxz, infompi)
      CALL MPI_TYPE_COMMIT(matrix_type_oxz, infompi)
-----------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------
! Create matrix data type to communicate on vertical Oxy plan

      CALL MPI_TYPE_VECTOR( xcell, ycell, *size_tot_z*,
MPI_DOUBLE_PRECISION &
         , matrix_type_oxy, infompi)
      CALL MPI_TYPE_COMMIT(matrix_type_oxy, infompi)
-----------------------------------------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------------------------------------
! Create matrix data type to communicate on vertical Oyz plan

      CALL MPI_TYPE_VECTOR( zcell, ycell, *size_tot_x*,
MPI_DOUBLE_PRECISION &
         , matrix_type_oyz, infompi)
      CALL MPI_TYPE_COMMIT(matrix_type_oyz, infompi)
-----------------------------------------------------------------------------------------------------------------------

As you can see, I have doubts about the contiguous distance (*size_tot_x,
size_tot_y, size_tot_z*) for the 3 types above.

For the 2D case, I use the row_type and the contiguous distance is
"size_tot_y" but for 3D, I don't know .

Could you help me please ?

Thanks.