2004-01-12 19:08:46 +03:00
|
|
|
/*
|
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.
|
2004-11-28 23:09:25 +03:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* 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.
|
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
|
|
|
* Copyright (c) 2007 Cisco Systems, Inc. All rights reserved.
|
2004-11-22 04:38:40 +03:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-01-12 19:08:46 +03:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
/** @file
|
|
|
|
*
|
|
|
|
* Implementation for taking care of the attribute that can hang off a comm,
|
|
|
|
* win or datatype.
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#ifndef OMPI_ATTRIBUTE_H
|
|
|
|
#define OMPI_ATTRIBUTE_H
|
2004-01-12 19:08:46 +03:00
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
#include <string.h>
|
|
|
|
#include "mpi.h"
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#include "ompi_config.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "ompi/constants.h"
|
2005-07-03 20:06:07 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
2006-02-12 04:33:29 +03:00
|
|
|
#include "opal/class/opal_hash_table.h"
|
|
|
|
#include "orte/mca/gpr/gpr_types.h"
|
2004-03-17 02:34:41 +03:00
|
|
|
|
2004-05-30 20:21:44 +04:00
|
|
|
#define ATTR_HASH_SIZE 10
|
2004-03-17 02:34:41 +03:00
|
|
|
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
/*
|
|
|
|
* Flags for keyvals
|
|
|
|
*/
|
|
|
|
#define OMPI_KEYVAL_PREDEFINED 0x0001
|
|
|
|
#define OMPI_KEYVAL_F77 0x0002
|
|
|
|
#define OMPI_KEYVAL_F77_MPI1 0x0004
|
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
|
2004-10-21 02:31:03 +04:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
enum ompi_attribute_type_t {
|
2007-02-23 03:54:41 +03:00
|
|
|
UNUSED_ATTR = 0, /**< Make the compilers happy when we have to construct
|
|
|
|
* an attribute */
|
2006-07-11 19:28:32 +04:00
|
|
|
COMM_ATTR, /**< The attribute belongs to a comm object. Starts
|
2007-02-23 03:54:41 +03:00
|
|
|
* with 1 so that we can have it initialized to 0
|
|
|
|
* using memset in the constructor */
|
2006-07-11 19:28:32 +04:00
|
|
|
TYPE_ATTR, /**< The attribute belongs to datatype object */
|
|
|
|
WIN_ATTR /**< The attribute belongs to a win object */
|
2004-03-17 02:34:41 +03:00
|
|
|
};
|
2004-06-07 19:33:53 +04:00
|
|
|
typedef enum ompi_attribute_type_t ompi_attribute_type_t;
|
2004-01-12 19:08:46 +03:00
|
|
|
|
2004-06-16 19:17:43 +04:00
|
|
|
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
/* Old-style MPI-1 Fortran function pointer declarations for copy and
|
|
|
|
delete. These will only be used here and not in the front end
|
|
|
|
functions. */
|
|
|
|
|
|
|
|
typedef void (ompi_mpi1_fortran_copy_attr_function)(MPI_Fint *oldobj,
|
|
|
|
MPI_Fint *keyval,
|
|
|
|
MPI_Fint *extra_state,
|
|
|
|
MPI_Fint *attr_in,
|
|
|
|
MPI_Fint *attr_out,
|
2007-02-23 03:54:41 +03:00
|
|
|
ompi_fortran_logical_t *flag,
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
MPI_Fint *ierr);
|
|
|
|
typedef void (ompi_mpi1_fortran_delete_attr_function)(MPI_Fint *obj,
|
|
|
|
MPI_Fint *keyval,
|
|
|
|
MPI_Fint *attr_in,
|
|
|
|
MPI_Fint *extra_state,
|
|
|
|
MPI_Fint *ierr);
|
|
|
|
|
|
|
|
/* New-style MPI-2 Fortran function pointer declarations for copy and
|
|
|
|
delete. These will only be used here and not in the front end
|
|
|
|
functions. */
|
|
|
|
|
|
|
|
typedef void (ompi_mpi2_fortran_copy_attr_function)(MPI_Fint *oldobj,
|
|
|
|
MPI_Fint *keyval,
|
|
|
|
void *extra_state,
|
|
|
|
void *attr_in,
|
|
|
|
void *attr_out,
|
2007-02-23 03:54:41 +03:00
|
|
|
ompi_fortran_logical_t *flag,
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
MPI_Fint *ierr);
|
|
|
|
typedef void (ompi_mpi2_fortran_delete_attr_function)(MPI_Fint *obj,
|
|
|
|
MPI_Fint *keyval,
|
|
|
|
void *attr_in,
|
|
|
|
void *extra_state,
|
|
|
|
MPI_Fint *ierr);
|
2006-03-23 07:47:14 +03:00
|
|
|
/*
|
|
|
|
* Internally the copy function for all kinds of MPI objects has one more
|
|
|
|
* argument, the pointer to the new object. Therefore, we can do on the
|
|
|
|
* flight modifications of the new communicator based on attributes stored
|
|
|
|
* on the main communicator.
|
|
|
|
*/
|
|
|
|
typedef int (MPI_Comm_internal_copy_attr_function)(MPI_Comm, int, void *,
|
2007-02-23 03:54:41 +03:00
|
|
|
void *, void *, int *,
|
|
|
|
MPI_Comm);
|
2006-03-23 07:47:14 +03:00
|
|
|
typedef int (MPI_Type_internal_copy_attr_function)(MPI_Datatype, int, void *,
|
2007-02-23 03:54:41 +03:00
|
|
|
void *, void *, int *,
|
|
|
|
MPI_Datatype);
|
2006-03-23 07:47:14 +03:00
|
|
|
typedef int (MPI_Win_internal_copy_attr_function)(MPI_Win, int, void *,
|
2007-02-23 03:54:41 +03:00
|
|
|
void *, void *, int *,
|
|
|
|
MPI_Win);
|
2004-06-16 19:17:43 +04:00
|
|
|
|
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
|
|
|
typedef void (ompi_attribute_keyval_destructor_fn_t)(int);
|
|
|
|
|
2004-05-30 20:21:44 +04:00
|
|
|
/* Union to take care of proper casting of the function pointers
|
|
|
|
passed from the front end functions depending on the type. This
|
|
|
|
will avoid casting function pointers to void* */
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
union ompi_attribute_fn_ptr_union_t {
|
2006-03-23 07:47:14 +03:00
|
|
|
MPI_Comm_delete_attr_function *attr_communicator_delete_fn;
|
|
|
|
MPI_Type_delete_attr_function *attr_datatype_delete_fn;
|
|
|
|
MPI_Win_delete_attr_function *attr_win_delete_fn;
|
2004-06-16 19:17:43 +04:00
|
|
|
|
2006-03-23 07:47:14 +03:00
|
|
|
MPI_Comm_internal_copy_attr_function *attr_communicator_copy_fn;
|
|
|
|
MPI_Type_internal_copy_attr_function *attr_datatype_copy_fn;
|
|
|
|
MPI_Win_internal_copy_attr_function *attr_win_copy_fn;
|
2004-06-16 19:17:43 +04:00
|
|
|
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
/* For Fortran old MPI-1 callback functions */
|
|
|
|
|
|
|
|
ompi_mpi1_fortran_delete_attr_function *attr_mpi1_fortran_delete_fn;
|
2006-03-23 07:47:14 +03:00
|
|
|
ompi_mpi1_fortran_copy_attr_function *attr_mpi1_fortran_copy_fn;
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
|
|
|
|
/* For Fortran new MPI-2 callback functions */
|
2004-06-16 19:17:43 +04:00
|
|
|
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
ompi_mpi2_fortran_delete_attr_function *attr_mpi2_fortran_delete_fn;
|
2006-03-23 07:47:14 +03:00
|
|
|
ompi_mpi2_fortran_copy_attr_function *attr_mpi2_fortran_copy_fn;
|
2004-05-30 20:21:44 +04:00
|
|
|
};
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
typedef union ompi_attribute_fn_ptr_union_t ompi_attribute_fn_ptr_union_t;
|
2004-05-30 20:21:44 +04:00
|
|
|
|
2004-01-12 19:08:46 +03:00
|
|
|
|
Many fixes to MPI attributes. This mainly affected the following
areas:
- The MPI attribute functions in f77 (the MPI-2 set, get,
keyval_create functions for each of the 3 types [comm, datatype,
win], and the MPI-1 put/get functions)
- the src/attribute/* back-end implementation
- MPI_TYPE_DUP implementation
- back-end ddt implementation
Here are the foxes:
- F77 attributes were previously being saved by reference (!)
- Until a few days ago, I didn't realize that the Fortran callback
functions between MPI-1 and MPI-2 had different signatures. These
changes update to handle all 3 kinds of callback functions: C, MPI-1
Fortran, and MPI-2 fortran.
- Also clean up a few related bugs with respect to MPI_TYPE_DUP (i.e.,
ensure that all attribute callbacks are properly invoked) and
ompi_ddt_duplicate (ensure that flags, f2c index, and keyhash are
all set properly).
This commit was SVN r6099.
2005-06-20 20:41:28 +04:00
|
|
|
/**
|
|
|
|
* Union to help convert between Fortran attributes (which must be
|
|
|
|
* stored by value) and C pointers (which is the back-end storage of
|
|
|
|
* all attributes).
|
|
|
|
*/
|
|
|
|
union ompi_attribute_fortran_ptr_t {
|
|
|
|
void *c_ptr;
|
|
|
|
MPI_Fint f_integer;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Convenience typedef
|
|
|
|
*/
|
|
|
|
typedef union ompi_attribute_fortran_ptr_t ompi_attribute_fortran_ptr_t;
|
|
|
|
|
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
|
|
|
struct ompi_attribute_keyval_t {
|
2005-07-03 20:06:07 +04:00
|
|
|
opal_object_t super;
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_attribute_type_t attr_type; /**< One of COMM/WIN/DTYPE. This
|
2007-02-23 03:54:41 +03:00
|
|
|
will be used to cast the
|
|
|
|
copy/delete attribute functions
|
|
|
|
properly and error checking */
|
2004-06-16 19:17:43 +04:00
|
|
|
int attr_flag; /**< flag field: contains "OMPI_KEYVAL_PREDEFINED",
|
2007-02-23 03:54:41 +03:00
|
|
|
"OMPI_KEYVAL_F77" */
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_attribute_fn_ptr_union_t copy_attr_fn; /**< Copy function for the
|
2007-02-23 03:54:41 +03:00
|
|
|
attribute */
|
2004-06-07 19:33:53 +04:00
|
|
|
ompi_attribute_fn_ptr_union_t delete_attr_fn; /**< Delete function for the
|
2007-02-23 03:54:41 +03:00
|
|
|
attribute */
|
2004-03-17 02:34:41 +03:00
|
|
|
void *extra_state; /**< Extra state of the attribute */
|
|
|
|
int key; /**< Keep a track of which key this item belongs to, so that
|
2007-02-23 03:54:41 +03:00
|
|
|
the key can be deleted when this object is destroyed */
|
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
|
|
|
|
|
|
|
/** If non-null, call this function when the OBJ destructor for this
|
|
|
|
object is invoked */
|
|
|
|
ompi_attribute_keyval_destructor_fn_t *extra_destructor;
|
2004-03-17 02:34:41 +03:00
|
|
|
};
|
|
|
|
|
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
|
|
|
typedef struct ompi_attribute_keyval_t ompi_attribute_keyval_t;
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
/* Functions */
|
|
|
|
|
|
|
|
|
|
|
|
|
2004-05-30 20:21:44 +04:00
|
|
|
/**
|
|
|
|
* Convenient way to initialize the attribute hash table per MPI-Object
|
|
|
|
*/
|
|
|
|
|
|
|
|
static inline
|
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
|
|
|
int ompi_attr_hash_init(opal_hash_table_t **hash)
|
2004-05-30 20:21:44 +04:00
|
|
|
{
|
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
|
|
|
*hash = OBJ_NEW(opal_hash_table_t);
|
|
|
|
if (NULL == hash) {
|
2005-12-09 08:14:18 +03:00
|
|
|
fprintf(stderr, "Error while creating the local attribute list\n");
|
|
|
|
return MPI_ERR_SYSRESOURCE;
|
2004-05-30 20:21:44 +04:00
|
|
|
}
|
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
|
|
|
if (OMPI_SUCCESS != opal_hash_table_init(*hash, ATTR_HASH_SIZE)) {
|
2005-12-09 08:14:18 +03:00
|
|
|
return MPI_ERR_SYSRESOURCE;
|
2005-03-26 07:03:54 +03:00
|
|
|
}
|
2004-05-30 20:21:44 +04:00
|
|
|
|
|
|
|
return MPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
/**
|
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
|
|
|
* Initialize the main attribute hash that stores the keyvals and meta data
|
2004-03-17 02:34:41 +03:00
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI return code
|
2004-03-17 02:34:41 +03:00
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_attr_init(void);
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
/**
|
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
|
|
|
* Destroy the main attribute hash that stores the keyvals and meta data
|
2004-03-17 02:34:41 +03:00
|
|
|
*/
|
|
|
|
|
2004-08-29 13:05:14 +04:00
|
|
|
int ompi_attr_finalize(void);
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a new key for use by attribute of Comm/Win/Datatype
|
|
|
|
*
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
2004-05-30 20:21:44 +04:00
|
|
|
* @param copy_attr_fn Union variable containing the function pointer
|
|
|
|
* to be used in order to copy the attribute (IN)
|
2004-03-17 02:34:41 +03:00
|
|
|
* @param delete_attr_fn Function pointer to be used for deleting the
|
|
|
|
* attribute (IN)
|
|
|
|
* @param key The newly created key is returned here (OUT)
|
|
|
|
* @param extra_state Extra state to hang off/do some special things (IN)
|
2004-06-16 19:17:43 +04:00
|
|
|
* @param flags Flags for the key -- flags contain OMPI_KEYVAL_F77,
|
|
|
|
* OMPI_KEYVAL_PREDEFINED
|
2004-03-24 02:44:53 +03:00
|
|
|
* NOTE: I have taken the assumption that user cannot modify/delete
|
|
|
|
* any predefined keys or the attributes attached. To accomplish this,
|
2004-06-16 19:17:43 +04:00
|
|
|
* all MPI* calls will have OMPI_KEYVAL_PREDEFINED set as 0. MPI
|
2004-03-24 02:44:53 +03:00
|
|
|
* implementors who will need to play with the predefined keys and
|
2004-06-07 19:33:53 +04:00
|
|
|
* attributes would call the ompi* functions here and not the MPI*
|
2004-06-16 19:17:43 +04:00
|
|
|
* functions, with OMPI_KEYVAL_PREDEFINED set to 1.
|
2004-03-24 02:44:53 +03:00
|
|
|
* END OF NOTE
|
|
|
|
*
|
2004-05-30 20:21:44 +04:00
|
|
|
* NOTE: For the function pointers, you need to create a variable of the
|
2004-06-07 19:33:53 +04:00
|
|
|
* union type "ompi_attribute_fn_ptr_union_t" and assign the proper field.
|
2004-05-30 20:21:44 +04:00
|
|
|
* to be passed into this function
|
|
|
|
* END OF NOTE
|
|
|
|
*
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI return code
|
2004-03-24 02:44:53 +03:00
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2007-04-26 13:34:41 +04:00
|
|
|
OMPI_DECLSPEC int ompi_attr_create_keyval(ompi_attribute_type_t type,
|
|
|
|
ompi_attribute_fn_ptr_union_t copy_attr_fn,
|
|
|
|
ompi_attribute_fn_ptr_union_t delete_attr_fn,
|
|
|
|
int *key, void *extra_state, int flags,
|
|
|
|
ompi_attribute_keyval_destructor_fn_t *destructor);
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free an attribute keyval
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param key key, which is set to MPI_KEY_INVALID (IN/OUT)
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI error code
|
2004-03-17 02:34:41 +03:00
|
|
|
*/
|
|
|
|
|
2004-10-14 22:06:40 +04:00
|
|
|
int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key,
|
|
|
|
bool predefined);
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
/**
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* Set an attribute on the comm/win/datatype in a form valid for C.
|
|
|
|
*
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param object The actual Comm/Win/Datatype object (IN)
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN/OUT)
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* @param key Key val for the attribute (IN)
|
|
|
|
* @param attribute The actual attribute pointer (IN)
|
|
|
|
* @param predefined Whether the key is predefined or not 0/1 (IN)
|
|
|
|
* @param need_lock Whether we need to need to lock the keyval_lock or not
|
|
|
|
* @return OMPI error code
|
|
|
|
*
|
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
|
|
|
* If (*attr_hash) == NULL, a new hash will be created and
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* initialized.
|
|
|
|
*
|
|
|
|
* Note that need_lock should *always* be true when this function is
|
|
|
|
* invoked from an top-level MPI function. It is only false when this
|
|
|
|
* function is invoked internally (i.e., when we already hold the
|
|
|
|
* relevant locks, and we don't want to try to lock them again,
|
|
|
|
* recursively).
|
|
|
|
*
|
|
|
|
* All three of these functions (ompi_attr_set_c(),
|
|
|
|
* ompi_attr_set_fortran_mpi1(), and ompi_attr_set_fortran_mpi2())
|
|
|
|
* could have been combined into one function that took some kind of
|
|
|
|
* (void*) and an enum to indicate which way to translate the final
|
|
|
|
* representation, but that just seemed to make an already complicated
|
|
|
|
* situation more complicated through yet another layer of
|
|
|
|
* indirection.
|
|
|
|
*
|
|
|
|
* So yes, this is more code, but it's clearer and less error-prone
|
|
|
|
* (read: better) this way.
|
|
|
|
*/
|
|
|
|
int ompi_attr_set_c(ompi_attribute_type_t type, void *object,
|
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
|
|
|
opal_hash_table_t **attr_hash,
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
int key, void *attribute, bool predefined, bool need_lock);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set an attribute on the comm/win/datatype in a form valid for
|
|
|
|
* Fortran MPI-1.
|
|
|
|
*
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param object The actual Comm/Win/Datatype object (IN)
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN/OUT)
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* @param key Key val for the attribute (IN)
|
|
|
|
* @param attribute The actual attribute pointer (IN)
|
|
|
|
* @param predefined Whether the key is predefined or not 0/1 (IN)
|
|
|
|
* @param need_lock Whether we need to need to lock the keyval_lock or not
|
|
|
|
* @return OMPI error code
|
|
|
|
*
|
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
|
|
|
* If (*attr_hash) == NULL, a new hash will be created and
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* initialized.
|
|
|
|
*
|
|
|
|
* Note that need_lock should *always* be true when this function is
|
|
|
|
* invoked from an top-level MPI function. It is only false when this
|
|
|
|
* function is invoked internally (i.e., when we already hold the
|
|
|
|
* relevant locks, and we don't want to try to lock them again,
|
|
|
|
* recursively).
|
|
|
|
*
|
|
|
|
* All three of these functions (ompi_attr_set_c(),
|
|
|
|
* ompi_attr_set_fortran_mpi1(), and ompi_attr_set_fortran_mpi2())
|
|
|
|
* could have been combined into one function that took some kind of
|
|
|
|
* (void*) and an enum to indicate which way to translate the final
|
|
|
|
* representation, but that just seemed to make an already complicated
|
|
|
|
* situation more complicated through yet another layer of
|
|
|
|
* indirection.
|
|
|
|
*
|
|
|
|
* So yes, this is more code, but it's clearer and less error-prone
|
|
|
|
* (read: better) this way.
|
|
|
|
*/
|
2007-04-26 13:34:41 +04:00
|
|
|
OMPI_DECLSPEC int ompi_attr_set_fortran_mpi1(ompi_attribute_type_t type, void *object,
|
|
|
|
opal_hash_table_t **attr_hash,
|
|
|
|
int key, MPI_Fint attribute,
|
|
|
|
bool predefined, bool need_lock);
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set an attribute on the comm/win/datatype in a form valid for
|
|
|
|
* Fortran MPI-2.
|
|
|
|
*
|
2004-03-17 02:34:41 +03:00
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param object The actual Comm/Win/Datatype object (IN)
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN/OUT)
|
2004-03-17 02:34:41 +03:00
|
|
|
* @param key Key val for the attribute (IN)
|
|
|
|
* @param attribute The actual attribute pointer (IN)
|
|
|
|
* @param predefined Whether the key is predefined or not 0/1 (IN)
|
2004-10-14 22:06:40 +04:00
|
|
|
* @param need_lock Whether we need to need to lock the keyval_lock or not
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI error code
|
2004-03-17 02:34:41 +03:00
|
|
|
*
|
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
|
|
|
* If (*attr_hash) == NULL, a new hash will be created and
|
2004-10-07 05:26:40 +04:00
|
|
|
* initialized.
|
|
|
|
*
|
2004-10-14 22:06:40 +04:00
|
|
|
* Note that need_lock should *always* be true when this function is
|
|
|
|
* invoked from an top-level MPI function. It is only false when this
|
|
|
|
* function is invoked internally (i.e., when we already hold the
|
|
|
|
* relevant locks, and we don't want to try to lock them again,
|
|
|
|
* recursively).
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
*
|
|
|
|
* All three of these functions (ompi_attr_set_c(),
|
|
|
|
* ompi_attr_set_fortran_mpi1(), and ompi_attr_set_fortran_mpi2())
|
|
|
|
* could have been combined into one function that took some kind of
|
|
|
|
* (void*) and an enum to indicate which way to translate the final
|
|
|
|
* representation, but that just seemed to make an already complicated
|
|
|
|
* situation more complicated through yet another layer of
|
|
|
|
* indirection.
|
|
|
|
*
|
|
|
|
* So yes, this is more code, but it's clearer and less error-prone
|
|
|
|
* (read: better) this way.
|
|
|
|
*/
|
2007-04-26 13:34:41 +04:00
|
|
|
OMPI_DECLSPEC int ompi_attr_set_fortran_mpi2(ompi_attribute_type_t type, void *object,
|
|
|
|
opal_hash_table_t **attr_hash,
|
|
|
|
int key, MPI_Aint attribute,
|
|
|
|
bool predefined, bool need_lock);
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get an attribute on the comm/win/datatype in a form valid for C.
|
|
|
|
*
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN)
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* @param key Key val for the attribute (IN)
|
|
|
|
* @param attribute The actual attribute pointer (OUT)
|
|
|
|
* @param flag Flag whether an attribute is associated
|
|
|
|
* with the key (OUT)
|
|
|
|
* @return OMPI error code
|
|
|
|
*
|
|
|
|
* All three of these functions (ompi_attr_get_c(),
|
|
|
|
* ompi_attr_get_fortran_mpi1(), and ompi_attr_get_fortran_mpi2())
|
|
|
|
* could have been combined into one function that took some kind of
|
|
|
|
* (void*) and an enum to indicate which way to translate the final
|
|
|
|
* representation, but that just seemed to make an already complicated
|
|
|
|
* situation more complicated through yet another layer of
|
|
|
|
* indirection.
|
|
|
|
*
|
|
|
|
* So yes, this is more code, but it's clearer and less error-prone
|
|
|
|
* (read: better) this way.
|
|
|
|
*/
|
|
|
|
|
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
|
|
|
int ompi_attr_get_c(opal_hash_table_t *attr_hash, int key,
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
void **attribute, int *flag);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get an attribute on the comm/win/datatype in a form valid for
|
|
|
|
* Fortran MPI-1.
|
|
|
|
*
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN)
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* @param key Key val for the attribute (IN)
|
|
|
|
* @param attribute The actual attribute pointer (OUT)
|
|
|
|
* @param flag Flag whether an attribute is associated
|
|
|
|
* with the key (OUT)
|
|
|
|
* @return OMPI error code
|
|
|
|
*
|
|
|
|
* All three of these functions (ompi_attr_get_c(),
|
|
|
|
* ompi_attr_get_fortran_mpi1(), and ompi_attr_get_fortran_mpi2())
|
|
|
|
* could have been combined into one function that took some kind of
|
|
|
|
* (void*) and an enum to indicate which way to translate the final
|
|
|
|
* representation, but that just seemed to make an already complicated
|
|
|
|
* situation more complicated through yet another layer of
|
|
|
|
* indirection.
|
|
|
|
*
|
|
|
|
* So yes, this is more code, but it's clearer and less error-prone
|
|
|
|
* (read: better) this way.
|
2004-03-17 02:34:41 +03:00
|
|
|
*/
|
|
|
|
|
2007-04-26 13:34:41 +04:00
|
|
|
OMPI_DECLSPEC int ompi_attr_get_fortran_mpi1(opal_hash_table_t *attr_hash, int key,
|
|
|
|
MPI_Fint *attribute, int *flag);
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
/**
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* Get an attribute on the comm/win/datatype in a form valid for
|
|
|
|
* Fortran MPI-2.
|
|
|
|
*
|
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
|
|
|
* @param attrhash The attribute hash table hanging on the object(IN)
|
2004-03-17 02:34:41 +03:00
|
|
|
* @param key Key val for the attribute (IN)
|
2004-05-30 20:21:44 +04:00
|
|
|
* @param attribute The actual attribute pointer (OUT)
|
|
|
|
* @param flag Flag whether an attribute is associated
|
|
|
|
* with the key (OUT)
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI error code
|
2004-03-17 02:34:41 +03:00
|
|
|
*
|
Submitted by: Jeff "I love MPI attributes" Squyres
Reviewed by: Brian "MPI attributes ROCK" Barrett
Bunches of changes to the attribute engine:
- After many hours of discussion about MPI attributes, we came to the
conclusion that MPI-2 Example 4.13 (the C->Fortran example) is just
wrong. If you accept that, the rest of the text makes much more
sense.
- There are 9 inter-language cases: all combinations of (read, write)
with C, Fortran MPI-1, and Fortran MPI-2 for each value. Each of
the 9 cases have specific code for what is supposed to happen (and
is labeled in the code with comments). There is a *lengthy* comment
at the top of src/attribute/attribute.c that describes all of this.
- All predefined attributes are now treated as if they were put from
MPI-1 Fortran calls, with the exception of the window predefined
attributes (which are irrelevant on the beta, because there is no
one-sided support; preliminary fixes included in this patch, but
will be fully addressed on the trunk)
- MPI API calls (particularly the Fortran wrappers) are now
fundamentally simpler -- they do *not* call the back-end MPI C API
calls; instead, they call directly back into the attribute engine.
- The MPI_LASTUSEDCODE attribute only exists on MPI_COMM_WORLD and is
updated appropriately when user error classes are added.
--> Note: Edgar made a suggestion that for communicator attributes,
we ignore the communicator argument when retrieving attributes
and simply return the value. This will likely only happen on
the trunk, and will alleviate (from the user's perspective) the
restriction that LASTUSEDCODE is only on MPI_COMM_WORLD.
- The predefined attributes are now "better". We create keyvals
separately than assigning values, and correctly distinguish between
comm, type, and win attributes. Initial values are now set as if
they were called from MPI-1 fortran.
- Added a comment to the top of src/attribute/attribute_predefined.c
explaining what each of the predefined attributes were and what OMPI
sets them to be.
This commit was SVN r6193.
2005-06-27 23:17:11 +04:00
|
|
|
* All three of these functions (ompi_attr_get_c(),
|
|
|
|
* ompi_attr_get_fortran_mpi1(), and ompi_attr_get_fortran_mpi2())
|
|
|
|
* could have been combined into one function that took some kind of
|
|
|
|
* (void*) and an enum to indicate which way to translate the final
|
|
|
|
* representation, but that just seemed to make an already complicated
|
|
|
|
* situation more complicated through yet another layer of
|
|
|
|
* indirection.
|
|
|
|
*
|
|
|
|
* So yes, this is more code, but it's clearer and less error-prone
|
|
|
|
* (read: better) this way.
|
2004-03-17 02:34:41 +03:00
|
|
|
*/
|
|
|
|
|
2007-04-26 13:34:41 +04:00
|
|
|
OMPI_DECLSPEC int ompi_attr_get_fortran_mpi2(opal_hash_table_t *attr_hash, int key,
|
|
|
|
MPI_Aint *attribute, int *flag);
|
2004-03-17 02:34:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete an attribute on the comm/win/datatype
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param object The actual Comm/Win/Datatype object (IN)
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN)
|
2004-03-17 02:34:41 +03:00
|
|
|
* @param key Key val for the attribute (IN)
|
2004-05-30 20:21:44 +04:00
|
|
|
* @param predefined Whether the key is predefined or not 0/1 (IN)
|
2004-10-14 22:06:40 +04:00
|
|
|
* @param need_lock Whether we need to need to lock the keyval_lock or not
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI error code
|
2004-03-17 02:34:41 +03:00
|
|
|
*
|
2004-10-14 22:06:40 +04:00
|
|
|
* Note that need_lock should *always* be true when this function is
|
|
|
|
* invoked from an top-level MPI function. It is only false when this
|
|
|
|
* function is invoked internally (i.e., when we already hold the
|
|
|
|
* relevant locks, and we don't want to try to lock them again,
|
|
|
|
* recursively).
|
2004-03-17 02:34:41 +03:00
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_attr_delete(ompi_attribute_type_t type, void *object,
|
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
|
|
|
opal_hash_table_t *attr_hash , int key,
|
2004-10-14 22:06:40 +04:00
|
|
|
bool predefined, bool need_lock);
|
2004-03-17 02:34:41 +03:00
|
|
|
|
2004-03-24 02:44:53 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This to be used from functions like MPI_*_DUP inorder to copy all
|
|
|
|
* the attributes from the old Comm/Win/Dtype object to a new
|
|
|
|
* object.
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param old_object The old COMM/WIN/DTYPE object (IN)
|
|
|
|
* @param new_object The new COMM/WIN/DTYPE object (IN)
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on old object(IN)
|
|
|
|
* @param newattr_hash The attribute hash table hanging on new object(IN)
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI error code
|
2004-03-24 02:44:53 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object,
|
2007-02-23 03:54:41 +03:00
|
|
|
void *new_object, opal_hash_table_t *oldattr_hash,
|
|
|
|
opal_hash_table_t *newkeyhash);
|
2004-03-24 02:44:53 +03:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This to be used to delete all the attributes from the Comm/Win/Dtype
|
|
|
|
* object in one shot
|
|
|
|
* @param type Type of attribute (COMM/WIN/DTYPE) (IN)
|
|
|
|
* @param object The COMM/WIN/DTYPE object (IN)
|
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
|
|
|
* @param attr_hash The attribute hash table hanging on the object(IN)
|
2004-06-07 19:33:53 +04:00
|
|
|
* @return OMPI error code
|
2004-03-24 02:44:53 +03:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
int ompi_attr_delete_all(ompi_attribute_type_t type, void *object,
|
2007-02-23 03:54:41 +03:00
|
|
|
opal_hash_table_t *attr_hash);
|
2004-03-24 02:44:53 +03:00
|
|
|
|
|
|
|
|
2004-09-16 04:00:09 +04:00
|
|
|
/**
|
|
|
|
* \internal
|
|
|
|
*
|
|
|
|
* Create all the predefined attributes
|
|
|
|
*
|
|
|
|
* @returns OMPI_SUCCESS
|
|
|
|
*/
|
|
|
|
int ompi_attr_create_predefined(void);
|
|
|
|
|
2006-02-27 18:15:48 +03:00
|
|
|
/**
|
|
|
|
* \internal
|
|
|
|
*
|
|
|
|
* Free all the predefined attributes
|
|
|
|
*
|
|
|
|
* @returns OMPI_SUCCESS
|
|
|
|
*/
|
|
|
|
int ompi_attr_free_predefined(void);
|
|
|
|
|
2004-11-20 22:12:43 +03:00
|
|
|
/**
|
|
|
|
* \internal
|
|
|
|
* Callback function to get data from registry and create predefined attributes
|
|
|
|
*
|
|
|
|
* @returns Nothing
|
|
|
|
*/
|
|
|
|
void ompi_attr_create_predefined_callback(
|
2007-02-23 03:54:41 +03:00
|
|
|
orte_gpr_notify_data_t *data,
|
|
|
|
void *cbdata);
|
2004-11-20 22:12:43 +03:00
|
|
|
|
|
|
|
|
2004-03-17 02:34:41 +03:00
|
|
|
#if defined(c_plusplus) || defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-01-12 19:08:46 +03:00
|
|
|
|
2004-06-07 19:33:53 +04:00
|
|
|
#endif /* OMPI_ATTRIBUTE_H */
|