OpenMPI 0.1.1

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

- File List
- Globals

pml_ob1_recvfrag.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-2006 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) 2008 UT-Battelle, LLC. All rights reserved.
13 * Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 */
20 /**
21 * @file
22 */
23
24 #ifndef MCA_PML_OB1_RECVFRAG_H
25 #define MCA_PML_OB1_RECVFRAG_H
26
27 #include "ompi/mca/btl/btl.h"
28 #include "pml_ob1_hdr.h"
29
30 BEGIN_C_DECLS
31
32 struct mca_pml_ob1_buffer_t {
33 size_t len;
34 void * addr;
35 };
36 typedef struct mca_pml_ob1_buffer_t mca_pml_ob1_buffer_t;
37
38
39 struct mca_pml_ob1_recv_frag_t {
40 ompi_free_list_item_t super;
41 mca_pml_ob1_hdr_t hdr;
42 size_t num_segments;
43 mca_btl_base_module_t* btl;
44 mca_btl_base_segment_t segments[MCA_BTL_DES_MAX_SEGMENTS];
45 mca_pml_ob1_buffer_t buffers[MCA_BTL_DES_MAX_SEGMENTS];
46 unsigned char addr[1];
47 };
48 typedef struct mca_pml_ob1_recv_frag_t mca_pml_ob1_recv_frag_t;
49
50 OBJ_CLASS_DECLARATION(mca_pml_ob1_recv_frag_t);
51
52
53 #define MCA_PML_OB1_RECV_FRAG_ALLOC(frag,rc) \
54 do { \
55 ompi_free_list_item_t* item; \
56 OMPI_FREE_LIST_WAIT(&mca_pml_ob1.recv_frags, item, rc); \
57 frag = (mca_pml_ob1_recv_frag_t*)item; \
58 } while(0)
59
60
61 #define MCA_PML_OB1_RECV_FRAG_INIT(frag, hdr, segs, cnt, btl ) \
62 do { \
63 size_t i, _size; \
64 mca_btl_base_segment_t* macro_segments = frag->segments; \
65 mca_pml_ob1_buffer_t* buffers = frag->buffers; \
66 unsigned char* _ptr = (unsigned char*)frag->addr; \
67 /* init recv_frag */ \
68 frag->btl = btl; \
69 frag->hdr = *(mca_pml_ob1_hdr_t*)hdr; \
70 frag->num_segments = 1; \
71 _size = segs[0].seg_len; \
72 for( i = 1; i < cnt; i++ ) { \
73 _size += segs[i].seg_len; \
74 } \
75 /* copy over data */ \
76 if(_size <= mca_pml_ob1.unexpected_limit ) { \
77 macro_segments[0].seg_addr.pval = frag->addr; \
78 } else { \
79 buffers[0].len = _size; \
80 buffers[0].addr = (char*) \
81 mca_pml_ob1.allocator->alc_alloc( mca_pml_ob1.allocator, \
82 buffers[0].len, \
83 0, NULL); \
84 _ptr = (unsigned char*)(buffers[0].addr); \
85 macro_segments[0].seg_addr.pval = buffers[0].addr; \
86 } \
87 macro_segments[0].seg_len = _size; \
88 for( i = 0; i < cnt; i++ ) { \
89 memcpy( _ptr, segs[i].seg_addr.pval, segs[i].seg_len); \
90 _ptr += segs[i].seg_len; \
91 } \
92 } while(0)
93
94
95 #define MCA_PML_OB1_RECV_FRAG_RETURN(frag) \
96 do { \
97 if( frag->segments[0].seg_len > mca_pml_ob1.unexpected_limit ) { \
98 /* return buffers */ \
99 mca_pml_ob1.allocator->alc_free( mca_pml_ob1.allocator, \
100 frag->buffers[0].addr ); \
101 } \
102 frag->num_segments = 0; \
103 \
104 /* return recv_frag */ \
105 OMPI_FREE_LIST_RETURN(&mca_pml_ob1.recv_frags, \
106 (ompi_free_list_item_t*)frag); \
107 } while(0)
108
109
110 /**
111 * Callback from BTL on receipt of a recv_frag (match).
112 */
113
114 extern void mca_pml_ob1_recv_frag_callback_match( mca_btl_base_module_t *btl,
115 mca_btl_base_tag_t tag,
116 mca_btl_base_descriptor_t* descriptor,
117 void* cbdata );
118
119 /**
120 * Callback from BTL on receipt of a recv_frag (rndv).
121 */
122
123 extern void mca_pml_ob1_recv_frag_callback_rndv( mca_btl_base_module_t *btl,
124 mca_btl_base_tag_t tag,
125 mca_btl_base_descriptor_t* descriptor,
126 void* cbdata );
127 /**
128 * Callback from BTL on receipt of a recv_frag (rget).
129 */
130
131 extern void mca_pml_ob1_recv_frag_callback_rget( mca_btl_base_module_t *btl,
132 mca_btl_base_tag_t tag,
133 mca_btl_base_descriptor_t* descriptor,
134 void* cbdata );
135
136 /**
137 * Callback from BTL on receipt of a recv_frag (ack).
138 */
139
140 extern void mca_pml_ob1_recv_frag_callback_ack( mca_btl_base_module_t *btl,
141 mca_btl_base_tag_t tag,
142 mca_btl_base_descriptor_t* descriptor,
143 void* cbdata );
144 /**
145 * Callback from BTL on receipt of a recv_frag (frag).
146 */
147
148 extern void mca_pml_ob1_recv_frag_callback_frag( mca_btl_base_module_t *btl,
149 mca_btl_base_tag_t tag,
150 mca_btl_base_descriptor_t* descriptor,
151 void* cbdata );
152 /**
153 * Callback from BTL on receipt of a recv_frag (put).
154 */
155
156 extern void mca_pml_ob1_recv_frag_callback_put( mca_btl_base_module_t *btl,
157 mca_btl_base_tag_t tag,
158 mca_btl_base_descriptor_t* descriptor,
159 void* cbdata );
160 /**
161 * Callback from BTL on receipt of a recv_frag (fin).
162 */
163
164 extern void mca_pml_ob1_recv_frag_callback_fin( mca_btl_base_module_t *btl,
165 mca_btl_base_tag_t tag,
166 mca_btl_base_descriptor_t* descriptor,
167 void* cbdata );
168
169
170 END_C_DECLS
171
172 #endif
173
mca_btl_base_descriptor_t
A descriptor that holds the parameters to a send/put/get operation along w/ a callback routine that i...
Definition: btl.h:275
mca_pml_ob1_recv_frag_t
Definition: pml_ob1_recvfrag.h:39
MCA_BTL_DES_MAX_SEGMENTS
#define MCA_BTL_DES_MAX_SEGMENTS
Maximum number of allowed segments in src/dst fields of a descriptor.
Definition: btl.h:316
mca_pml_ob1_hdr_t
Union of defined hdr types.
Definition: pml_ob1_hdr.h:359
mca_pml_ob1_recv_frag_callback_ack
void mca_pml_ob1_recv_frag_callback_ack(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (ack).
Definition: pml_ob1_recvfrag.c:286
btl.h
Byte Transfer Layer (BTL)
ompi_free_list_item_t
Definition: ompi_free_list.h:62
mca_pml_ob1_recv_frag_callback_put
void mca_pml_ob1_recv_frag_callback_put(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (put).
Definition: pml_ob1_recvfrag.c:351
mca_pml_ob1_recv_frag_callback_match
void mca_pml_ob1_recv_frag_callback_match(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (match).
Definition: pml_ob1_recvfrag.c:102
mca_pml_ob1_recv_frag_callback_fin
void mca_pml_ob1_recv_frag_callback_fin(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (fin).
Definition: pml_ob1_recvfrag.c:371
mca_pml_ob1_recv_frag_callback_rndv
void mca_pml_ob1_recv_frag_callback_rndv(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (rndv).
Definition: pml_ob1_recvfrag.c:250
mca_pml_ob1_buffer_t
Definition: pml_ob1_recvfrag.h:32
pml_ob1_hdr.h
mca_btl_base_module_t
BTL module interface functions and attributes.
Definition: btl.h:786
mca_pml_ob1_recv_frag_callback_frag
void mca_pml_ob1_recv_frag_callback_frag(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (frag).
Definition: pml_ob1_recvfrag.c:332
mca_pml_ob1_recv_frag_callback_rget
void mca_pml_ob1_recv_frag_callback_rget(mca_btl_base_module_t *btl, mca_btl_base_tag_t tag, mca_btl_base_descriptor_t *descriptor, void *cbdata)
Callback from BTL on receipt of a recv_frag (rget).
Definition: pml_ob1_recvfrag.c:267
mca_btl_base_segment_t
Describes a region/segment of memory that is addressable by an BTL.
Definition: btl.h:236
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236