2012-02-06 21:35:21 +04:00
|
|
|
/*
|
2012-03-23 02:55:59 +04:00
|
|
|
* Copyright (c) 2011-2012 Sandia National Laboratories. All rights reserved.
|
|
|
|
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
|
2012-02-06 21:35:21 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OMPI_MESSAGE_H
|
|
|
|
#define OMPI_MESSAGE_H
|
|
|
|
|
|
|
|
#include "mpi.h"
|
|
|
|
#include "opal/class/opal_free_list.h"
|
|
|
|
#include "opal/class/opal_pointer_array.h"
|
|
|
|
|
|
|
|
BEGIN_C_DECLS
|
|
|
|
|
|
|
|
struct ompi_communicator_t;
|
|
|
|
|
|
|
|
struct ompi_message_t {
|
2012-03-23 02:55:59 +04:00
|
|
|
opal_free_list_item_t super; /**< Base type */
|
|
|
|
int m_f_to_c_index; /**< Fortran handle for this message */
|
|
|
|
struct ompi_communicator_t *comm; /**< communicator used in probe */
|
|
|
|
void* req_ptr; /**< PML data */
|
|
|
|
int peer; /**< peer, same as status.MPI_SOURCE */
|
|
|
|
size_t count; /**< same value as status._ucount */
|
2012-02-06 21:35:21 +04:00
|
|
|
};
|
|
|
|
typedef struct ompi_message_t ompi_message_t;
|
|
|
|
OMPI_DECLSPEC OBJ_CLASS_DECLARATION(ompi_message_t);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Padded struct to maintain back compatibiltiy.
|
|
|
|
* See ompi/communicator/communicator.h comments with struct ompi_communicator_t
|
|
|
|
* for full explanation why we chose the following padding construct for predefines.
|
|
|
|
*/
|
|
|
|
#define PREDEFINED_MESSAGE_PAD (sizeof(void*) * 32)
|
|
|
|
|
|
|
|
struct ompi_predefined_message_t {
|
|
|
|
struct ompi_message_t message;
|
|
|
|
char padding[PREDEFINED_MESSAGE_PAD - sizeof(ompi_message_t)];
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct ompi_predefined_message_t ompi_predefined_message_t;
|
|
|
|
|
|
|
|
int ompi_message_init(void);
|
|
|
|
|
|
|
|
int ompi_message_finalize(void);
|
|
|
|
|
|
|
|
OMPI_DECLSPEC extern opal_free_list_t ompi_message_free_list;
|
|
|
|
OMPI_DECLSPEC extern opal_pointer_array_t ompi_message_f_to_c_table;
|
2012-03-08 17:27:01 +04:00
|
|
|
OMPI_DECLSPEC extern ompi_predefined_message_t ompi_message_no_proc;
|
2012-02-06 21:35:21 +04:00
|
|
|
|
|
|
|
static inline
|
|
|
|
ompi_message_t*
|
|
|
|
ompi_message_alloc(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
opal_free_list_item_t *tmp;
|
|
|
|
OPAL_FREE_LIST_GET(&ompi_message_free_list,
|
|
|
|
tmp,
|
|
|
|
rc);
|
2013-03-26 18:34:29 +04:00
|
|
|
(void)rc; /* prevent "set but not used" compiler complaints */
|
2012-02-06 21:35:21 +04:00
|
|
|
return (ompi_message_t*) tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline
|
|
|
|
void
|
|
|
|
ompi_message_return(ompi_message_t* msg)
|
|
|
|
{
|
|
|
|
if (MPI_UNDEFINED != msg->m_f_to_c_index) {
|
|
|
|
opal_pointer_array_set_item(&ompi_message_f_to_c_table,
|
|
|
|
msg->m_f_to_c_index, NULL);
|
|
|
|
msg->m_f_to_c_index = MPI_UNDEFINED;
|
|
|
|
}
|
|
|
|
|
|
|
|
OPAL_FREE_LIST_RETURN(&ompi_message_free_list,
|
|
|
|
&msg->super);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
END_C_DECLS
|
|
|
|
|
|
|
|
#endif
|