Newsgroups: comp.parallel.mpi
From: thimm@physik.fu-berlin.de (Axel Thimm)
Subject: communicating with structures in MPI
Organization: FU Berlin, Fachbereich Physik, Institut fuer Theoretische Physik
Date: Mon, 10 Jun 1996 10:52:31 GMT
Message-ID: <4pgupu$b53@fu-berlin.de>

Hello,
the MPI report 1.1. tells how to construct new Datatypes for
communication. I am using C++ and would like to transfer arrays of
classes. Classes should behave like C-structures.
The problem is I have lots of different classes, that also change their
structure very often, as I make source changes.
Using templates I thought of the following scenario:
e.g.
template<class X> SendClassArray( const X* const x, const int count ) {
	int charcount = sizeof(X) * count;
	void * buffer = (void*) x;
	// now send x[charcount] with MPI_CHAR
};

What would argue against this? Possibly the following:
1) Classes/structures may have memory holes that are sent also.
2) The char representation may not have the best performance.
3) One might not want to send the whole class (but not in my case).

Thanks for your answers in advance,
Regards,
	Axel Thimm.
--
Axel Thimm <thimm@dirac.physik.fu-berlin.de>
Fachbereich Physik, Freie Universitaet Berlin


