[Mpi-forum] C-MPI DYNAMIC ALLOCATION / DERIVED DATATYPES

kostas pinokio pinokiox3 at yahoo.gr
Thu Feb 11 06:42:41 CST 2010


HALLO,

I would like to send a whole column of a dynamicly allocated array (in C language).
When i use derived datatypes(for example MPI_Type_vector) i can send a column ONLY if i have static array but when i use dynamic allocation i have problem!
Please tell me one way to send a column of a dynamc allocated array.

For example :
      MPI_Datatype columntype;
      MPI_Type_vector(10, 1, 10, MPI_INT, &columntype);
      MPI_Type_commit(&columntype);
 if(rank==0){
                     dyn_array=(int **) calloc(10,sizeof(int *));
                     for(i = 0; i < 10; i++){
                             dyn_array[i] =(int *) calloc(10,sizeof(int));
                     }
                     for(i=0;i<10;i++){ for(j=0;j<10;j++) dyn_array[i][j]=9;}
                  MPI_Send(&dyn_array[0][0], 1, columntype, dest, tag,MPI_COMM_WORLD);
 }
if(rank==1){
    MPI_Recv(&other_dyn_array[0][0], 1, columntype, 0, tag, MPI_COMM_WORLD, &Stat);
}

the values of the receive are not correct!!

Thank You!


__________________________________________________
Χρησιμοποιείτε Yahoo!;
Βαρεθήκατε τα ενοχλητικά μηνύματα (spam);   Το Yahoo! Mail διαθέτει την καλύτερη δυνατή προστασία κατά των ενοχλητικών μηνυμάτων  
http://mail.yahoo.gr 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpi-forum/attachments/20100211/ede1851d/attachment.html>


More information about the mpi-forum mailing list