Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Raul Mosquera (raulysich2_at_[hidden])
Date: 2005-08-25 10:38:49


Hi:

I'm trying to pass an structure which is defined like this

#include <stdio.h>
#include <string.h>
#include "mpi.h"

#define NELEM 6

 struct{
   int num_Rows;
   int num_Cols;
   int element[NELEM];

   }send_pack;

//num_Rows and num_Cols identify the matrix being passed in the array element.

// Variable declaration
   int rank,size,tag=1,source=0,dest;
   MPI_Status status;

   int lena[2] ; // This is for the length of the elements holding
   MPI_Aint loca[2], extent; //localization
   MPI_Datatype typa[2];
   MPI_Datatype MY_TYPE;
   //MPI_Type_extent(MPI_INT,&extent);

   typa[0]=MPI_INT;
   typa[1]=MPI_INT;
   lena[0]=1;
   lena[1]=NELEM;
   loca[0]=0;
   loca[1]= 2 * extent;

 

The structure is being created like this

 MPI_Type_struct(1,lena,loca,typa,&MY_TYPE);
 MPI_Type_commit(&MY_TYPE); //creates the structure

When sending ...

 MPI_Send(&send_pack,1,MY_TYPE,1,tag,MPI_COMM_WORLD);

When Receiving

MPI_Recv(&send_pack,1,MY_TYPE,0,tag,MPI_COMM_WORLD,&status);

The program sends the message but it shows errors on the other side.

 My guess is that the parameters in the MPI_Send are not declare in the proper way.

Can you guys help me understandig what I'm doing wrong.

 

Thanks

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com