NAME
MMPPIICCoommmmccrreeaatteekkeeyyvvaall - Generates a new attribute key.
SSYYNNTTAAXX CC SSyynnttaaxx#include
int MPICommcreatekeyval(MPICommcopyattrfunction *commcopyattrfn, MPICommdeleteattrfunction *commdeleteattrfn, int *commkeyval, void *extrastate) FFoorrttrraann SSyynnttaaxx ((sseeee FFOORRTTRRAANN 7777 NNOOTTEESS)) INCLUDE 'mpif.h' MPICOMMCREATEKEYVAL(COMMCOPYATTRFN, COMMDELETEATTRFN,COMMKEYVAL, EXTRASTATE, IERROR)
EXTERNAL COMMCOPYATTRFN, COMMDELETEATTRFNINTEGER COMMKEYVAL, IERROR
INTEGER(KIND=MPIADDRESSKIND) EXTRASTATE CC++++ SSyynnttaaxx#include
static in MPI::Comm::Createkeyval(MPI::Comm::Copyattrfunction* commcopyattrfn, MPI::Comm::Deleteattrfunction* commdeleteattrfn, void* extrastate) IINNPPUUTT PPAARRAAMMEETTEERRSS commcopyattrfn Copy callback function for commkeyval (function). commdeleteattrfn Delete callback function for commkeyval (function). extrastate Extra state for callback functions. OOUUTTPPUUTT PPAARRAAMMEETTEERR commkeyval Key value for future access (integer).IERROR Fortran only: Error status (integer).
DESCRIPTION
This function replaces MPIKeyvalcreate, the use of which is depre-
cated. The C binding is identical. The Fortran binding differs in thatextrastate is an address-sized integer. Also, the copy and delete
callback functions have Fortran bindings that are consistent withaddress-sized attributes.
The argument commcopyattrfn may be specified as MPICOMMNULLCOPYFN or MPICOMMDUPFN from C, C++, or Fortran.MPICOMMNULLCOPYFN is a function that does nothing more than return-
ing flag = 0 and MPISUCCESS. MPICOMMDUPFN is a simple-minded copy
function that sets flag = 1, returns the value of attributevalin inattributevalout, and returns MPISUCCESS. These replace the MPI-1
predefined callbacks MPINULLCOPYFN and MPIDUPFN, the use of which is deprecated. The C callback functions are: typedef int MPICommcopyattrfunction(MPIComm oldcomm, int commkeyval, void *extrastate, void *attributevalin, void *attributevalout, int *flag); and typedef int MPICommdeleteattrfunction(MPIComm comm, int commkeyval, void *attributeval, void *extrastate);which are the same as the MPI-1.1 calls but with a new name. The old
names are deprecated. The Fortran callback functions are: SUBROUTINE COMMCOPYATTRFN(OLDCOMM, COMMKEYVAL, EXTRASTATE,ATTRIBUTEVALIN, ATTRIBUTEVALOUT, FLAG, IERROR)
INTEGER OLDCOMM, COMMKEYVAL, IERROR
INTEGER(KIND=MPIADDRESSKIND) EXTRASTATE, ATTRIBUTEVALIN, ATTRIBUTEVALOUT LOGICAL FLAG and SUBROUTINE COMMDELETEATTRFN(COMM, COMMKEYVAL, ATTRIBUTEVAL, EXTRASTATE,IERROR)
INTEGER COMM, COMMKEYVAL, IERROR
INTEGER(KIND=MPIADDRESSKIND) ATTRIBUTEVAL, EXTRASTATE The C++ callbacks are: typedef int MPI::Comm::Copyattrfunction(const MPI::Comm& oldcomm, int commkeyval, void* extrastate, void* attributevalin, void* attributevalout, bool& flag); and typedef int MPI::Comm::Deleteattrfunction(MPI::Comm& comm, int commkeyval, void* attributeval, void* extrastate); FFOORRTTRRAANN 7777 NNOOTTEESS The MPI standard prescribes portable Fortran syntax for the EXTRASTATEargument only for Fortran 90. FORTRAN 77 users may use the non-portable
syntax INTEGER*MPIADDRESSKIND EXTRASTATE where MPIADDRESSKIND is a constant defined in mpif.h and gives the length of the declared integer in bytes. EERRRROORRSS Almost all MPI routines return an error value; C routines as the valueof the function and Fortran routines in the last argument. C++ func-
tions do not return errors. If the default error handler is set toMPI::ERRORSTHROWEXCEPTIONS, then on error the C++ exception mechanism
will be used to throw an MPI:Exception object. Before the error value is returned, the current MPI error handler is called. By default, this error handler aborts the MPI job, except for I/O function errors. The error handler may be changed withMPICommseterrhandler; the predefined error handler MPIERRORSRETURN
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. See the MPI man page for a full list of MPI error codes.SEE ALSO
Open MPI 1.2 September 2006MPICommcreatekeyval(3OpenMPI)