[MPICH] about C++

Gerard Gorman g.gorman at imperial.ac.uk
Tue Oct 18 19:51:37 CDT 2005


Hi

llwaeva at 21cn.com wrote:
> 1) I am going to use std::valarray or a third-party library like blitz++
> as the data container, I am not sure if data stored in such containers
> are continuous or not. If not, how can I MPI_Send the buffer
If you know it's a continuous container then you can use MPI derived 
data types. Otherwise, you have little choice other than to use 
MPI_Pack. While this is less pretty it generally won't put a big dent on 
performance as mpi implementers call often call mpi_pack/mpi_unpack from 
inside the send/recv calls when you use derived datatypes.

> 2) If I need an extra buffer to store the data in std::valarray before
> MPI_Send, so I need to reconstruct the valarray after the data is
> received. Is it a time-consuming job?
This is just a memory-memory copy. This is generally going to cost less 
than the latency of a connection in your cluster or a remote memory copy 
if you are using a SMP. You should really do some tests to try this out 
for yourself as the degree of the different costs on different platforms 
will vary and on the details of your application.

Cheers
g




More information about the mpich-discuss mailing list