OpenMPI 0.1.1

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

- File List
- Globals

message.h
1 /*
2 * Copyright (c) 2011-2012 Sandia National Laboratories. All rights reserved.
3 * Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
4 * $COPYRIGHT$
5 *
6 * Additional copyrights may follow
7 *
8 * $HEADER$
9 */
10
11 #ifndef OMPI_MESSAGE_H
12 #define OMPI_MESSAGE_H
13
14 #include "mpi.h"
15 #include "opal/class/opal_free_list.h"
16 #include "opal/class/opal_pointer_array.h"
17
18 BEGIN_C_DECLS
19
20 struct ompi_communicator_t;
21
22 struct ompi_message_t {
23 opal_free_list_item_t super; /**< Base type */
24 int m_f_to_c_index; /**< Fortran handle for this message */
25 struct ompi_communicator_t *comm; /**< communicator used in probe */
26 void* req_ptr; /**< PML data */
27 int peer; /**< peer, same as status.MPI_SOURCE */
28 size_t count; /**< same value as status._ucount */
29 };
30 typedef struct ompi_message_t ompi_message_t;
31 OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_message_t);
32
33 /**
34 * Padded struct to maintain back compatibiltiy.
35 * See ompi/communicator/communicator.h comments with struct ompi_communicator_t
36 * for full explanation why we chose the following padding construct for predefines.
37 */
38 #define PREDEFINED_MESSAGE_PAD (sizeof(void*) * 32)
39
40 struct ompi_predefined_message_t {
41 struct ompi_message_t message;
42 char padding[PREDEFINED_MESSAGE_PAD - sizeof(ompi_message_t)];
43 };
44
45 typedef struct ompi_predefined_message_t ompi_predefined_message_t;
46
47 int ompi_message_init(void);
48
49 int ompi_message_finalize(void);
50
51 OMPI_DECLSPEC extern opal_free_list_t ompi_message_free_list;
52 OMPI_DECLSPEC extern opal_pointer_array_t ompi_message_f_to_c_table;
53 OMPI_DECLSPEC extern ompi_predefined_message_t ompi_message_no_proc;
54
55 static inline
56 ompi_message_t*
57 ompi_message_alloc(void)
58 {
59 int rc;
60 opal_free_list_item_t *tmp;
61 OPAL_FREE_LIST_GET(&ompi_message_free_list,
62 tmp,
63 rc);
64 (void)rc;
65 return (ompi_message_t*) tmp;
66 }
67
68 static inline
69 void
70 ompi_message_return(ompi_message_t* msg)
71 {
72 if (MPI_UNDEFINED != msg->m_f_to_c_index) {
73 opal_pointer_array_set_item(&ompi_message_f_to_c_table,
74 msg->m_f_to_c_index, NULL);
75 msg->m_f_to_c_index = MPI_UNDEFINED;
76 }
77
78 OPAL_FREE_LIST_RETURN(&ompi_message_free_list,
79 &msg->super);
80 }
81
82
83 END_C_DECLS
84
85 #endif
ompi_message_t::m_f_to_c_index
int m_f_to_c_index
Fortran handle for this message.
Definition: message.h:24
ompi_message_t::comm
struct ompi_communicator_t * comm
communicator used in probe
Definition: message.h:25
opal_pointer_array_t
dynamic pointer array
Definition: opal_pointer_array.h:45
ompi_message_t::count
size_t count
same value as status._ucount
Definition: message.h:28
opal_pointer_array.h
See opal_bitmap.h for an explanation of why there is a split between OPAL and ORTE for this generic c...
ompi_predefined_message_t
Definition: message.h:40
ompi_message_t::super
opal_free_list_item_t super
Base type.
Definition: message.h:23
opal_free_list_item_t
Definition: opal_free_list.h:47
opal_pointer_array_set_item
OPAL_DECLSPEC int opal_pointer_array_set_item(opal_pointer_array_t *array, int index, void *value)
Set the value of an element in array.
Definition: opal_pointer_array.c:164
ompi_message_t::req_ptr
void * req_ptr
PML data.
Definition: message.h:26
opal_free_list_t
Definition: opal_free_list.h:31
ompi_message_t::peer
int peer
peer, same as status.MPI_SOURCE
Definition: message.h:27
ompi_communicator_t
Definition: communicator.h:118
OBJ_CLASS_DECLARATION
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
ompi_message_t
Definition: message.h:22