2012-02-06 21:35:21 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011 Sandia National Laboratories. All rights reserved.
|
2012-02-09 02:36:28 +04:00
|
|
|
* Copyright (c) 2012 Cisco Systems, Inc. All rights reserved.
|
2012-02-06 21:35:21 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
|
2012-03-08 17:27:01 +04:00
|
|
|
#include "ompi/constants.h"
|
|
|
|
|
2012-02-06 21:35:21 +04:00
|
|
|
#include "opal/class/opal_object.h"
|
|
|
|
#include "ompi/message/message.h"
|
|
|
|
#include "ompi/constants.h"
|
|
|
|
|
2012-02-09 02:36:28 +04:00
|
|
|
static void ompi_message_constructor(ompi_message_t *msg);
|
|
|
|
|
2012-02-06 21:35:21 +04:00
|
|
|
OBJ_CLASS_INSTANCE(ompi_message_t,
|
|
|
|
opal_free_list_item_t,
|
2012-02-09 02:36:28 +04:00
|
|
|
ompi_message_constructor, NULL);
|
2012-02-06 21:35:21 +04:00
|
|
|
|
|
|
|
opal_free_list_t ompi_message_free_list;
|
|
|
|
opal_pointer_array_t ompi_message_f_to_c_table;
|
|
|
|
|
|
|
|
ompi_predefined_message_t ompi_message_null;
|
2012-03-08 17:27:01 +04:00
|
|
|
ompi_predefined_message_t ompi_message_no_proc;
|
2012-02-06 21:35:21 +04:00
|
|
|
|
2012-02-09 02:36:28 +04:00
|
|
|
static void ompi_message_constructor(ompi_message_t *msg)
|
|
|
|
{
|
|
|
|
msg->comm = NULL;
|
|
|
|
msg->req_ptr = NULL;
|
|
|
|
msg->m_f_to_c_index = MPI_UNDEFINED;
|
|
|
|
msg->count = 0;
|
|
|
|
}
|
|
|
|
|
2012-02-06 21:35:21 +04:00
|
|
|
int
|
|
|
|
ompi_message_init(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_message_free_list, opal_free_list_t);
|
|
|
|
rc = opal_free_list_init(&ompi_message_free_list,
|
|
|
|
sizeof(ompi_message_t),
|
|
|
|
OBJ_CLASS(ompi_message_t),
|
|
|
|
8, -1, 8);
|
|
|
|
|
|
|
|
OBJ_CONSTRUCT(&ompi_message_f_to_c_table, opal_pointer_array_t);
|
|
|
|
|
|
|
|
ompi_message_null.message.req_ptr = NULL;
|
|
|
|
ompi_message_null.message.count = 0;
|
|
|
|
ompi_message_null.message.m_f_to_c_index =
|
|
|
|
opal_pointer_array_add(&ompi_message_f_to_c_table, &ompi_message_null);
|
|
|
|
|
2012-03-08 17:27:01 +04:00
|
|
|
OBJ_CONSTRUCT(&ompi_message_no_proc, ompi_message_t);
|
|
|
|
ompi_message_no_proc.message.m_f_to_c_index =
|
|
|
|
opal_pointer_array_add(&ompi_message_f_to_c_table,
|
|
|
|
&ompi_message_no_proc);
|
|
|
|
if (1 != ompi_message_no_proc.message.m_f_to_c_index) {
|
|
|
|
return OMPI_ERR_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
2012-02-06 21:35:21 +04:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
ompi_message_finalize(void)
|
|
|
|
{
|
2012-03-08 17:27:01 +04:00
|
|
|
OBJ_DESTRUCT(&ompi_message_no_proc);
|
2012-02-06 21:35:21 +04:00
|
|
|
OBJ_DESTRUCT(&ompi_message_free_list);
|
|
|
|
OBJ_DESTRUCT(&ompi_message_f_to_c_table);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|