source: proiecte/hpl/openmpi_compiled/share/man/man3/MPI_Keyval_create.3 @ 97

Last change on this file since 97 was 97, checked in by (none), 14 years ago

Adding compiled files

File size: 5.9 KB
Line 
1.\"Copyright 2006-2008 Sun Microsystems, Inc.
2.\" Copyright (c) 1996 Thinking Machines Corporation
3.TH MPI_Keyval_create 3 "Dec 08, 2009" "1.4" "Open MPI"
4.SH NAME
5\fBMPI_Keyval_create\fP \- Generates a new attribute key -- use of this routine is deprecated.
6
7.SH SYNTAX
8.ft R
9.SH C Syntax
10.nf
11#include <mpi.h>
12int MPI_Keyval_create(MPI_Copy_function *\fIcopy_fn\fP,
13        MPI_Delete_function *\fIdelete_fn\fP, int *\fIkeyval\fP, void *\fIextra_state\fP)
14
15.SH Fortran Syntax
16.nf
17INCLUDE 'mpif.h'
18MPI_KEYVAL_CREATE(\fICOPY_FN, DELETE_FN, KEYVAL, EXTRA_STATE, IERROR\fP)
19        EXTERNAL        \fICOPY_FN, DELETE_FN\fP
20        INTEGER \fIKEYVAL, EXTRA_STATE, IERROR\fP
21
22
23.SH INPUT PARAMETERS
24.ft R
25.TP 1i
26copy_fn
27Copy callback function for keyval.
28.TP 1i
29delete_fn
30Delete callback function for keyval.
31.TP 1i
32extra_state
33Extra state for callback functions.
34
35.SH OUTPUT PARAMETERS
36.ft R
37.TP 1i
38keyval
39Key value for future access (integer).
40.ft R
41.TP 1i
42IERROR
43Fortran only: Error status (integer).
44
45.SH DESCRIPTION
46.ft R
47Note that use of this routine is \fIdeprecated\fP as of MPI-2. Please use MPI_Comm_create_keyval instead.
48.sp
49This deprecated routine is not available in C++.
50.sp
51Generates a new attribute key. Keys are locally unique in a process and opaque to the user, though they are explicitly stored in integers. Once allocated, the key value can be used to associate attributes and access them on any locally defined communicator.
52.sp
53The copy_fn function is invoked when a communicator is duplicated by MPI_COMM_DUP. copy_fn should be of type MPI_Copy_function, which is defined as follows:
54.sp
55.nf
56  typedef int MPI_Copy_function(MPI_Comm oldcomm, int keyval,
57                                void *extra_state, void *attribute_val_in,
58                                void *attribute_val_out, int *flag)
59
60.fi
61A Fortran declaration for such a function is as follows:
62.sp
63.nf
64  SUBROUTINE COPY_FUNCTION(OLDCOMM, KEYVAL, EXTRA_STATE, ATTRIBUTE_VAL_IN,
65              ATTRIBUTE_VAL_OUT, FLAG, IERR)
66  INTEGER OLDCOMM, KEYVAL, EXTRA_STATE,
67  ATTRIBUTE_VAL_IN, ATTRIBUTE_VAL_OUT, IERR
68  LOGICAL FLAG
69.fi
70.sp
71The copy callback function is invoked for each key value in oldcomm in arbitrary order. Each call to the copy callback is made with a key value and its corresponding attribute. If it returns flag = 0, then the attribute is deleted in the duplicated communicator. Otherwise ( flag = 1), the new attribute value is set to the value returned in attribute_val_out. The function returns MPI_SUCCESS on success and an error code on failure (in which case MPI_Comm_dup will fail).
72.sp
73copy_fn may be specified as MPI_NULL_COPY_FN or MPI_DUP_FN from either C or
74Fortran; MPI_NULL_COPY_FN is a function that does nothing other than return flag = 0, and MPI_SUCCESS. MPI_DUP_FN is a simple-minded copy function that sets flag = 1, returns the value of attribute_val_in in attribute_val_out, and returns MPI_SUCCESS.
75
76.SH NOTES
77Key values are global (available for any and all communicators).
78.sp
79There are subtle differences between C and Fortran that require that the copy_fn be written in the same language that MPI_Keyval_create is called from. This should not be a problem for most users; only programers using both Fortran and C in the same program need to be sure that they follow this rule.
80.sp
81Even though both formal arguments attribute_val_in
82and attribute_val_out are of type void*, their usage differs. The C copy function is passed by MPI in attribute_val_in the value of the attribute, and in attribute_val_out the address of the attribute, so as to allow the function to return the (new) attribute value. The use of type void* for both is to avoid messy type casts. 
83.sp
84A valid copy function is one that completely duplicates the information by making a full duplicate copy of the data structures implied by an attribute; another might just make another reference to that data structure, while using a reference-count mechanism. Other types of attributes might not copy at all (they might be specific to oldcomm only).
85.sp
86Analogous to copy_fn is a callback deletion function, defined as follows. The delete_fn function is invoked when a communicator is deleted by MPI_Comm_free or when a call is made explicitly to MPI_Attr_delete. delete_fn should be of type MPI_Delete_function, which is defined as follows:
87.sp
88.nf
89  typedef int MPI_Delete_function(MPI_Comm comm, int keyval,
90      void *attribute_val, void *extra_state);
91.fi
92.sp
93A Fortran declaration for such a function is as follows:
94.sp
95.nf
96  SUBROUTINE DELETE_FUNCTION(COMM, KEYVAL,ATTRIBUTE_VAL, EXTRA_STATE, IERR)
97      INTEGER COMM, KEYVAL, ATTRIBUTE_VAL, EXTRA_STATE, IERR
98.fi
99.sp
100This function is called by MPI_Comm_free, MPI_Attr_delete, and MPI_Attr_put to do whatever is needed to remove an attribute. The function returns MPI_SUCCESS on success and an error code on failure (in which case MPI_COMM_FREE will fail).
101.sp
102delete_fn may be specified as MPI_NULL_DELETE_FN from either C or FORTRAN; MPI_NULL_DELETE_FN is a function that does nothing, other than returning MPI_SUCCESS. 
103.sp
104The special key value MPI_KEYVAL_INVALID is never returned by MPI_Keyval_create. Therefore, it can be used for static initialization of key values.
105
106.SH ERRORS
107Almost 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.
108.sp
109Before the error value is returned, the current MPI error handler is
110called. 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. 
111
112.SH SEE ALSO
113MPI_Keyval_free
114.br
Note: See TracBrowser for help on using the repository browser.