OpenMPI 0.1.1

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

- File List
- Globals

btl_gm_frag.h
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$
13 *
14 * Additional copyrights may follow
15 *
16 * $HEADER$
17 */
18
19 #ifndef MCA_BTL_GM_FRAG_H
20 #define MCA_BTL_GM_FRAG_H
21
22
23 #define MCA_BTL_GM_FRAG_ALIGN (8)
24 #include "ompi_config.h"
25 #include "btl_gm.h"
26 #include "ompi/mca/btl/base/btl_base_error.h"
27
28
29 BEGIN_C_DECLS
30
31 typedef enum {
32 MCA_BTL_GM_EAGER,
33 MCA_BTL_GM_SEND,
34 MCA_BTL_GM_PUT,
35 MCA_BTL_GM_GET
36 } mca_btl_gm_frag_type_t;
37
38
39 /**
40 * GM send fragment derived type.
41 */
42 struct mca_btl_gm_frag_t {
43 mca_btl_base_descriptor_t base;
44 mca_btl_base_segment_t segment;
45 struct mca_btl_gm_module_t* btl;
46 struct mca_btl_base_endpoint_t *endpoint;
47 struct mca_mpool_base_registration_t* registration;
48 mca_btl_base_header_t *hdr;
49 size_t size;
50 enum gm_priority priority;
51 mca_btl_gm_frag_type_t type;
52
53 };
54 typedef struct mca_btl_gm_frag_t mca_btl_gm_frag_t;
55
56 OBJ_CLASS_DECLARATION(mca_btl_gm_frag_t);
57
58 typedef struct mca_btl_gm_frag_t mca_btl_gm_frag_eager_t;
59
60 OBJ_CLASS_DECLARATION(mca_btl_gm_frag_eager_t);
61
62 typedef struct mca_btl_gm_frag_t mca_btl_gm_frag_max_t;
63
64 OBJ_CLASS_DECLARATION(mca_btl_gm_frag_max_t);
65
66 typedef struct mca_btl_gm_frag_t mca_btl_gm_frag_user_t;
67
68 OBJ_CLASS_DECLARATION(mca_btl_gm_frag_user_t);
69
70 /*
71 * Macros to allocate/return descriptors from module specific
72 * free list(s).
73 */
74
75 #define MCA_BTL_GM_FRAG_ALLOC_EAGER(btl, frag, rc) \
76 { \
77 \
78 ompi_free_list_item_t *item; \
79 OMPI_FREE_LIST_GET(&((mca_btl_gm_module_t*)btl)->gm_frag_eager, item, rc); \
80 frag = (mca_btl_gm_frag_t*) item; \
81 }
82
83 #define MCA_BTL_GM_FRAG_ALLOC_MAX(btl, frag, rc) \
84 { \
85 \
86 ompi_free_list_item_t *item; \
87 OMPI_FREE_LIST_GET(&((mca_btl_gm_module_t*)btl)->gm_frag_max, item, rc); \
88 frag = (mca_btl_gm_frag_t*) item; \
89 }
90
91 #define MCA_BTL_GM_FRAG_ALLOC_USER(btl, frag, rc) \
92 { \
93 ompi_free_list_item_t *item; \
94 OMPI_FREE_LIST_GET(&((mca_btl_gm_module_t*)btl)->gm_frag_user, item, rc); \
95 frag = (mca_btl_gm_frag_t*) item; \
96 }
97
98 #define MCA_BTL_GM_FRAG_RETURN(btl, frag) \
99 do { \
100 ompi_free_list_t* mylist = NULL; \
101 mca_btl_gm_module_t* btl_gm = (mca_btl_gm_module_t*) btl; \
102 mca_btl_gm_frag_t* frag_gm = (mca_btl_gm_frag_t*) frag; \
103 switch(frag_gm->type) { \
104 case MCA_BTL_GM_EAGER: \
105 mylist = &btl_gm->gm_frag_eager; \
106 break; \
107 case MCA_BTL_GM_SEND: \
108 mylist = &btl_gm->gm_frag_max; \
109 break; \
110 case MCA_BTL_GM_PUT: \
111 case MCA_BTL_GM_GET: \
112 mylist = &btl_gm->gm_frag_user; \
113 break; \
114 default: \
115 BTL_ERROR(("Unknown frag type\n")); \
116 break; \
117 } \
118 OMPI_FREE_LIST_RETURN(mylist, \
119 (ompi_free_list_item_t*)(frag)); \
120 } while (0);
121
122
123 /* called with mca_btl_gm_component.gm_lock held */
124
125 #define MCA_BTL_GM_FRAG_POST(btl,frag) \
126 do { \
127 if(opal_list_get_size(&btl->gm_repost) < (size_t)btl->gm_num_repost) { \
128 opal_list_append(&btl->gm_repost, (opal_list_item_t*)frag); \
129 } else { \
130 do { \
131 gm_provide_receive_buffer(btl->port, frag->hdr, frag->size, frag->priority); \
132 } while (NULL != (frag = (mca_btl_gm_frag_t*)opal_list_remove_first(&btl->gm_repost))); \
133 } \
134 } while(0)
135
136
137
138 END_C_DECLS
139 #endif
btl_gm.h
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_btl_base_header_t
Definition: btl.h:321
mca_btl_gm_frag_t
GM send fragment derived type.
Definition: btl_gm_frag.h:42
mca_mpool_base_registration_t
Definition: mpool.h:44
mca_btl_base_endpoint_t
State of ELAN endpoint connection.
Definition: btl_elan_endpoint.h:33
mca_btl_gm_module_t
BTL Module Interface.
Definition: btl_gm.h:77
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