I need to be able to send and receive two uint64_t arrays to all ranks from rank 0.
I have a typedef struct as follows:
typedef struct _mpi_data_t {
uint64_t *array1;
uint64_t *array2;
size_t array1_size;
size_t array2_size;
} mpi_data_t;
In rank 0, I populate the arrays and calculate the displacements to create the mpi data type.
MPI_Get_address(&mpi_data_send, &address[0]);
MPI_Get_address(&mpi_data_send.array1[0], &address[1]);
MPI_Get_address(&mpi_data_send.array2[0], &address[2]);
MPI_Get_address(&mpi_data_send.array1_size, &address[3]);
displacements[0] = address[1] - address[0];
displacements[1] = address[2] - address[0];
displacements[2] = address[3] - address[0];
I also set the block count array as follows:
int block_count[3] = {mpi_data_send.array1_size, mpi_data_send.array2_size, 2};
My problem is that when receiving this data type, other ranks can't have created the same data type spec with the same displacements and block counts because the arrays were generated by rank 0, the sender.
How can I send and receive these two dynamically sized arrays?