-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hello,
I get an 'Invalid write' error in any code that contains a call to MPI_Allgatherv(), such as the following. This code is supposed to be correct.
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#define buff_size 128
int main(int argc, char **argv) {
int nprocs = -1;
int rank = -1;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
printf("Hello from rank %d \n", rank);
if (nprocs < 2)
printf("MBI ERROR: This test needs at least 2 processes to produce a bug.\n");
int dbs = sizeof(int)*nprocs; /* Size of the dynamic buffers for alltoall and friends */
int *rbuf1 = malloc(dbs), *rcounts1=malloc(dbs), *displs1=malloc(dbs);
for (int i = 0; i < nprocs; i++) {
rcounts1[i] = 1;
displs1[i] = 2 * (nprocs - (i + 1));
}
if (rank % 2) {
MPI_Allgatherv(&rank, 1, MPI_INT, rbuf1, rcounts1, displs1, MPI_INT, MPI_COMM_WORLD);
} else {
MPI_Allgatherv(&rank, 1, MPI_INT, rbuf1, rcounts1, displs1, MPI_INT, MPI_COMM_WORLD);
}
free(rbuf1);free(rcounts1);free(displs1);
MPI_Finalize();
printf("Rank %d finished normally\n", rank);
return 0;
}The produced stack trace (in the HTML) reads as follows:
0x10CF47: aislinn_call (aislinn.c:61)
0x10B9EE: MPI_Allgatherv (mpi_generated.c:643)
0x108CD9: main (CollCorrect_Allgatherv.c:59)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels