OpenMPI 0.1.1

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

- File List
- Globals

osc_pt2pt_replyreq.h
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 (c) 2010 Cisco Systems, Inc. All rights reserved.
11 * $COPYRIGHT$
12 *
13 * Additional copyrights may follow
14 *
15 * $HEADER$
16 */
17
18 #ifndef OMPI_OSC_PT2PT_REPLYREQ_H
19 #define OMPI_OSC_PT2PT_REPLYREQ_H
20
21 #include "osc_pt2pt.h"
22 #include "osc_pt2pt_longreq.h"
23
24 #include "opal/types.h"
25 #include "opal/class/opal_list.h"
26 #include "ompi/datatype/ompi_datatype.h"
27 #include "opal/datatype/opal_convertor.h"
28 #include "ompi/communicator/communicator.h"
29 #include "ompi/proc/proc.h"
30 #include "ompi/memchecker.h"
31
32
33 struct ompi_osc_pt2pt_replyreq_t {
34 opal_list_item_t super;
35
36 /** pointer to the module that created the replyreq */
37 ompi_osc_pt2pt_module_t *rep_module;
38
39 /** Datatype for the target side of the operation */
40 struct ompi_datatype_t *rep_target_datatype;
41 /** Convertor for the target. Always setup for send. */
42 opal_convertor_t rep_target_convertor;
43 /** packed size of message on the target side */
44 size_t rep_target_bytes_packed;
45
46 /** rank in module's communicator for origin of operation */
47 int rep_origin_rank;
48 /** pointer to the proc structure for the origin of the operation */
49 ompi_proc_t *rep_origin_proc;
50
51 ompi_ptr_t rep_origin_sendreq;
52 };
53 typedef struct ompi_osc_pt2pt_replyreq_t ompi_osc_pt2pt_replyreq_t;
54 OBJ_CLASS_DECLARATION(ompi_osc_pt2pt_replyreq_t);
55
56
57 /** allocate and populate a replyreq structure. datatype is
58 RETAINed for the life of the replyreq */
59 int
60 ompi_osc_pt2pt_replyreq_alloc_init(ompi_osc_pt2pt_module_t *module,
61 int origin,
62 ompi_ptr_t origin_request,
63 OPAL_PTRDIFF_TYPE target_displacement,
64 int target_count,
65 struct ompi_datatype_t *datatype,
66 ompi_osc_pt2pt_replyreq_t **replyreq);
67
68
69 static inline int
70 ompi_osc_pt2pt_replyreq_alloc(ompi_osc_pt2pt_module_t *module,
71 int origin_rank,
72 ompi_osc_pt2pt_replyreq_t **replyreq)
73 {
74 int ret;
75 opal_free_list_item_t *item;
76 ompi_proc_t *proc = ompi_comm_peer_lookup( module->p2p_comm, origin_rank );
77
78 /* BWB - FIX ME - is this really the right return code? */
79 if (NULL == proc) return OMPI_ERR_OUT_OF_RESOURCE;
80
81 OPAL_FREE_LIST_GET(&mca_osc_pt2pt_component.p2p_c_replyreqs,
82 item, ret);
83 if (OMPI_SUCCESS != ret) return ret;
84 *replyreq = (ompi_osc_pt2pt_replyreq_t*) item;
85
86 (*replyreq)->rep_module = module;
87 (*replyreq)->rep_origin_rank = origin_rank;
88 (*replyreq)->rep_origin_proc = proc;
89
90 return OMPI_SUCCESS;
91 }
92
93
94 static inline int
95 ompi_osc_pt2pt_replyreq_init_target(ompi_osc_pt2pt_replyreq_t *replyreq,
96 void *target_addr,
97 int target_count,
98 struct ompi_datatype_t *target_dt)
99 {
100 OBJ_RETAIN(target_dt);
101 replyreq->rep_target_datatype = target_dt;
102
103 opal_convertor_copy_and_prepare_for_send(replyreq->rep_origin_proc->proc_convertor,
104 &(target_dt->super),
105 target_count,
106 target_addr,
107 0,
108 &(replyreq->rep_target_convertor));
109 opal_convertor_get_packed_size(&replyreq->rep_target_convertor,
110 &replyreq->rep_target_bytes_packed);
111
112 return OMPI_SUCCESS;
113 }
114
115
116 static inline int
117 ompi_osc_pt2pt_replyreq_init_origin(ompi_osc_pt2pt_replyreq_t *replyreq,
118 ompi_ptr_t origin_request)
119 {
120 replyreq->rep_origin_sendreq = origin_request;
121
122 return OMPI_SUCCESS;
123 }
124
125
126 static inline int
127 ompi_osc_pt2pt_replyreq_free(ompi_osc_pt2pt_replyreq_t *replyreq)
128 {
129 MEMCHECKER(
130 memchecker_convertor_call(&opal_memchecker_base_mem_defined,
131 &replyreq->rep_target_convertor);
132 );
133 opal_convertor_cleanup(&replyreq->rep_target_convertor);
134
135 OBJ_RELEASE(replyreq->rep_target_datatype);
136
137 OPAL_FREE_LIST_RETURN(&mca_osc_pt2pt_component.p2p_c_replyreqs,
138 (opal_list_item_t*) replyreq);
139
140 return OMPI_SUCCESS;
141 }
142
143 #endif /* OMPI_OSC_PT2PT_REPLYREQ_H */
ompi_osc_pt2pt_replyreq_t::rep_target_datatype
struct ompi_datatype_t * rep_target_datatype
Datatype for the target side of the operation.
Definition: osc_pt2pt_replyreq.h:40
ompi_osc_pt2pt_replyreq_t::rep_origin_rank
int rep_origin_rank
rank in module's communicator for origin of operation
Definition: osc_pt2pt_replyreq.h:47
ompi_datatype_t
Definition: ompi_datatype.h:68
ompi_osc_pt2pt_replyreq_t::rep_target_convertor
opal_convertor_t rep_target_convertor
Convertor for the target.
Definition: osc_pt2pt_replyreq.h:42
ompi_ptr_t
Definition: types.h:52
ompi_osc_pt2pt_module_t
Definition: osc_pt2pt.h:57
opal_list.h
The opal_list_t interface is used to provide a generic doubly-linked list container for Open MPI...
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
opal_list_item_t
Definition: opal_list.h:98
OBJ_RELEASE
#define OBJ_RELEASE(object)
Release an object (by decrementing its reference count).
Definition: opal_object.h:324
opal_free_list_item_t
Definition: opal_free_list.h:47
ompi_datatype_t::super
opal_datatype_t super
Base opal_datatype_t superclass.
Definition: ompi_datatype.h:69
ompi_osc_pt2pt_module_t::p2p_comm
ompi_communicator_t * p2p_comm
communicator created with this window
Definition: osc_pt2pt.h:74
opal_convertor_t
Definition: opal_convertor.h:90
ompi_osc_pt2pt_replyreq_t::rep_origin_proc
ompi_proc_t * rep_origin_proc
pointer to the proc structure for the origin of the operation
Definition: osc_pt2pt_replyreq.h:49
ompi_osc_pt2pt_replyreq_t::rep_module
ompi_osc_pt2pt_module_t * rep_module
pointer to the module that created the replyreq
Definition: osc_pt2pt_replyreq.h:37
ompi_proc_t::proc_convertor
struct opal_convertor_t * proc_convertor
Base convertor for the proc described by this process.
Definition: proc.h:70
ompi_osc_pt2pt_replyreq_t
Definition: osc_pt2pt_replyreq.h:33
ompi_osc_pt2pt_component_t::p2p_c_replyreqs
opal_free_list_t p2p_c_replyreqs
free list of ompi_osc_pt2pt_replyreq_t structures
Definition: osc_pt2pt.h:48
ompi_osc_pt2pt_replyreq_t::rep_target_bytes_packed
size_t rep_target_bytes_packed
packed size of message on the target side
Definition: osc_pt2pt_replyreq.h:44
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236