OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

osc_base_obj_convert.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University.
3 * All rights reserved.
4 * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
5 * All rights reserved.
6 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
7 * University of Stuttgart. All rights reserved.
8 * Copyright (c) 2004-2005 The Regents of the University of California.
9 * All rights reserved.
10 * $COPYRIGHT$
11 *
12 * Additional copyrights may follow
13 *
14 * $HEADER$
15 */
16
17 /**
18 * @file
19 *
20 * Utility functions for Open MPI object manipulation by the One-sided code
21 *
22 * Utility functions for creating / finding handles for Open MPI
23 * objects, usually based on indexes sent from remote peers.
24 */
25
26 #include "ompi_config.h"
27 #include "ompi/datatype/ompi_datatype.h"
28 #include "ompi/proc/proc.h"
29 #include "ompi/op/op.h"
30
31 BEGIN_C_DECLS
32
33 /**
34 * Create datatype based on packed payload
35 *
36 * Create a useable MPI datatype based on it's packed description.
37 * The datatype is owned by the calling process and must be
38 * OBJ_RELEASEd when no longer in use.
39 *
40 * @param remote_proc The ompi_proc_t pointer for the remote process
41 * @param payload A pointer to the pointer to the payload. The
42 * pointer to the payload will be moved past the
43 * datatype information upon successful return.
44 *
45 * @retval NULL A failure occrred
46 * @retval non-NULL A fully operational datatype
47 */
48 static inline
49 struct ompi_datatype_t*
50 ompi_osc_base_datatype_create(ompi_proc_t *remote_proc, void **payload)
51 {
52 struct ompi_datatype_t *datatype =
53 ompi_datatype_create_from_packed_description(payload, remote_proc);
54 if (NULL == datatype) return NULL;
55 if (ompi_datatype_is_predefined(datatype)) OBJ_RETAIN(datatype);
56 return datatype;
57 }
58
59
60 /**
61 * Create datatype based on Fortran Index
62 *
63 * Create a useable MPI datatype based on it's Fortran index, which is
64 * globally the same for predefined operations. The op handle is
65 * owned by the calling process and must be OBJ_RELEASEd when no
66 * longer in use.
67 *
68 * @param op_id The fortran index for the operaton
69 *
70 * @retval NULL A failure occrred
71 * @retval non-NULL An op handle
72 */
73 static inline
74 ompi_op_t *
75 ompi_osc_base_op_create(int op_id)
76 {
77 ompi_op_t *op = MPI_Op_f2c(op_id);
78 OBJ_RETAIN(op);
79 return op;
80 }
81
82
83 /**
84 * Get the primitive datatype information for a legal one-sided accumulate datatype
85 *
86 * Get the primitive datatype information for a legal one-sided
87 * accumulate datatype. This includes the primitive datatype used to
88 * build the datatype (there can be only one) and the number of
89 * instances of that primitive datatype in the datatype (there can be
90 * many).
91 *
92 * @param datatype legal one-sided datatype
93 * @param prim_datatype The primitive datatype used to build datatype
94 * @param prim_count Number of instances of prim_datattpe in datatype
95 *
96 * @retval OMPI_SUCCESS Success
97 */
98 OMPI_DECLSPEC int ompi_osc_base_get_primitive_type_info(ompi_datatype_t *datatype,
99 ompi_datatype_t **prim_datatype,
100 uint32_t *prim_count);
101
102
103 /**
104 * Apply the operation specified from inbuf to outbut
105 *
106 * Apply the specified reduction operation from inbuf to outbuf.
107 * inbuf must contain count instances of datatype, in the local
108 * process's binary mode.
109 *
110 * @retval OMPI_SUCCESS Success
111 * @retval OMPI_ERR_NOT_SUPPORTED Called with op == ompi_mpi_op_replace
112 */
113 OMPI_DECLSPEC int ompi_osc_base_process_op(void *outbuf,
114 void *inbuf,
115 size_t inbuflen,
116 struct ompi_datatype_t *datatype,
117 int count,
118 ompi_op_t *op);
119
120 END_C_DECLS
ompi_datatype_t
Definition: ompi_datatype.h:68
proc.h
Process identification structure interface.
ompi_proc_t
Remote Open MPI process structure.
Definition: proc.h:56
OBJ_RETAIN
#define OBJ_RETAIN(object)
Retain an object (by incrementing its reference count)
Definition: opal_object.h:278
ompi_osc_base_datatype_create
static BEGIN_C_DECLS struct ompi_datatype_t * ompi_osc_base_datatype_create(ompi_proc_t *remote_proc, void **payload)
Create datatype based on packed payload.
Definition: osc_base_obj_convert.h:50
op.h
Public interface for the MPI_Op handle.
ompi_osc_base_process_op
OMPI_DECLSPEC int ompi_osc_base_process_op(void *outbuf, void *inbuf, size_t inbuflen, struct ompi_datatype_t *datatype, int count, ompi_op_t *op)
Apply the operation specified from inbuf to outbut.
Definition: osc_base_obj_convert.c:180
ompi_osc_base_op_create
static ompi_op_t * ompi_osc_base_op_create(int op_id)
Create datatype based on Fortran Index.
Definition: osc_base_obj_convert.h:75
ompi_osc_base_get_primitive_type_info
OMPI_DECLSPEC int ompi_osc_base_get_primitive_type_info(ompi_datatype_t *datatype, ompi_datatype_t **prim_datatype, uint32_t *prim_count)
Get the primitive datatype information for a legal one-sided accumulate datatype. ...
Definition: osc_base_obj_convert.c:38
ompi_op_t
Back-end type of MPI_Op.
Definition: op.h:100