2004-07-14 18:11:03 +04:00
|
|
|
// -*- c++ -*-
|
|
|
|
//
|
2005-11-05 22:57:48 +03:00
|
|
|
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
// University Research and Technology
|
|
|
|
// Corporation. All rights reserved.
|
|
|
|
// Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
// of Tennessee Research Foundation. All rights
|
|
|
|
// reserved.
|
2015-06-24 06:59:57 +03:00
|
|
|
// Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
2004-11-28 23:09:25 +03:00
|
|
|
// University of Stuttgart. All rights reserved.
|
2005-03-24 15:43:37 +03:00
|
|
|
// Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
// All rights reserved.
|
2007-01-10 02:48:39 +03:00
|
|
|
// Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved.
|
2008-02-10 22:29:25 +03:00
|
|
|
// Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
// $COPYRIGHT$
|
2015-06-24 06:59:57 +03:00
|
|
|
//
|
2004-11-22 04:38:40 +03:00
|
|
|
// Additional copyrights may follow
|
2015-06-24 06:59:57 +03:00
|
|
|
//
|
2004-07-14 18:11:03 +04:00
|
|
|
// $HEADER$
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// Miscellany
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline MPI::Errhandler
|
|
|
|
MPI::Win:: Get_errhandler() const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
2008-02-10 22:29:25 +03:00
|
|
|
MPI_Errhandler errhandler;
|
|
|
|
MPI_Win_get_errhandler(mpi_win, &errhandler);
|
|
|
|
return errhandler;
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
2008-02-10 22:29:25 +03:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2008-02-10 22:29:25 +03:00
|
|
|
MPI::Win::Set_errhandler(const MPI::Errhandler& errhandler) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
2008-02-10 22:29:25 +03:00
|
|
|
(void)MPI_Win_set_errhandler(mpi_win, errhandler);
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// One sided communication
|
|
|
|
//
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Accumulate(const void* origin_addr, int origin_count,
|
|
|
|
const MPI::Datatype& origin_datatype, int target_rank,
|
|
|
|
MPI::Aint target_disp, int target_count,
|
|
|
|
const MPI::Datatype& target_datatype,
|
2015-06-24 06:59:57 +03:00
|
|
|
const MPI::Op& op) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
2005-11-30 06:22:27 +03:00
|
|
|
(void) MPI_Accumulate(const_cast<void *>(origin_addr), origin_count, origin_datatype,
|
2015-06-24 06:59:57 +03:00
|
|
|
target_rank, target_disp, target_count,
|
2004-07-14 18:11:03 +04:00
|
|
|
target_datatype, op, mpi_win);
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
inline void
|
2015-06-24 06:59:57 +03:00
|
|
|
MPI::Win::Complete() const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
(void) MPI_Win_complete(mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline MPI::Win
|
|
|
|
MPI::Win::Create(const void* base, MPI::Aint size,
|
|
|
|
int disp_unit, const MPI::Info& info,
|
|
|
|
const MPI::Intracomm& comm)
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
MPI_Win newwin;
|
2005-11-30 06:22:27 +03:00
|
|
|
(void) MPI_Win_create(const_cast<void *>(base), size, disp_unit, info, comm, &newwin);
|
2004-07-14 18:11:03 +04:00
|
|
|
return newwin;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Fence(int assert) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
(void) MPI_Win_fence(assert, mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Get(const void *origin_addr, int origin_count,
|
|
|
|
const MPI::Datatype& origin_datatype,
|
|
|
|
int target_rank, MPI::Aint target_disp,
|
|
|
|
int target_count,
|
|
|
|
const MPI::Datatype& target_datatype) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
2005-11-30 06:22:27 +03:00
|
|
|
(void) MPI_Get(const_cast<void *>(origin_addr), origin_count, origin_datatype,
|
2015-06-24 06:59:57 +03:00
|
|
|
target_rank, target_disp,
|
2004-07-14 18:11:03 +04:00
|
|
|
target_count, target_datatype, mpi_win);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline MPI::Group
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Get_group() const
|
|
|
|
{
|
|
|
|
MPI_Group mpi_group;
|
|
|
|
(void) MPI_Win_get_group(mpi_win, &mpi_group);
|
|
|
|
return mpi_group;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Lock(int lock_type, int rank, int assert) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
(void) MPI_Win_lock(lock_type, rank, assert, mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Post(const MPI::Group& group, int assert) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
(void) MPI_Win_post(group, assert, mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Put(const void* origin_addr, int origin_count,
|
|
|
|
const MPI::Datatype& origin_datatype,
|
|
|
|
int target_rank, MPI::Aint target_disp,
|
|
|
|
int target_count,
|
|
|
|
const MPI::Datatype& target_datatype) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
2015-06-24 06:59:57 +03:00
|
|
|
(void) MPI_Put(const_cast<void *>(origin_addr), origin_count, origin_datatype,
|
2004-07-14 18:11:03 +04:00
|
|
|
target_rank, target_disp, target_count,
|
|
|
|
target_datatype, mpi_win);
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Start(const MPI::Group& group, int assert) const
|
|
|
|
{
|
|
|
|
(void) MPI_Win_start(group, assert, mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline bool
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Test() const
|
|
|
|
{
|
|
|
|
int flag;
|
|
|
|
MPI_Win_test(mpi_win, &flag);
|
2006-08-28 22:51:09 +04:00
|
|
|
return OPAL_INT_TO_BOOL(flag);
|
2015-06-24 06:59:57 +03:00
|
|
|
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Unlock(int rank) const
|
|
|
|
{
|
|
|
|
(void) MPI_Win_unlock(rank, mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Wait() const
|
|
|
|
{
|
|
|
|
(void) MPI_Win_wait(mpi_win);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// External Interfaces
|
|
|
|
//
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Call_errhandler(int errorcode) const
|
|
|
|
{
|
|
|
|
(void) MPI_Win_call_errhandler(mpi_win, errorcode);
|
|
|
|
}
|
|
|
|
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
// 1) original Create_keyval that takes the first 2 arguments as C++
|
|
|
|
// functions
|
|
|
|
inline int
|
|
|
|
MPI::Win::Create_keyval(MPI::Win::Copy_attr_function* win_copy_attr_fn,
|
2015-06-24 06:59:57 +03:00
|
|
|
MPI::Win::Delete_attr_function* win_delete_attr_fn,
|
2008-02-10 22:29:25 +03:00
|
|
|
void* extra_state)
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
{
|
|
|
|
// Back-end function does the heavy lifting
|
2008-02-10 22:29:25 +03:00
|
|
|
int ret, keyval;
|
2015-06-24 06:59:57 +03:00
|
|
|
ret = do_create_keyval(NULL, NULL,
|
2008-02-10 22:29:25 +03:00
|
|
|
win_copy_attr_fn, win_delete_attr_fn,
|
|
|
|
extra_state, keyval);
|
|
|
|
return (MPI_SUCCESS == ret) ? keyval : ret;
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 2) overload Create_keyval to take the first 2 arguments as C
|
|
|
|
// functions
|
|
|
|
inline int
|
|
|
|
MPI::Win::Create_keyval(MPI_Win_copy_attr_function* win_copy_attr_fn,
|
2015-06-24 06:59:57 +03:00
|
|
|
MPI_Win_delete_attr_function* win_delete_attr_fn,
|
2008-02-10 22:29:25 +03:00
|
|
|
void* extra_state)
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
{
|
|
|
|
// Back-end function does the heavy lifting
|
2008-02-10 22:29:25 +03:00
|
|
|
int ret, keyval;
|
|
|
|
ret = do_create_keyval(win_copy_attr_fn, win_delete_attr_fn,
|
2015-06-24 06:59:57 +03:00
|
|
|
NULL, NULL,
|
2008-02-10 22:29:25 +03:00
|
|
|
extra_state, keyval);
|
|
|
|
return (MPI_SUCCESS == ret) ? keyval : ret;
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 3) overload Create_keyval to take the first 2 arguments as C++ & C
|
|
|
|
// functions
|
|
|
|
inline int
|
|
|
|
MPI::Win::Create_keyval(MPI::Win::Copy_attr_function* win_copy_attr_fn,
|
2008-02-10 22:29:25 +03:00
|
|
|
MPI_Win_delete_attr_function* win_delete_attr_fn,
|
|
|
|
void* extra_state)
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
{
|
|
|
|
// Back-end function does the heavy lifting
|
2008-02-10 22:29:25 +03:00
|
|
|
int ret, keyval;
|
|
|
|
ret = do_create_keyval(NULL, win_delete_attr_fn,
|
2015-06-24 06:59:57 +03:00
|
|
|
win_copy_attr_fn, NULL,
|
2008-02-10 22:29:25 +03:00
|
|
|
extra_state, keyval);
|
|
|
|
return (MPI_SUCCESS == ret) ? keyval : ret;
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// 4) overload Create_keyval to take the first 2 arguments as C & C++
|
|
|
|
// functions
|
|
|
|
inline int
|
|
|
|
MPI::Win::Create_keyval(MPI_Win_copy_attr_function* win_copy_attr_fn,
|
2008-02-10 22:29:25 +03:00
|
|
|
MPI::Win::Delete_attr_function* win_delete_attr_fn,
|
|
|
|
void* extra_state)
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
{
|
|
|
|
// Back-end function does the heavy lifting
|
2008-02-10 22:29:25 +03:00
|
|
|
int ret, keyval;
|
|
|
|
ret = do_create_keyval(win_copy_attr_fn, NULL,
|
|
|
|
NULL, win_delete_attr_fn,
|
|
|
|
extra_state, keyval);
|
|
|
|
return (MPI_SUCCESS == ret) ? keyval : ret;
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
}
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Delete_attr(int win_keyval)
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
(void) MPI_Win_delete_attr(mpi_win, win_keyval);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
MPI::Win::Free_keyval(int& win_keyval)
|
|
|
|
{
|
|
|
|
(void) MPI_Win_free_keyval(&win_keyval);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-01-10 19:41:21 +03:00
|
|
|
// version 1: pre-errata Get_attr (not correct, but probably nice to support
|
|
|
|
inline bool
|
|
|
|
MPI::Win::Get_attr(const Win& win, int win_keyval,
|
|
|
|
void* attribute_val) const
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
(void) MPI_Win_get_attr(win, win_keyval, attribute_val, &ret);
|
|
|
|
return OPAL_INT_TO_BOOL(ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// version 2: post-errata Get_attr (correct, but no one seems to know about it)
|
2015-06-24 06:59:57 +03:00
|
|
|
inline bool
|
2007-01-10 02:48:39 +03:00
|
|
|
MPI::Win::Get_attr(int win_keyval, void* attribute_val) const
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
|
|
|
int ret;
|
2007-01-10 02:48:39 +03:00
|
|
|
(void) MPI_Win_get_attr(mpi_win, win_keyval, attribute_val, &ret);
|
2006-08-28 22:51:09 +04:00
|
|
|
return OPAL_INT_TO_BOOL(ret);
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
2004-07-14 18:11:03 +04:00
|
|
|
MPI::Win::Get_name(char* win_name, int& resultlen) const
|
|
|
|
{
|
|
|
|
(void) MPI_Win_get_name(mpi_win, win_name, &resultlen);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Set_attr(int win_keyval, const void* attribute_val)
|
Fixes trac:817
The C++ bindings were not tracking keyvals properly -- they were
freeing some internal meta data when Free_keyval() was called, not
when the keyval was actually destroyed (keyvals are refcounted in the
C layer, just like all other MPI objects, because they can live for
long after their corresponding Free call is invoked). This commit
fixes this problem and several other things:
* Add infrastructure on the ompi_attribute_keyval_t for an "extra"
destructor pointer that will be invoked during the "real"
constructor (i.e., when OBJ_RELEASE puts the refcount to 0). This
allows calling back into the C++ layer to release meta data
associated with the keyval.
* Adjust all cases where keyvals are created to pass in relevant
destructors (NULL or the C++ destructor).
* Do essentially the same for MPI::Comm, MPI::Win, and MPI:Datatype:
* Move several functions out of the .cc file into the _inln.h file
since they no longer require locks
* Make the 4 Create_keyval() functions call a common back-end
keyval creation function that does the Right Thing depending on
whether C or C++ function pointers were used for the keyval
functions. The back-end function does not call the corresponding
C MPI_*_create_keyval function, but rather does the work itself
so that it can associate a "destructor" callback for the C++
bindings for when the keyval is actually destroyed.
* Change a few type names to be more indicative of what they are
(mostly dealing with keyvals [not "keys"]).
* Add the 3 missing bindings for MPI::Comm::Create_keyval().
* Remove MPI::Comm::comm_map (and associated types) because it's no
longer necessary in the intercepts -- it was a by-product of being
a portable C++ bindings layer. Now we can just query the C layer
directly to figure out what type a communicator is. This solves
some logistics / callback issues, too.
* Rename several types, variables, and fix many comments in the
back-end C attribute implementation to make the names really
reflect what they are (keyvals vs. attributes). The previous names
heavily overloaded the name "key" and were ''extremely''
confusing.
This commit was SVN r13565.
The following Trac tickets were found above:
Ticket 817 --> https://svn.open-mpi.org/trac/ompi/ticket/817
2007-02-09 02:50:04 +03:00
|
|
|
{
|
|
|
|
(void) MPI_Win_set_attr(mpi_win, win_keyval, const_cast<void *>(attribute_val));
|
|
|
|
}
|
|
|
|
|
2004-07-14 18:11:03 +04:00
|
|
|
|
2015-06-24 06:59:57 +03:00
|
|
|
inline void
|
|
|
|
MPI::Win::Set_name(const char* win_name)
|
2004-07-14 18:11:03 +04:00
|
|
|
{
|
2005-11-30 06:22:27 +03:00
|
|
|
(void) MPI_Win_set_name(mpi_win, const_cast<char *>(win_name));
|
2004-07-14 18:11:03 +04:00
|
|
|
}
|
|
|
|
|