OpenMPI 0.1.1

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

- File List
- Globals

pml_csum_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) 2009 IBM Corporation. All rights reserved.
14 * Copyright (c) 2009 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22 /**
23 * @file
24 */
25
26 #ifndef MCA_PML_CSUM_RECVFRAG_H
27 #define MCA_PML_CSUM_RECVFRAG_H
28
29 #include "ompi/mca/btl/btl.h"
30 #include "pml_csum_hdr.h"
31
32 BEGIN_C_DECLS
33
34 struct mca_pml_csum_buffer_t {
35 size_t len;
36 void * addr;
37 };
38 typedef struct mca_pml_csum_buffer_t mca_pml_csum_buffer_t;
39
40
41 struct mca_pml_csum_recv_frag_t {
42 ompi_free_list_item_t super;
43 mca_pml_csum_hdr_t hdr;
44 size_t num_segments;
45 mca_btl_base_module_t* btl;
46 mca_btl_base_segment_t segments[MCA_BTL_DES_MAX_SEGMENTS];
47 mca_pml_csum_buffer_t buffers[MCA_BTL_DES_MAX_SEGMENTS];
48 unsigned char addr[1];
49 };
50 typedef struct mca_pml_csum_recv_frag_t mca_pml_csum_recv_frag_t;
51
52 OBJ_CLASS_DECLARATION(mca_pml_csum_recv_frag_t);
53
54
55 #define MCA_PML_CSUM_RECV_FRAG_ALLOC(frag,rc) \
56 do { \
57 ompi_free_list_item_t* item; \
58 OMPI_FREE_LIST_WAIT(&mca_pml_csum.recv_frags, item, rc); \
59 frag = (mca_pml_csum_recv_frag_t*)item; \
60 } while(0)
61
62
63 #define MCA_PML_CSUM_RECV_FRAG_INIT(frag, hdr, segs, cnt, btl ) \
64 do { \
65 size_t i, _size; \
66 mca_btl_base_segment_t* macro_segments = frag->segments; \
67 mca_pml_csum_buffer_t* buffers = frag->buffers; \
68 unsigned char* _ptr = (unsigned char*)frag->addr; \
69 /* init recv_frag */ \
70 frag->btl = btl; \
71 frag->hdr = *(mca_pml_csum_hdr_t*)hdr; \
72 frag->num_segments = 1; \
73 _size = segs[0].seg_len; \
74 for( i = 1; i < cnt; i++ ) { \
75 _size += segs[i].seg_len; \
76 } \
77 /* copy over data */ \
78 if(_size <= mca_pml_csum.unexpected_limit ) { \
79 macro_segments[0].seg_addr.pval = frag->addr; \
80 } else { \
81 buffers[0].len = _size; \
82 buffers[0].addr = (char*) \
83 mca_pml_csum.allocator->alc_alloc( mca_pml_csum.allocator, \
84 buffers[0].len, \
85 0, NULL); \
86 _ptr = (unsigned char*)(buffers[0].addr); \
87 macro_segments[0].seg_addr.pval = buffers[0].addr; \
88 } \
89 macro_segments[0].seg_len = _size; \
90 for( i = 0; i < cnt; i++ ) { \
91 memcpy( _ptr, segs[i].seg_addr.pval, segs[i].seg_len); \
92 _ptr += segs[i].seg_len; \
93 } \
94 } while(0)
95
96
97 #define MCA_PML_CSUM_RECV_FRAG_RETURN(frag) \
98 do { \
99 if( frag->segments[0].seg_len > mca_pml_csum.unexpected_limit ) { \
100 /* return buffers */ \
101 mca_pml_csum.allocator->alc_free( mca_pml_csum.allocator, \
102 frag->buffers[0].addr ); \
103 } \
104 frag->num_segments = 0; \
105 \
106 /* return recv_frag */ \
107 OMPI_FREE_LIST_RETURN(&mca_pml_csum.recv_frags, \
108 (ompi_free_list_item_t*)frag); \
109 } while(0)
110
111
112 /**
113 * Callback from BTL on receipt of a recv_frag (match).
114 */
115
116 extern void mca_pml_csum_recv_frag_callback_match( mca_btl_base_module_t *btl,
117 mca_btl_base_tag_t tag,
118 mca_btl_base_descriptor_t* descriptor,
119 void* cbdata );
120
121 /**
122 * Callback from BTL on receipt of a recv_frag (rndv).
123 */
124
125 extern void mca_pml_csum_recv_frag_callback_rndv( mca_btl_base_module_t *btl,
126 mca_btl_base_tag_t tag,
127 mca_btl_base_descriptor_t* descriptor,
128 void* cbdata );
129 /**
130 * Callback from BTL on receipt of a recv_frag (rget).
131 */
132
133 extern void mca_pml_csum_recv_frag_callback_rget( mca_btl_base_module_t *btl,
134 mca_btl_base_tag_t tag,
135 mca_btl_base_descriptor_t* descriptor,
136 void* cbdata );
137
138 /**
139 * Callback from BTL on receipt of a recv_frag (ack).
140 */
141
142 extern void mca_pml_csum_recv_frag_callback_ack( mca_btl_base_module_t *btl,
143 mca_btl_base_tag_t tag,
144 mca_btl_base_descriptor_t* descriptor,
145 void* cbdata );
146 /**
147 * Callback from BTL on receipt of a recv_frag (frag).
148 */
149
150 extern void mca_pml_csum_recv_frag_callback_frag( mca_btl_base_module_t *btl,
151 mca_btl_base_tag_t tag,
152 mca_btl_base_descriptor_t* descriptor,
153 void* cbdata );
154 /**
155 * Callback from BTL on receipt of a recv_frag (put).
156 */
157
158 extern void mca_pml_csum_recv_frag_callback_put( mca_btl_base_module_t *btl,
159 mca_btl_base_tag_t tag,
160 mca_btl_base_descriptor_t* descriptor,
161 void* cbdata );
162 /**
163 * Callback from BTL on receipt of a recv_frag (fin).
164 */
165
166 extern void mca_pml_csum_recv_frag_callback_fin( mca_btl_base_module_t *btl,
167 mca_btl_base_tag_t tag,
168 mca_btl_base_descriptor_t* descriptor,
169 void* cbdata );
170
171
172 END_C_DECLS
173
174 #endif
175
pml_csum_hdr.h
mca_pml_csum_recv_frag_callback_frag
void mca_pml_csum_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_csum_recvfrag.c:452
mca_pml_csum_recv_frag_callback_rget
void mca_pml_csum_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_csum_recvfrag.c:365
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_csum_recv_frag_callback_fin
void mca_pml_csum_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_csum_recvfrag.c:533
mca_pml_csum_recv_frag_callback_put
void mca_pml_csum_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_csum_recvfrag.c:491
mca_pml_csum_hdr_t
Union of defined hdr types.
Definition: pml_csum_hdr.h:298
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_csum_recv_frag_callback_match
void mca_pml_csum_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_csum_recvfrag.c:135
btl.h
Byte Transfer Layer (BTL)
mca_pml_csum_recv_frag_callback_ack
void mca_pml_csum_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_csum_recvfrag.c:384
ompi_free_list_item_t
Definition: ompi_free_list.h:62
mca_pml_csum_recv_frag_callback_rndv
void mca_pml_csum_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_csum_recvfrag.c:328
mca_pml_csum_buffer_t
Definition: pml_csum_recvfrag.h:34
mca_btl_base_module_t
BTL module interface functions and attributes.
Definition: btl.h:786
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
mca_pml_csum_recv_frag_t
Definition: pml_csum_recvfrag.h:41