You need to use disp[]
<     MPI_Scatterv(&a, rcounts, 0, MPI_INT, &b, 100, MPI_INT, 0, MPI_COMM_WORLD);
---
>     MPI_Scatterv(&a, rcounts, disp, MPI_INT, &b, 100, MPI_INT, 0, MPI_COMM_WORLD);

--Junchao Zhang

On Wed, Nov 12, 2014 at 5:23 AM, Chafik sanaa <san.chafik@gmail.com> wrote:
when i running the following program, i have this error (Exception non gérée à 0x00B54BE2 (mpich2nemesis.dll) dans samedi1.exe : 0xC0000005 : Violation d'accès lors de la lecture de l'emplacement 0x00000000.)
program :
#include <stdio.h>
#include "mpi.h"

int main(int argc, char *argv[])
{

int a[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
int rcounts[4] = { 2, 2, 2, 2 };
int disp[4] = { 0, 2, 4, 6 };
int b[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
int procid;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &procid);
MPI_Scatterv(&a, rcounts, 0, MPI_INT, &b, 100, MPI_INT, 0, MPI_COMM_WORLD);
printf("%d", b[0]);
printf("sanaa");
MPI_Finalize();
return 0;
}

_______________________________________________
discuss mailing list     discuss@mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss