26 #ifndef OMPI_ATTRIBUTE_H
27 #define OMPI_ATTRIBUTE_H
32 #include "ompi_config.h"
33 #include "ompi/constants.h"
37 #define ATTR_HASH_SIZE 10
42 #define OMPI_KEYVAL_PREDEFINED 0x0001
43 #define OMPI_KEYVAL_F77 0x0002
44 #define OMPI_KEYVAL_F77_MPI1 0x0004
65 typedef void (ompi_mpi1_fortran_copy_attr_function)(MPI_Fint *oldobj,
67 MPI_Fint *extra_state,
70 ompi_fortran_logical_t *flag,
72 typedef void (ompi_mpi1_fortran_delete_attr_function)(MPI_Fint *obj,
75 MPI_Fint *extra_state,
82 typedef void (ompi_mpi2_fortran_copy_attr_function)(MPI_Fint *oldobj,
87 ompi_fortran_logical_t *flag,
89 typedef void (ompi_mpi2_fortran_delete_attr_function)(MPI_Fint *obj,
100 typedef int (MPI_Comm_internal_copy_attr_function)(
MPI_Comm, int,
void *,
101 void *,
void *,
int *,
103 typedef int (MPI_Type_internal_copy_attr_function)(
MPI_Datatype, int,
void *,
104 void *,
void *,
int *,
106 typedef int (MPI_Win_internal_copy_attr_function)(
MPI_Win, int,
void *,
107 void *,
void *,
int *,
110 typedef void (ompi_attribute_keyval_destructor_fn_t)(int);
117 MPI_Comm_delete_attr_function *attr_communicator_delete_fn;
118 MPI_Type_delete_attr_function *attr_datatype_delete_fn;
119 MPI_Win_delete_attr_function *attr_win_delete_fn;
121 MPI_Comm_internal_copy_attr_function *attr_communicator_copy_fn;
122 MPI_Type_internal_copy_attr_function *attr_datatype_copy_fn;
123 MPI_Win_internal_copy_attr_function *attr_win_copy_fn;
127 ompi_mpi1_fortran_delete_attr_function *attr_mpi1_fortran_delete_fn;
128 ompi_mpi1_fortran_copy_attr_function *attr_mpi1_fortran_copy_fn;
132 ompi_mpi2_fortran_delete_attr_function *attr_mpi2_fortran_delete_fn;
133 ompi_mpi2_fortran_copy_attr_function *attr_mpi2_fortran_copy_fn;
191 fprintf(stderr,
"Error while creating the local attribute list\n");
192 return MPI_ERR_SYSRESOURCE;
195 return MPI_ERR_SYSRESOURCE;
313 int key,
void *attribute,
bool predefined);
343 int key, MPI_Fint attribute,
374 int key, MPI_Aint attribute,
400 void **attribute,
int *flag);
427 MPI_Fint *attribute,
int *flag);
454 MPI_Aint *attribute,
int *flag);
512 int ompi_attr_create_predefined(
void);
521 int ompi_attr_free_predefined(
void);
int ompi_attr_delete(ompi_attribute_type_t type, void *object, opal_hash_table_t *attr_hash, int key, bool predefined)
Delete an attribute on the comm/win/datatype.
Definition: attribute.c:668
Definition: opal_hash_table.h:42
void * bindings_extra_state
Extra state for bindings to hang data on.
Definition: attribute.h:172
static int ompi_attr_hash_init(opal_hash_table_t **hash)
Convenient way to initialize the attribute hash table per MPI-Object.
Definition: attribute.h:187
int ompi_attr_free_keyval(ompi_attribute_type_t type, int *key, bool predefined)
Free an attribute keyval.
Definition: attribute.c:634
ompi_attribute_type_t attr_type
One of COMM/WIN/DTYPE.
Definition: attribute.h:156
ompi_attribute_fn_ptr_union_t copy_attr_fn
Copy function for the attribute.
Definition: attribute.h:162
int ompi_attr_set_c(ompi_attribute_type_t type, void *object, opal_hash_table_t **attr_hash, int key, void *attribute, bool predefined)
Set an attribute on the comm/win/datatype in a form valid for C.
Definition: attribute.c:759
Definition: ompi_datatype.h:68
ompi_attribute_fortran_ptr_t extra_state
Extra state of the attribute.
Definition: attribute.h:166
The attribute belongs to a win object.
Definition: attribute.h:56
The attribute belongs to a comm object.
Definition: attribute.h:52
OMPI_DECLSPEC int ompi_attr_create_keyval_fint(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, MPI_Fint extra_state, int flags, void *bindings_extra_state)
Same as ompi_attr_create_keyval, but extra_state is a Fortran default integer.
Definition: attribute.c:602
Union to help convert between Fortran attributes (which must be stored by value) and C pointers (whic...
Definition: attribute.h:144
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)
Set an attribute on the comm/win/datatype in a form valid for Fortran MPI-2.
Definition: attribute.c:801
int ompi_attr_copy_all(ompi_attribute_type_t type, void *old_object, void *new_object, opal_hash_table_t *oldattr_hash, opal_hash_table_t *newkeyhash)
This to be used from functions like MPI_*_DUP inorder to copy all the attributes from the old Comm/Wi...
Definition: attribute.c:878
int ompi_attr_init(void)
Initialize the main attribute hash that stores the keyvals and meta data.
Definition: attribute.c:481
int key
Keep a track of which key this item belongs to, so that the key can be deleted when this object is de...
Definition: attribute.h:167
int attr_flag
flag field: contains "OMPI_KEYVAL_PREDEFINED", "OMPI_KEYVAL_F77"
Definition: attribute.h:160
ompi_attribute_type_t
Definition: attribute.h:49
The attribute belongs to datatype object.
Definition: attribute.h:55
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, void *bindings_extra_state)
Create a new key for use by attribute of Comm/Win/Datatype.
Definition: attribute.c:586
A hash table that may be indexed with either fixed length (e.g.
int ompi_attr_get_c(opal_hash_table_t *attr_hash, int key, void **attribute, int *flag)
Get an attribute on the comm/win/datatype in a form valid for C.
Definition: attribute.c:822
int ompi_attr_finalize(void)
Destroy the main attribute hash that stores the keyvals and meta data.
Definition: attribute.c:526
Base object.
Definition: opal_object.h:182
Definition: attribute.h:154
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)
Set an attribute on the comm/win/datatype in a form valid for Fortran MPI-1.
Definition: attribute.c:779
OMPI_DECLSPEC int ompi_attr_get_fortran_mpi1(opal_hash_table_t *attr_hash, int key, MPI_Fint *attribute, int *flag)
Get an attribute on the comm/win/datatype in a form valid for Fortran MPI-1.
Definition: attribute.c:841
OMPI_DECLSPEC int ompi_attr_create_keyval_aint(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, MPI_Aint extra_state, int flags, void *bindings_extra_state)
Same as ompi_attr_create_keyval, but extra_state is a Fortran address integer.
Definition: attribute.c:618
ompi_attribute_fn_ptr_union_t delete_attr_fn
Delete function for the attribute.
Definition: attribute.h:164
OPAL_DECLSPEC int opal_hash_table_init(opal_hash_table_t *ht, size_t table_size)
Initializes the table size, must be called before using the table.
Definition: opal_hash_table.c:71
Make the compilers happy when we have to construct an attribute.
Definition: attribute.h:50
Definition: attribute.h:116
OMPI_DECLSPEC int ompi_attr_get_fortran_mpi2(opal_hash_table_t *attr_hash, int key, MPI_Aint *attribute, int *flag)
Get an attribute on the comm/win/datatype in a form valid for Fortran MPI-2.
Definition: attribute.c:860
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
int ompi_attr_delete_all(ompi_attribute_type_t type, void *object, opal_hash_table_t *attr_hash)
This to be used to delete all the attributes from the Comm/Win/Dtype object in one shot...
Definition: attribute.c:981
Definition: communicator.h:118