LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: Klein, Bernhard (Bernhard.Klein_at_[hidden])
Date: 2003-08-19 04:12:40


Hi MPI-Folks,

I'm a newbie in MPI and have the following problem:
Thow processes are connected with MPI_Connect, etc.
I will transfer a struct from one process to the rank 0 process, but I got
nothing at rank 0 process
I defined following

####################################################
# defining the structure for transfer
####################################################

#define MAX_PARAMETER_SIZE 128
#define MAX_PARAMETER 8
#define MPILOGGER_COUNT 7

typedef struct {
      int msgno ;
      int pid ;
      int rank ;
      int instance ;
      int count ;
      char logfilename [MAX_PARAMETER_SIZE] ;
      char parameter[MAX_PARAMETER][MAX_PARAMETER_SIZE] ;

} MPIStruct ;

MPIStruct mpiStruct ;

MPI_Aint mpiDatatypeAddress ;
MPI_Aint DTComponents[MPILOGGER_COUNT] ;
int DTLength[MPILOGGER_COUNT] ;
MPI_Datatype DTTypes[MPILOGGER_COUNT] ;
MPI_Datatype mpiDatatype ;

####################################################
# Defining the new MPI-Datatype
####################################################

 mpiDatatypeAddress = MPI::Get_address ( &mpiDatatype) ;

   DTComponents[0] = MPI::Get_address ( &mpiStruct.msgno ) ;
   DTComponents[1] = MPI::Get_address ( &mpiStruct.pid ) ;
   DTComponents[2] = MPI::Get_address ( &mpiStruct.rank ) ;
   DTComponents[3] = MPI::Get_address ( &mpiStruct.instance ) ;
   DTComponents[4] = MPI::Get_address ( &mpiStruct.count ) ;
   DTComponents[5] = MPI::Get_address ( &mpiStruct.logfilename ) ;
   DTComponents[6] = MPI::Get_address ( &mpiStruct.parameter ) ;

   DTComponents[0] -= mpiDatatypeAddress ;
   DTComponents[1] -= mpiDatatypeAddress ;
   DTComponents[2] -= mpiDatatypeAddress ;
   DTComponents[3] -= mpiDatatypeAddress ;
   DTComponents[4] -= mpiDatatypeAddress ;
   DTComponents[5] -= mpiDatatypeAddress ;
   DTComponents[5] -= mpiDatatypeAddress ;
   DTComponents[6] -= mpiDatatypeAddress ;

   DTLength[0] = sizeof( mpiStruct.msgno ) ;
   DTLength[1] = sizeof( mpiStruct.pid ) ;
   DTLength[2] = sizeof( mpiStruct.rank ) ;
   DTLength[3] = sizeof( mpiStruct.instance ) ;
   DTLength[4] = sizeof( mpiStruct.count ) ;
   DTLength[5] = sizeof( mpiStruct.logfilename ) ;
   DTLength[6] = sizeof( mpiStruct.parameter ) ;

   DTTypes[0] = MPI_INT ;
   DTTypes[1] = MPI_INT ;
   DTTypes[2] = MPI_INT ;
   DTTypes[3] = MPI_INT ;
   DTTypes[4] = MPI_INT ;
   DTTypes[5] = MPI_CHAR ;
   DTTypes[6] = MPI_CHAR ;

 MPI_Type_struct ( 7, DTLength, DTComponents, DTTypes, &mpiDatatype ) ;
 MPI_Type_commit ( &mpiDatatype ) ;

####################################################
# Receive construct in rank 0 process
####################################################
memset( mpiStruct, '\0', sizeof(mpiStruct)) ;
pobjmpiClient->Recv ( &mpiStruct, 1, mpiDatatype, MPI_ANY_SOURCE,
MPI_ANY_TAG, mpiStatus) ;

####################################################
# send construct in rank 1 process
####################################################
msgno =123
pid =28456
rank =1
instance =5
logfilename=test.log
count =5
parameter[0]="Parameter0" ;
parameter[1]="Parameter1" ;
parameter[2]="Parameter2" ;
parameter[3]="Parameter3" ;
parameter[4]="Parameter4" ;
parameter[5]="Parameter5" ;

pobjmpiLogger->Send ( &mpiStruct, 1, mpiDatatype, 0, tag) ;

I got no compiler errors, but during execution, the sendprocess fill the
struct and send it ( works fine). Rank 0 Process
got following:

(Output from Process 0)
msgnr [0]
pid [0]
rank [0]
instance [0]
count [0]
logfile []
no parameters

Can somebody help me? I'm working two days on this problem - yeah I'm a
newbie

Thanks for help

Bernd

Bernd Klein
----------------------------------------------------------
LogicaCMG
Financial Services, GB 21
Faulenstraße 31-35
28195 Bremen
Phone : +49 421 30 96-121
Fax : +49 421 30 96-118
Email : bernhard.klein_at_[hidden]
----------------------------------------------------------

This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.