Hi there, I hope someone can help me here. This is the problem:
I need to communicate between processes a slice of a 3D array (i,j,k). The slice is a plane with j=constant. The memory is not contiguos on the slice since j changes faster then k.
the dimensions of the array are (NI,NJ,NK)
My solution number one: create an MPI_type_vector.
call MPI_TYPE_VECTOR(NK, NI, NJ, MPI_REAL8, y_slice_vec, err)
call MPI_TYPE_COMMIT(y_slice_vec, err)
so that was NK elements with NI number of entries with stride NJ.
My solution number two: create an MPI_type_struct.
integer, parameter :: szr=8 ! real8 memory displacement
Allocate(block_lenghts(NK),offset(NK),types(NK))
block_lenghts)=NI
types)=MPI_REAL8
offset)=szr*NI*NJ
call MPI_TYPE_STRUCT(NK, block_lenghts, offset, types, y_slice, err)
call MPI_TYPE_COMMIT(y_slice, err)
and then communicate with send and receive statements. None of them work! bunch of zeros get communicate, but at least the program doesn't crash.
I need to communicate between processes a slice of a 3D array (i,j,k). The slice is a plane with j=constant. The memory is not contiguos on the slice since j changes faster then k.
the dimensions of the array are (NI,NJ,NK)
My solution number one: create an MPI_type_vector.
call MPI_TYPE_VECTOR(NK, NI, NJ, MPI_REAL8, y_slice_vec, err)
call MPI_TYPE_COMMIT(y_slice_vec, err)
so that was NK elements with NI number of entries with stride NJ.
My solution number two: create an MPI_type_struct.
integer, parameter :: szr=8 ! real8 memory displacement
Allocate(block_lenghts(NK),offset(NK),types(NK))
block_lenghts)=NI
types)=MPI_REAL8
offset)=szr*NI*NJ
call MPI_TYPE_STRUCT(NK, block_lenghts, offset, types, y_slice, err)
call MPI_TYPE_COMMIT(y_slice, err)
and then communicate with send and receive statements. None of them work! bunch of zeros get communicate, but at least the program doesn't crash.