Afficher un message
Vieux 21/10/2007, 22h35   #7
Malcolm McLean
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to send dynamic vector?


"dopiotr" <nospam@nospam.invalid> wrote in message
> Hello Group,
>
> int Msg[size];
> MPI_Send(Msg, size, MPI_INT, DEST, TAG, MPI_COMM_WORLD);
> this is working fine.
>
> But how to send Msg declared like this:
> int *Msg=(int*)malloc(sizeof(int)*size);
>
> It gives me
> p4_error: interrupt SIGSEGV: 11
> not_send: could not write to fd=4, errno = 32
>

Should be fine. If the call sends a static array it should work exactly the
same way with a dynamic buffer allocated with malloc(). This is a general
feature of C functions, not just MPI.

However you have to know the message length, and allocate another buffer, to
receive the message at the other end.

--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm


  Réponse avec citation
 
Page generated in 0,04695 seconds with 9 queries