I've created a structure like this:
typedef struct point_struct { int x, y; }point;
And in main i defined it like this:
int num_item =2;
int blocklengths[2] = {1,1};
MPI_Datatype types[2] = {MPI_INT, MPI_INT};
MPI_Datatype mpi_point_type;
MPI_Aint offsets[2];
offsets[0] = offsetof(point, x);
offsets[1] = offsetof(point, y);
MPI_Type_create_struct(num_item, blocklengths, offsets, types, &mpi_point_type );
MPI_Type_commit(&mpi_point_type);
I've scatter
ed it between processes and call a recursive function to do something.
Mpirun throws back this error:
Process received signal. Signal: Segmentation fault (11) Signal code: Address not mapped (1) Failing at address: 0x7fffb9be57dc mpirun noticed that process rank 3 with PID 2924 on node MY_COMPUTER exited on signal 11 (Segmentation fault).
I also malloc
my array of structure this way:
point *p_x = (struct point_struct*)malloc(n*sizeof(struct point_struct));
Do i malloc
ed it wrong? or whats the problem?
Thanks for your time.