File: message.c

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (87 lines) | stat: -rw-r--r-- 2,707 bytes parent folder | download | duplicates (2)
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
82
83
84
85
86
87
/* -*- 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 (c) 2018      Triad National Security, LLC. 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"
#include "ompi/instance/instance.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);

static int ompi_message_finalize (void);

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

    ompi_mpi_instance_append_finalize (ompi_message_finalize);

    return rc;
}

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