File: message.c

package info (click to toggle)
openmpi 3.1.3-11
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 118,572 kB
  • sloc: ansic: 628,972; f90: 17,993; makefile: 13,761; sh: 7,051; java: 6,360; perl: 3,215; cpp: 2,225; python: 1,350; lex: 988; fortran: 52; tcl: 12
file content (81 lines) | stat: -rw-r--r-- 2,452 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2011      Sandia National Laboratories. All rights reserved.
 * Copyright (c) 2012      Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2015      Los Alamos National Security, LLC.  All rights
 *                         reserved.
 * Copyright (c) 2015      Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"

#include "ompi/constants.h"

#include "opal/class/opal_object.h"
#include "ompi/message/message.h"
#include "ompi/constants.h"

static void ompi_message_constructor(ompi_message_t *msg);

OBJ_CLASS_INSTANCE(ompi_message_t,
                   opal_free_list_item_t,
                   ompi_message_constructor, NULL);

opal_free_list_t ompi_message_free_list = {{{0}}};
opal_pointer_array_t  ompi_message_f_to_c_table = {{0}};

ompi_predefined_message_t ompi_message_null = {{{{{0}}}}};
ompi_predefined_message_t ompi_message_no_proc = {{{{{0}}}}};

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;
}

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), 8,
                             OBJ_CLASS(ompi_message_t),
                             0, 0, 8, -1, 8, NULL, 0, NULL, NULL, NULL);

    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);

    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;
    }

    return rc;
}

int
ompi_message_finalize(void)
{
    OBJ_DESTRUCT(&ompi_message_no_proc);
    OBJ_DESTRUCT(&ompi_message_free_list);
    OBJ_DESTRUCT(&ompi_message_f_to_c_table);

    return OMPI_SUCCESS;
}