File: mtl_portals_component.c

package info (click to toggle)
openmpi 1.6.5-9.1%2Bdeb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 91,628 kB
  • ctags: 44,305
  • sloc: ansic: 408,966; cpp: 44,454; sh: 27,828; makefile: 10,486; asm: 3,882; python: 1,239; lex: 805; perl: 549; csh: 253; fortran: 232; f90: 126; tcl: 12
file content (205 lines) | stat: -rw-r--r-- 7,582 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/*
 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2005 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#include "ompi_config.h"

#include "opal/event/event.h"
#include "opal/util/output.h"
#include "opal/mca/base/mca_base_param.h"
#include "ompi/mca/common/portals/common_portals.h"

#include "mtl_portals.h"
#include "mtl_portals_request.h"


static int ompi_mtl_portals_component_open(void);
static int ompi_mtl_portals_component_close(void);
static mca_mtl_base_module_t* ompi_mtl_portals_component_init(
              bool enable_progress_threads, bool enable_mpi_threads);

mca_mtl_base_component_2_0_0_t mca_mtl_portals_component = {

    /* First, the mca_base_component_t struct containing meta
     * information about the component itself */

    {
         MCA_MTL_BASE_VERSION_2_0_0,

         "portals", /* MCA component name */
         OMPI_MAJOR_VERSION,  /* MCA component major version */
         OMPI_MINOR_VERSION,  /* MCA component minor version */
         OMPI_RELEASE_VERSION,  /* MCA component release version */
         ompi_mtl_portals_component_open,  /* component open */
         ompi_mtl_portals_component_close  /* component close */
     },
     {
         /* The component is not checkpoint ready */
         MCA_BASE_METADATA_PARAM_NONE
     },

     ompi_mtl_portals_component_init,  /* component init */
};

static opal_output_stream_t mtl_portals_output_stream;

static int
ompi_mtl_portals_component_open(void)
{
    int tmp;

    ompi_common_portals_register_mca();

    ompi_mtl_portals.base.mtl_request_size = 
        sizeof(ompi_mtl_portals_request_t) -
        sizeof(struct mca_mtl_request_t);

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "eager_limit",
                           "Cross-over point from eager to rendezvous sends",
                           false,
                           false,
                           128 * 1024,
                           &tmp);

    ompi_mtl_portals.eager_limit = tmp;

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "short_recv_mds_num",
                           "Number of short message receive blocks",
                           false,
                           false,
                           3,
                           &ompi_mtl_portals.ptl_recv_short_mds_num);

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "short_recv_mds_size",
                           "Size of short message receive blocks",
                           false,
                           false,
                           15 * 1024 * 1024,
                           &ompi_mtl_portals.ptl_recv_short_mds_size);

    OBJ_CONSTRUCT(&mtl_portals_output_stream, opal_output_stream_t);
    mtl_portals_output_stream.lds_is_debugging = true;
    mtl_portals_output_stream.lds_want_stdout = true;
    mtl_portals_output_stream.lds_file_suffix = "btl-portals";
    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "debug_level",
                           "Debugging verbosity (0 - 100)",
                           false,
                           false,
                           0, 
                           &(mtl_portals_output_stream.lds_verbose_level));
    asprintf(&(mtl_portals_output_stream.lds_prefix),
             "btl: portals (%s): ", ompi_common_portals_nodeid());
    ompi_mtl_portals.portals_output = 
        opal_output_open(&mtl_portals_output_stream);

    

    ompi_mtl_portals.ptl_ni_h = PTL_INVALID_HANDLE;

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "expected_queue_size",
                           "Size of the expected receive queue in bytes",
                           false,
                           false,
                           1024,
                           &ompi_mtl_portals.ptl_expected_queue_size);

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "unexpected_queue_size",
                           "Size of the unexpected receive queue in bytes",
                           false,
                           false,
                           1024,
                           &ompi_mtl_portals.ptl_unexpected_queue_size);

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "num_copy_blocks",
                           "Number of short message copy blocks",
                           false,
                           false,
                           256,
                           &ompi_mtl_portals.ptl_num_copy_blocks);

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "copy_block_len",
                           "Length (in bytes) of each short message copy block",
                           false,
                           false,
                           8192,
                           &tmp);
    ompi_mtl_portals.ptl_copy_block_len = tmp;

    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "aggressive_polling",
                           "Turn off aggressive polling of unexpected messages",
                           false,
                           false,
                           1,
                           &tmp);
    ompi_mtl_portals.ptl_aggressive_polling = (tmp == 0) ? false : true;
    
    mca_base_param_reg_int(&mca_mtl_portals_component.mtl_version,
                           "use_rendezvous",
                           "Use a rendezvous protocol for long messages",
                           false,
                           false,
                           0,
                           &tmp);

    ompi_mtl_portals.ptl_use_rendezvous = ((tmp == 0) ? false : true);

    return OMPI_SUCCESS;
}


static int
ompi_mtl_portals_component_close(void)
{
    return OMPI_SUCCESS;
}


static mca_mtl_base_module_t*
ompi_mtl_portals_component_init(bool enable_progress_threads,
                                bool enable_mpi_threads)
{
    bool accel;
    /* we don't run with no stinkin' threads */
    if (enable_progress_threads || enable_mpi_threads) return NULL;

    /* initialize our interface */
    if (OMPI_SUCCESS != ompi_common_portals_initialize(&(ompi_mtl_portals.ptl_ni_h), &accel)) {
        return NULL;
    }

    OBJ_CONSTRUCT(&ompi_mtl_portals.event_fl, ompi_free_list_t);
    ompi_free_list_init_new(&ompi_mtl_portals.event_fl,
                        sizeof(ompi_mtl_portals_event_t),
                        opal_cache_line_size,
                        OBJ_CLASS(ompi_mtl_portals_event_t),
                        0,opal_cache_line_size,
                        1, -1, 1, NULL);

    OBJ_CONSTRUCT(&ompi_mtl_portals.ptl_recv_short_blocks, opal_list_t);
    OBJ_CONSTRUCT(&ompi_mtl_portals.unexpected_messages, opal_list_t);

    return &ompi_mtl_portals.base;
}