OpenMPI  0.1.1
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"
17 
18 BEGIN_C_DECLS
19 
20 struct ompi_communicator_t;
21 
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;
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 
41  struct ompi_message_t message;
42  char padding[PREDEFINED_MESSAGE_PAD - sizeof(ompi_message_t)];
43 };
44 
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
57 ompi_message_alloc(void)
58 {
59  int rc;
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
int m_f_to_c_index
Fortran handle for this message.
Definition: message.h:24
struct ompi_communicator_t * comm
communicator used in probe
Definition: message.h:25
dynamic pointer array
Definition: opal_pointer_array.h:45
size_t count
same value as status._ucount
Definition: message.h:28
See opal_bitmap.h for an explanation of why there is a split between OPAL and ORTE for this generic c...
Definition: message.h:40
opal_free_list_item_t super
Base type.
Definition: message.h:23
Definition: opal_free_list.h:47
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
void * req_ptr
PML data.
Definition: message.h:26
Definition: opal_free_list.h:31
int peer
peer, same as status.MPI_SOURCE
Definition: message.h:27
Definition: communicator.h:118
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236
Definition: message.h:22