OpenMPI 0.1.1

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

- File List
- Globals

pml_base_sendreq.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2007 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2005 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2006 Cisco Systems, Inc. All rights reserved.
13 * Copyright (c) 2010-2012 Oak Ridge National Labs. All rights reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 */
20 /**
21 * @file
22 */
23 #ifndef MCA_PML_BASE_SEND_REQUEST_H
24 #define MCA_PML_BASE_SEND_REQUEST_H
25
26 #include "ompi_config.h"
27 #include "ompi/mca/pml/pml.h"
28 #include "ompi/mca/pml/base/pml_base_request.h"
29 #include "opal/datatype/opal_convertor.h"
30 #include "ompi/peruse/peruse-internal.h"
31
32 BEGIN_C_DECLS
33
34 /**
35 * Base type for send requests
36 */
37 struct mca_pml_base_send_request_t {
38 mca_pml_base_request_t req_base; /**< base request type - common data structure for use by wait/test */
39 void *req_addr; /**< pointer to send buffer - may not be application buffer */
40 size_t req_bytes_packed; /**< packed size of a message given the datatype and count */
41 mca_pml_base_send_mode_t req_send_mode; /**< type of send */
42 };
43 typedef struct mca_pml_base_send_request_t mca_pml_base_send_request_t;
44
45 OMPI_DECLSPEC OBJ_CLASS_DECLARATION( mca_pml_base_send_request_t );
46
47 /**
48 * Initialize a send request with call parameters.
49 *
50 * @param request (IN) Send request
51 * @param addr (IN) User buffer
52 * @param count (IN) Number of elements of indicated datatype.
53 * @param datatype (IN) User defined datatype
54 * @param peer (IN) Destination rank
55 * @param tag (IN) User defined tag
56 * @param comm (IN) Communicator
57 * @param mode (IN) Send mode (STANDARD,BUFFERED,SYNCHRONOUS,READY)
58 * @param persistent (IN) Is request persistent.
59 * @param convertor_flags (IN) Flags to pass to convertor
60 *
61 * Perform a any one-time initialization. Note that per-use initialization
62 * is done in the send request start routine.
63 */
64
65 #define MCA_PML_BASE_SEND_REQUEST_INIT( request, \
66 addr, \
67 count, \
68 datatype, \
69 peer, \
70 tag, \
71 comm, \
72 mode, \
73 persistent, \
74 convertor_flags) \
75 { \
76 /* increment reference counts */ \
77 OBJ_RETAIN(comm); \
78 \
79 OMPI_REQUEST_INIT(&(request)->req_base.req_ompi, persistent); \
80 (request)->req_base.req_ompi.req_mpi_object.comm = comm; \
81 (request)->req_base.req_ompi.req_peer = peer; \
82 (request)->req_base.req_ompi.req_tag = tag; \
83 (request)->req_addr = addr; \
84 (request)->req_send_mode = mode; \
85 (request)->req_base.req_addr = addr; \
86 (request)->req_base.req_count = count; \
87 (request)->req_base.req_datatype = datatype; \
88 (request)->req_base.req_peer = (int32_t)peer; \
89 (request)->req_base.req_tag = (int32_t)tag; \
90 (request)->req_base.req_comm = comm; \
91 /* (request)->req_base.req_proc is set on request allocation */ \
92 (request)->req_base.req_pml_complete = OPAL_INT_TO_BOOL(persistent); \
93 (request)->req_base.req_free_called = false; \
94 (request)->req_base.req_ompi.req_status._cancelled = 0; \
95 (request)->req_bytes_packed = 0; \
96 \
97 /* initialize datatype convertor for this request */ \
98 if( count > 0 ) { \
99 OBJ_RETAIN(datatype); \
100 /* We will create a convertor specialized for the */ \
101 /* remote architecture and prepared with the datatype. */ \
102 opal_convertor_copy_and_prepare_for_send( \
103 (request)->req_base.req_proc->proc_convertor, \
104 &((request)->req_base.req_datatype->super), \
105 (request)->req_base.req_count, \
106 (request)->req_base.req_addr, \
107 convertor_flags, \
108 &(request)->req_base.req_convertor ); \
109 opal_convertor_get_packed_size( &(request)->req_base.req_convertor, \
110 &((request)->req_bytes_packed) );\
111 } \
112 }
113
114 /**
115 * Mark the request as started from the PML base point of view.
116 *
117 * @param request (IN) The send request.
118 */
119
120 #define MCA_PML_BASE_SEND_START( request ) \
121 do { \
122 (request)->req_pml_complete = false; \
123 (request)->req_ompi.req_complete = false; \
124 (request)->req_ompi.req_state = OMPI_REQUEST_ACTIVE; \
125 (request)->req_ompi.req_status._cancelled = 0; \
126 (request)->req_ompi.req_status.MPI_ERROR = OMPI_SUCCESS; \
127 (request)->req_ompi.req_mpi_object.comm = (request)->req_comm; \
128 (request)->req_ompi.req_peer = (request)->req_peer; \
129 } while (0)
130
131 /**
132 * Release the ref counts on the communicator and datatype.
133 *
134 * @param request (IN) The send request.
135 */
136
137 #define MCA_PML_BASE_SEND_REQUEST_FINI( request ) \
138 do { \
139 OMPI_REQUEST_FINI(&(request)->req_base.req_ompi); \
140 OBJ_RELEASE((request)->req_base.req_comm); \
141 if( 0 != (request)->req_base.req_count ) \
142 OBJ_RELEASE((request)->req_base.req_datatype); \
143 opal_convertor_cleanup( &((request)->req_base.req_convertor) ); \
144 } while (0)
145
146
147 END_C_DECLS
148
149 #endif
150
pml.h
P2P Management Layer (PML)
pml_base_request.h
mca_pml_base_send_request_t::req_addr
void * req_addr
pointer to send buffer - may not be application buffer
Definition: pml_base_sendreq.h:39
mca_pml_base_send_request_t::req_base
mca_pml_base_request_t req_base
base request type - common data structure for use by wait/test
Definition: pml_base_sendreq.h:38
mca_pml_base_send_request_t
Base type for send requests.
Definition: pml_base_sendreq.h:37
mca_pml_base_send_request_t::req_bytes_packed
size_t req_bytes_packed
packed size of a message given the datatype and count
Definition: pml_base_sendreq.h:40
mca_pml_base_send_request_t::req_send_mode
mca_pml_base_send_mode_t req_send_mode
type of send
Definition: pml_base_sendreq.h:41
mca_pml_base_request_t
Type of request.
Definition: pml_base_request.h:57
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236