[97] | 1 | .\"Copyright 2006-2008 Sun Microsystems, Inc. |
---|
| 2 | .\"Copyright (c) 1996 Thinking Machines |
---|
| 3 | .TH MPI_Type_create_keyval 3 "Dec 08, 2009" "1.4" "Open MPI" |
---|
| 4 | .SH NAME |
---|
| 5 | \fBMPI_Type_create_keyval\fP \- Generates a new attribute key for caching on data types. |
---|
| 6 | |
---|
| 7 | .SH SYNTAX |
---|
| 8 | .ft R |
---|
| 9 | .SH C Syntax |
---|
| 10 | .nf |
---|
| 11 | #include <mpi.h> |
---|
| 12 | int MPI_Type_create_keyval(MPI_Type_copy_attr_function *\fItype_copy_attr_fn\fP, |
---|
| 13 | MPI_Type_delete_attr_function *\fItype_delete_attr_fn\fP, |
---|
| 14 | int *\fItype_keyval\fP, void *\fIextra_state\fP) |
---|
| 15 | |
---|
| 16 | .SH Fortran Syntax (see FORTRAN 77 NOTES) |
---|
| 17 | .nf |
---|
| 18 | INCLUDE 'mpif.h' |
---|
| 19 | MPI_TYPE_CREATE_KEYVAL(\fITYPE_COPY_ATTR_FN, TYPE_DELETE_ATTR_FN, |
---|
| 20 | TYPE_KEYVAL, EXTRA_STATE, IERROR\fP) |
---|
| 21 | EXTERNAL \fITYPE_COPY_ATTR_FN, TYPE_DELETE_ATTR_FN\fP |
---|
| 22 | INTEGER \fITYPE_KEYVAL, IERROR \fP |
---|
| 23 | INTEGER(KIND=MPI_ADDRESS_KIND) \fIEXTRA_STATE\fP |
---|
| 24 | |
---|
| 25 | .SH C++ Syntax |
---|
| 26 | .nf |
---|
| 27 | #include <mpi.h> |
---|
| 28 | static int MPI::Datatype::Create_keyval(MPI::Datatype::Copy_attr_function* |
---|
| 29 | \fItype_copy_attr_fn\fP, MPI::Datatype::Delete_attr_function* |
---|
| 30 | \fItype_delete_attr_fn\fP, void* \fIextra_state\fP) |
---|
| 31 | |
---|
| 32 | .SH INPUT PARAMETERS |
---|
| 33 | .ft R |
---|
| 34 | .TP 1i |
---|
| 35 | type_copy_attr_fn |
---|
| 36 | Copy callback function for \fItype_keyval\fP (function). |
---|
| 37 | .TP 1i |
---|
| 38 | type_delete_attr_fn |
---|
| 39 | Delete callback function for \fItype_keyval\fP (function). |
---|
| 40 | .TP 1i |
---|
| 41 | extra_state |
---|
| 42 | Extra state for callback functions. |
---|
| 43 | |
---|
| 44 | .SH OUTPUT PARAMETERS |
---|
| 45 | .ft R |
---|
| 46 | .TP 1i |
---|
| 47 | type_keyval |
---|
| 48 | Key value for future access (integer). |
---|
| 49 | .TP 1i |
---|
| 50 | IERROR |
---|
| 51 | Fortran only: Error status (integer). |
---|
| 52 | |
---|
| 53 | .SH DESCRIPTION |
---|
| 54 | .ft R |
---|
| 55 | MPI_Type_create_keyval generates a new attribute key for caching on data types. This routine partially replaces MPI_Keyval_create. |
---|
| 56 | .sp |
---|
| 57 | The argument \fItype_copy_attr_fn\fP may be specified as MPI_TYPE_NULL_COPY_FN or MPI_TYPE_DUP_FN from C, C++, or Fortran. MPI_TYPE_NULL_COPY_FN is a function that does nothing other than returning \fIflag\fP = 0 and MPI_SUCCESS. MPI_TYPE_DUP_FN is a simple-minded copy function that sets \fIflag\fP = 1, returns the value of \fIattribute_val_in\fP in \fIattribute_val_out\fP, and returns MPI_SUCCESS. |
---|
| 58 | .sp |
---|
| 59 | The argument \fItype_delete_attr_fn\fP may be specified as MPI_TYPE_NULL_DELETE_FN from C, C++, or Fortran. MPI_TYPE_NULL_DELETE_FN is a function that does nothing beyond returning MPI_SUCCESS. |
---|
| 60 | The C callback functions are: |
---|
| 61 | .sp |
---|
| 62 | .nf |
---|
| 63 | typedef int MPI_Type_copy_attr_function(MPI_Datatype \fIoldtype\fP, |
---|
| 64 | int \fItype_keyval\fP, void *\fIextra_state\fP, void *\fIattribute_val_in\fP, |
---|
| 65 | void *\fIattribute_val_out\fP, int *\fIflag\fP); |
---|
| 66 | .fi |
---|
| 67 | and |
---|
| 68 | .nf |
---|
| 69 | typedef int MPI_Type_delete_attr_function(MPI_Datatype \fItype\fP, int \fItype_keyval\fP, |
---|
| 70 | void *\fIattribute_val\fP, void *\fIextra_state\fP); |
---|
| 71 | .fi |
---|
| 72 | .sp |
---|
| 73 | The Fortran callback functions are: |
---|
| 74 | .sp |
---|
| 75 | .nf |
---|
| 76 | SUBROUTINE TYPE_COPY_ATTR_FN(\fIOLDTYPE, TYPE_KEYVAL, EXTRA_STATE, |
---|
| 77 | ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, FLAG, IERROR\fP) |
---|
| 78 | INTEGER \fIOLDTYPE, TYPE KEYVAL, IERROR\fP |
---|
| 79 | INTEGER(KIND=MPI_ADDRESS_KIND) \fIEXTRA_STATE, |
---|
| 80 | ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT\fP |
---|
| 81 | LOGICAL \fIFLAG\fP |
---|
| 82 | .fi |
---|
| 83 | and |
---|
| 84 | .nf |
---|
| 85 | SUBROUTINE TYPE_DELETE_ATTR_FN(\fITYPE, TYPE_KEYVAL, ATTRIBUTE_VAL, EXTRA_STATE, |
---|
| 86 | IERROR\fP) |
---|
| 87 | INTEGER \fITYPE, TYPE_KEYVAL, IERROR\fP |
---|
| 88 | INTEGER(KIND=MPI_ADDRESS_KIND) \fIATTRIBUTE VAL, EXTRA_STATE\fP |
---|
| 89 | .fi |
---|
| 90 | .sp |
---|
| 91 | The C++ callbacks are: |
---|
| 92 | .sp |
---|
| 93 | .nf |
---|
| 94 | typedef int MPI::Datatype::Copy_attr_function(const MPI::Datatype& \fIoldtype\fP, |
---|
| 95 | int \fItype_keyval\fP, void* \fIextra_state\fP, |
---|
| 96 | const void* \fIattribute_val_in\fP, void* \fIattribute_val_out\fP, |
---|
| 97 | bool& \fIflag\fP); |
---|
| 98 | .fi |
---|
| 99 | and |
---|
| 100 | .nf |
---|
| 101 | typedef int MPI::Datatype::Delete_attr_function(MPI::Datatype& \fItype\fP, |
---|
| 102 | int \fItype_keyval\fP, void* \fIattribute_val\fP, void* \fIextra_state\fP); |
---|
| 103 | .fi |
---|
| 104 | .sp |
---|
| 105 | |
---|
| 106 | .SH FORTRAN 77 NOTES |
---|
| 107 | .ft R |
---|
| 108 | The MPI standard prescribes portable Fortran syntax for |
---|
| 109 | the \fIEXTRA_STATE\fP argument only for Fortran 90. FORTRAN 77 |
---|
| 110 | users may use the non-portable syntax |
---|
| 111 | .sp |
---|
| 112 | .nf |
---|
| 113 | INTEGER*MPI_ADDRESS_KIND \fIEXTRA_STATE\fP |
---|
| 114 | .fi |
---|
| 115 | .sp |
---|
| 116 | where MPI_ADDRESS_KIND is a constant defined in mpif.h |
---|
| 117 | and gives the length of the declared integer in bytes. |
---|
| 118 | |
---|
| 119 | .SH ERRORS |
---|
| 120 | Almost all MPI routines return an error value; C routines as the value of the function and Fortran routines in the last argument. C++ functions do not return errors. If the default error handler is set to MPI::ERRORS_THROW_EXCEPTIONS, then on error the C++ exception mechanism will be used to throw an MPI:Exception object. |
---|
| 121 | .sp |
---|
| 122 | Before the error value is returned, the current MPI error handler is |
---|
| 123 | called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed with MPI_Comm_set_errhandler; the predefined error handler MPI_ERRORS_RETURN may be used to cause error values to be returned. Note that MPI does not guarantee that an MPI program can continue past an error. |
---|
| 124 | |
---|
| 125 | .SH SEE ALSO |
---|
| 126 | .ft R |
---|
| 127 | .sp |
---|
| 128 | MPI_Type_free_keyval |
---|
| 129 | |
---|