|
Packit Service |
c5cf8c |
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
|
|
Packit Service |
c5cf8c |
/*
|
|
Packit Service |
c5cf8c |
* (C) 2001 by Argonne National Laboratory.
|
|
Packit Service |
c5cf8c |
* See COPYRIGHT in top-level directory.
|
|
Packit Service |
c5cf8c |
*
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#ifndef MPIR_ATTR_H_INCLUDED
|
|
Packit Service |
c5cf8c |
#define MPIR_ATTR_H_INCLUDED
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Because Comm, Datatype, and File handles are all ints, and because
|
|
Packit Service |
c5cf8c |
attributes are otherwise identical between the three types, we
|
|
Packit Service |
c5cf8c |
only store generic copy and delete functions. This allows us to use
|
|
Packit Service |
c5cf8c |
common code for the attribute set, delete, and dup functions */
|
|
Packit Service |
c5cf8c |
/*E
|
|
Packit Service |
c5cf8c |
copy_function - MPID Structure to hold an attribute copy function
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Notes:
|
|
Packit Service |
c5cf8c |
The appropriate element of this union is selected by using the language
|
|
Packit Service |
c5cf8c |
field of the 'keyval'.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Because 'MPI_Comm', 'MPI_Win', and 'MPI_Datatype' are all 'int's in
|
|
Packit Service |
c5cf8c |
MPICH, we use a single C copy function rather than have separate
|
|
Packit Service |
c5cf8c |
ones for the Communicator, Window, and Datatype attributes.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
There are no corresponding typedefs for the Fortran functions. The
|
|
Packit Service |
c5cf8c |
F77 function corresponds to the Fortran 77 binding used in MPI-1 and the
|
|
Packit Service |
c5cf8c |
F90 function corresponds to the Fortran 90 binding used in MPI-2.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Module:
|
|
Packit Service |
c5cf8c |
Attribute-DS
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
E*/
|
|
Packit Service |
c5cf8c |
int
|
|
Packit Service |
c5cf8c |
MPII_Attr_copy_c_proxy(MPI_Comm_copy_attr_function * user_function,
|
|
Packit Service |
c5cf8c |
int handle,
|
|
Packit Service |
c5cf8c |
int keyval,
|
|
Packit Service |
c5cf8c |
void *extra_state,
|
|
Packit Service |
c5cf8c |
MPIR_Attr_type attrib_type, void *attrib, void **attrib_copy, int *flag);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct copy_function {
|
|
Packit Service |
c5cf8c |
int (*C_CopyFunction) (int, int, void *, void *, void *, int *);
|
|
Packit Service |
c5cf8c |
void (*F77_CopyFunction) (MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *,
|
|
Packit Service |
c5cf8c |
MPI_Fint *, MPI_Fint *, MPI_Fint *);
|
|
Packit Service |
c5cf8c |
void (*F90_CopyFunction) (MPI_Fint *, MPI_Fint *, MPI_Aint *, MPI_Aint *,
|
|
Packit Service |
c5cf8c |
MPI_Aint *, MPI_Fint *, MPI_Fint *);
|
|
Packit Service |
c5cf8c |
/* The generic lang-independent user_function and proxy will
|
|
Packit Service |
c5cf8c |
* replace the lang dependent copy funcs above
|
|
Packit Service |
c5cf8c |
* Currently the lang-indpendent funcs are used only for keyvals
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
MPI_Comm_copy_attr_function *user_function;
|
|
Packit Service |
c5cf8c |
MPII_Attr_copy_proxy *proxy;
|
|
Packit Service |
c5cf8c |
/* The C++ function is the same as the C function */
|
|
Packit Service |
c5cf8c |
} copy_function;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*E
|
|
Packit Service |
c5cf8c |
delete_function - MPID Structure to hold an attribute delete function
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Notes:
|
|
Packit Service |
c5cf8c |
The appropriate element of this union is selected by using the language
|
|
Packit Service |
c5cf8c |
field of the 'keyval'.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Because 'MPI_Comm', 'MPI_Win', and 'MPI_Datatype' are all 'int's in
|
|
Packit Service |
c5cf8c |
MPICH, we use a single C delete function rather than have separate
|
|
Packit Service |
c5cf8c |
ones for the Communicator, Window, and Datatype attributes.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
There are no corresponding typedefs for the Fortran functions. The
|
|
Packit Service |
c5cf8c |
F77 function corresponds to the Fortran 77 binding used in MPI-1 and the
|
|
Packit Service |
c5cf8c |
F90 function corresponds to the Fortran 90 binding used in MPI-2.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Module:
|
|
Packit Service |
c5cf8c |
Attribute-DS
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
E*/
|
|
Packit Service |
c5cf8c |
int
|
|
Packit Service |
c5cf8c |
MPII_Attr_delete_c_proxy(MPI_Comm_delete_attr_function * user_function,
|
|
Packit Service |
c5cf8c |
int handle,
|
|
Packit Service |
c5cf8c |
int keyval, MPIR_Attr_type attrib_type, void *attrib, void *extra_state);
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
typedef struct delete_function {
|
|
Packit Service |
c5cf8c |
int (*C_DeleteFunction) (int, int, void *, void *);
|
|
Packit Service |
c5cf8c |
void (*F77_DeleteFunction) (MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *, MPI_Fint *);
|
|
Packit Service |
c5cf8c |
void (*F90_DeleteFunction) (MPI_Fint *, MPI_Fint *, MPI_Aint *, MPI_Aint *, MPI_Fint *);
|
|
Packit Service |
c5cf8c |
/* The generic lang-independent user_function and proxy will
|
|
Packit Service |
c5cf8c |
* replace the lang dependent copy funcs above
|
|
Packit Service |
c5cf8c |
* Currently the lang-indpendent funcs are used only for keyvals
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
MPI_Comm_delete_attr_function *user_function;
|
|
Packit Service |
c5cf8c |
MPII_Attr_delete_proxy *proxy;
|
|
Packit Service |
c5cf8c |
} delete_function;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/*S
|
|
Packit Service |
c5cf8c |
MPII_Keyval - Structure of an MPID keyval
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Module:
|
|
Packit Service |
c5cf8c |
Attribute-DS
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
S*/
|
|
Packit Service |
c5cf8c |
typedef struct MPII_Keyval {
|
|
Packit Service |
c5cf8c |
MPIR_OBJECT_HEADER; /* adds handle and ref_count fields */
|
|
Packit Service |
c5cf8c |
MPII_Object_kind kind;
|
|
Packit Service |
c5cf8c |
int was_freed;
|
|
Packit Service |
c5cf8c |
void *extra_state;
|
|
Packit Service |
c5cf8c |
copy_function copyfn;
|
|
Packit Service |
c5cf8c |
delete_function delfn;
|
|
Packit Service |
c5cf8c |
/* other, device-specific information */
|
|
Packit Service |
c5cf8c |
#ifdef MPID_DEV_KEYVAL_DECL
|
|
Packit Service |
c5cf8c |
MPID_DEV_KEYVAL_DECL
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
} MPII_Keyval;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPII_Keyval_add_ref(_keyval) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_Object_add_ref(_keyval); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#define MPII_Keyval_release_ref(_keyval, _inuse) \
|
|
Packit Service |
c5cf8c |
do { \
|
|
Packit Service |
c5cf8c |
MPIR_Object_release_ref(_keyval, _inuse); \
|
|
Packit Service |
c5cf8c |
} while (0)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Attribute values in C/C++ are void * and in Fortran are ADDRESS_SIZED
|
|
Packit Service |
c5cf8c |
integers. Normally, these are the same size, but in at least one
|
|
Packit Service |
c5cf8c |
case, the address-sized integers was selected as longer than void *
|
|
Packit Service |
c5cf8c |
to work with the datatype code used in the I/O library. While this
|
|
Packit Service |
c5cf8c |
is really a limitation in the current Datatype implementation. */
|
|
Packit Service |
c5cf8c |
#ifdef USE_AINT_FOR_ATTRVAL
|
|
Packit Service |
c5cf8c |
typedef MPI_Aint MPII_Attr_val_t;
|
|
Packit Service |
c5cf8c |
#else
|
|
Packit Service |
c5cf8c |
typedef void *MPII_Attr_val_t;
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
/* Attributes need no ref count or handle, but since we want to use the
|
|
Packit Service |
c5cf8c |
common block allocator for them, we must provide those elements
|
|
Packit Service |
c5cf8c |
*/
|
|
Packit Service |
c5cf8c |
/*S
|
|
Packit Service |
c5cf8c |
MPIR_Attribute - Structure of an MPID attribute
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Notes:
|
|
Packit Service |
c5cf8c |
Attributes don''t have 'ref_count's because they don''t have reference
|
|
Packit Service |
c5cf8c |
count semantics. That is, there are no shallow copies or duplicates
|
|
Packit Service |
c5cf8c |
of an attibute. An attribute is copied when the communicator that
|
|
Packit Service |
c5cf8c |
it is attached to is duplicated. Subsequent operations, such as
|
|
Packit Service |
c5cf8c |
'MPI_Comm_attr_free', can change the attribute list for one of the
|
|
Packit Service |
c5cf8c |
communicators but not the other, making it impractical to keep the
|
|
Packit Service |
c5cf8c |
same list. (We could defer making the copy until the list is changed,
|
|
Packit Service |
c5cf8c |
but even then, there would be no reference count on the individual
|
|
Packit Service |
c5cf8c |
attributes.)
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
A pointer to the keyval, rather than the (integer) keyval itself is
|
|
Packit Service |
c5cf8c |
used since there is no need within the attribute structure to make
|
|
Packit Service |
c5cf8c |
it any harder to find the keyval structure.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The attribute value is a 'void *'. If 'sizeof(MPI_Fint)' > 'sizeof(void*)',
|
|
Packit Service |
c5cf8c |
then this must be changed (no such system has been encountered yet).
|
|
Packit Service |
c5cf8c |
For the Fortran 77 routines in the case where 'sizeof(MPI_Fint)' <
|
|
Packit Service |
c5cf8c |
'sizeof(void*)', the high end of the 'void *' value is used. That is,
|
|
Packit Service |
c5cf8c |
we cast it to 'MPI_Fint *' and use that value.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
MPI defines three kinds of attributes (see MPI 2.1, Section 16.3, pages
|
|
Packit Service |
c5cf8c |
487-488 (the standard says two, but there are really three, as discussed
|
|
Packit Service |
c5cf8c |
below). These are pointer-valued attributes and two types of integer-valued
|
|
Packit Service |
c5cf8c |
attributes.
|
|
Packit Service |
c5cf8c |
Pointer-valued attributes are used in C.
|
|
Packit Service |
c5cf8c |
Integer-valued attributes are used in Fortran. These are of type either
|
|
Packit Service |
c5cf8c |
INTEGER or INTEGER(KIND=MPI_ADDRESS_KIND).
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
The predefined attributes are a combination of INTEGER and pointers.
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
Module:
|
|
Packit Service |
c5cf8c |
Attribute-DS
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
S*/
|
|
Packit Service |
c5cf8c |
typedef struct MPIR_Attribute {
|
|
Packit Service |
c5cf8c |
MPIR_OBJECT_HEADER; /* adds handle and ref_count fields */
|
|
Packit Service |
c5cf8c |
MPII_Keyval *keyval; /* Keyval structure for this attribute */
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
struct MPIR_Attribute *next; /* Pointer to next in the list */
|
|
Packit Service |
c5cf8c |
MPIR_Attr_type attrType; /* Type of the attribute */
|
|
Packit Service |
c5cf8c |
long pre_sentinal; /* Used to detect user errors in accessing
|
|
Packit Service |
c5cf8c |
* the value */
|
|
Packit Service |
c5cf8c |
MPII_Attr_val_t value; /* Stored value. An Aint must be at least
|
|
Packit Service |
c5cf8c |
* as large as an address - some builds
|
|
Packit Service |
c5cf8c |
* may make an Aint larger than a void * */
|
|
Packit Service |
c5cf8c |
long post_sentinal; /* Like pre_sentinal */
|
|
Packit Service |
c5cf8c |
/* other, device-specific information */
|
|
Packit Service |
c5cf8c |
#ifdef MPID_DEV_ATTR_DECL
|
|
Packit Service |
c5cf8c |
MPID_DEV_ATTR_DECL
|
|
Packit Service |
c5cf8c |
#endif
|
|
Packit Service |
c5cf8c |
} MPIR_Attribute;
|
|
Packit Service |
c5cf8c |
|
|
Packit Service |
c5cf8c |
#endif /* MPIR_ATTR_H_INCLUDED */
|