Open MPI logo

Open MPI User's Mailing List Archives

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

Subject: Re: [OMPI users] Fwd: Problem with sending vectors
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2008-04-11 23:39:16


Also, it's been a long time since I've done anything serious in C++,
but are you guaranteed that &foo[x] for a vector<> will yield
contiguous memory?

You might be better off using the Boost C++ MPI bindings; they provide
all kinds of nifty things for classes, etc.

On Apr 7, 2008, at 7:47 AM, Andreas Schäfer wrote:
> Hi Albert,
>
> On 10:13 Mon 07 Apr , Albert Babinskas wrote:
>> Some code for the error that i get:
> [snip]
>> class Box has two int array inside it like
>> int a[3];
>> int b[3];
>
> Sorry, but "has two int array inside it like" isn't very precise. Do
> you mean:
>
> class Box {
> int a[3];
> int b[3];
> };
>
> or might you also mean:
>
> class Box {
> int a[3];
> Foo aLotOf;
> Bar otherStuff;
> int b[3];
> };
>
> ?
>
> Anyways, your MPI_Datatype construction doesn't seem to be right:
>
>> MPI_Type_contiguous(9, MPI_INT, &MPI_box);
>
> Fist of all, you should be using MPI_Type_create_struct for C++
> classes in order to ensure that each member is addressed with its
> correct offset (b/c of compiler memory layout/alignment). And second
> you said that myclass/Box or whatever is build from two int[3], but in
> the code above you register 9 ints.
>
> Again, we can't help you if you don't provide us with self-sufficient
> code; small excerpts mixed with comments won't cut it in most cases.
>
> Cheers
> -Andreas
>
>
> --
> ============================================
> Andreas Schäfer
> Cluster and Metacomputing Working Group
> Friedrich-Schiller-Universität Jena, Germany
> 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!
> _______________________________________________
> users mailing list
> users_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/users

-- 
Jeff Squyres
Cisco Systems