[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [mpi-21] const MPI C++ handles
Ah! Okay, now I'm convinced about the const'ness of MPI::COMM_WORLD.
With your explanation I now view the C++ binding not an MPI object library but rather as a handle library.
Thanks,
.Erez
-----Original Message-----
From: owner-mpi-21@xxxxxxxxxxxxx [mailto:owner-mpi-21@xxxxxxxxxxxxx] On Behalf Of Jeff Squyres
Sent: Wednesday, January 23, 2008 10:27 AM
To: mpi-21@xxxxxxxxxxxxx
Subject: Re: [mpi-21] const MPI C++ handles
On Jan 23, 2008, at 12:55 PM, Erez Haba wrote:
> What is I implement the C++ binding but I don't have an underlying C
> implementation? The C++ objects will hold all the relevant
> information and by defining MPI::COMM_WORLD const, you make it
> immutable.
You still have to supply handle-like semantics, so you can't put the
state in the MPI handle (not even MPI::COMM_WORLD). E.g.:
MPI::Intracomm a = b;
b.Set_name("foo");
a.Get_name(name, sizeof(name));
The string put into the name variable *must* be "foo". This means
that you can't store the name on the b handle, but rather on the
underlying MPI communicator.
You can easily construct nastier examples where the original handle
would go out of scope (but the underlying MPI communicator must still
exist), so elaborate reference schemes (where a simply references to
b) won't work, either.
--
Jeff Squyres
Cisco Systems