MPI_Allgather and dynamic struct

2019-06-12 10:13发布

问题:

I want to send a array of structure with the MPI_Allgather() but my structure has a dynamic array:

typedef struct {
    float a;
    int* b;
} structure_t;

My structure is initialised the following way:

 structure_t *resultat = (structure_t*) malloc( sizeof( structure_t ) + n * sizeof( int ) );

But how can I send my structure with MPI_Allgather? How can I create the two (send and receive) arrays?