On 08:10 Sun 13 Jul , Carlos Henrique da Silva Santos wrote: > Ok. Gabriele, > But I would like to know, how can I define DATATYPE on send and > recv? Could you give me an example? > For example, my class has the following design and I want to > send/recv Test object. > > class Test { > private: > int coordinate; > vector<double> s; > public: > void setD(int, vector<double>); > double getParameter(int); > vector<double> getAll(void); > }
Hi Carlos, the problem with this object is that it contains a pointer to malloc'd memory (the vector). Since datatypes can only be used for objects with fixed size (and layout), you can't define an MPI_Datatype for this. I'd suggest you to use Boost.MPI in this case (http://www.boost.org/doc/libs/1_35_0/doc/html/mpi.html) Cheers -Andreas -- ============================================ Andreas Schäfer Cluster and Metacomputing Working Group Friedrich-Schiller-Universität Jena, Germany 0049/3641-9-46376 PGP/GPG key via keyserver I'm a bright... http://www.the-brights.net ============================================ (\___/) (+'.'+) (")_(") This is Bunny. Copy and paste Bunny into your signature to help him gain world domination!
pgpvbGkSR_wR2.pgp
Description: PGP signature