1
/* -*- Mode: C; c-basic-offset:4 ; -*- */
3
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
4
* University Research and Technology
5
* Corporation. All rights reserved.
6
* Copyright (c) 2004-2009 The University of Tennessee and The University
7
* of Tennessee Research Foundation. All rights
9
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10
* University of Stuttgart. All rights reserved.
11
* Copyright (c) 2004-2005 The Regents of the University of California.
12
* All rights reserved.
13
* Copyright (c) 2009 IBM Corporation. All rights reserved.
14
* Copyright (c) 2009 Los Alamos National Security, LLC. All rights
16
* Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
19
* Additional copyrights may follow
24
#include "ompi_config.h"
25
#include "opal/sys/cache.h"
26
#include "opal/event/event.h"
28
#include "ompi/runtime/params.h"
29
#include "ompi/datatype/convertor.h"
30
#include "ompi/mca/pml/pml.h"
31
#include "opal/mca/base/mca_base_param.h"
33
#include "orte/util/show_help.h"
35
#include "ompi/mca/pml/base/pml_base_bsend.h"
37
#include "pml_csum_hdr.h"
38
#include "pml_csum_sendreq.h"
39
#include "pml_csum_recvreq.h"
40
#include "pml_csum_rdmafrag.h"
41
#include "pml_csum_recvfrag.h"
42
#include "ompi/mca/bml/base/base.h"
43
#include "pml_csum_component.h"
44
#include "ompi/mca/allocator/base/base.h"
46
OBJ_CLASS_INSTANCE( mca_pml_csum_pckt_pending_t,
47
ompi_free_list_item_t,
51
static int mca_pml_csum_component_open(void);
52
static int mca_pml_csum_component_close(void);
53
static mca_pml_base_module_t*
54
mca_pml_csum_component_init( int* priority, bool enable_progress_threads,
55
bool enable_mpi_threads );
56
static int mca_pml_csum_component_fini(void);
58
mca_pml_base_component_2_0_0_t mca_pml_csum_component = {
60
/* First, the mca_base_component_t struct containing meta
61
information about the component itself */
64
MCA_PML_BASE_VERSION_2_0_0,
66
"csum", /* MCA component name */
67
OMPI_MAJOR_VERSION, /* MCA component major version */
68
OMPI_MINOR_VERSION, /* MCA component minor version */
69
OMPI_RELEASE_VERSION, /* MCA component release version */
70
mca_pml_csum_component_open, /* component open */
71
mca_pml_csum_component_close /* component close */
74
/* The component is checkpoint ready */
75
MCA_BASE_METADATA_PARAM_CHECKPOINT
78
mca_pml_csum_component_init, /* component init */
79
mca_pml_csum_component_fini /* component finalize */
83
void *mca_pml_csum_seg_alloc( struct mca_mpool_base_module_t* mpool,
85
mca_mpool_base_registration_t** registration);
87
void mca_pml_csum_seg_free( struct mca_mpool_base_module_t* mpool,
90
static inline int mca_pml_csum_param_register_int(
91
const char* param_name,
94
int id = mca_base_param_register_int("pml","csum",param_name,NULL,default_value);
95
int param_value = default_value;
96
mca_base_param_lookup_int(id,¶m_value);
100
static int mca_pml_csum_component_open(void)
102
mca_allocator_base_component_t* allocator_component;
104
mca_pml_csum.free_list_num =
105
mca_pml_csum_param_register_int("free_list_num", 4);
106
mca_pml_csum.free_list_max =
107
mca_pml_csum_param_register_int("free_list_max", -1);
108
mca_pml_csum.free_list_inc =
109
mca_pml_csum_param_register_int("free_list_inc", 64);
110
mca_pml_csum.send_pipeline_depth =
111
mca_pml_csum_param_register_int("send_pipeline_depth", 3);
112
mca_pml_csum.recv_pipeline_depth =
113
mca_pml_csum_param_register_int("recv_pipeline_depth", 4);
114
mca_pml_csum.rdma_put_retries_limit =
115
mca_pml_csum_param_register_int("rdma_put_retries_limit", 5);
116
mca_pml_csum.max_rdma_per_request =
117
mca_pml_csum_param_register_int("max_rdma_per_request", 4);
118
mca_pml_csum.max_send_per_range =
119
mca_pml_csum_param_register_int("max_send_per_range", 4);
121
mca_pml_csum.unexpected_limit =
122
mca_pml_csum_param_register_int("unexpected_limit", 128);
124
mca_base_param_reg_string(&mca_pml_csum_component.pmlm_version,
126
"Name of allocator component for unexpected messages",
129
&mca_pml_csum.allocator_name);
131
allocator_component = mca_allocator_component_lookup( mca_pml_csum.allocator_name );
132
if(NULL == allocator_component) {
133
opal_output(0, "mca_pml_csum_component_open: can't find allocator: %s\n", mca_pml_csum.allocator_name);
137
mca_pml_csum.allocator = allocator_component->allocator_init(true,
138
mca_pml_csum_seg_alloc,
139
mca_pml_csum_seg_free, NULL);
140
if(NULL == mca_pml_csum.allocator) {
141
opal_output(0, "mca_pml_csum_component_open: unable to initialize allocator\n");
145
return mca_bml_base_open();
149
static int mca_pml_csum_component_close(void)
153
if (OMPI_SUCCESS != (rc = mca_bml_base_close())) {
156
if (NULL != mca_pml_csum.allocator_name) {
157
free(mca_pml_csum.allocator_name);
164
static mca_pml_base_module_t*
165
mca_pml_csum_component_init( int* priority,
166
bool enable_progress_threads,
167
bool enable_mpi_threads )
169
opal_output_verbose( 10, 0, "in csum, my priority is 0\n");
171
/* select us only if we are specified */
172
if((*priority) > 0) {
178
if(OMPI_SUCCESS != mca_bml_base_init( enable_progress_threads,
179
enable_mpi_threads)) {
183
/* Set this here (vs in component_open()) because
184
ompi_mpi_leave_pinned* may have been set after MCA params were
185
read (e.g., by the openib btl) */
186
mca_pml_csum.leave_pinned = (1 == ompi_mpi_leave_pinned);
187
mca_pml_csum.leave_pinned_pipeline = (int) ompi_mpi_leave_pinned_pipeline;
189
return &mca_pml_csum.super;
192
int mca_pml_csum_component_fini(void)
197
if(OMPI_SUCCESS != (rc = mca_bml.bml_finalize()))
200
if(!mca_pml_csum.enabled)
201
return OMPI_SUCCESS; /* never selected.. return success.. */
202
mca_pml_csum.enabled = false; /* not anymore */
204
OBJ_DESTRUCT(&mca_pml_csum.rdma_pending);
205
OBJ_DESTRUCT(&mca_pml_csum.pckt_pending);
206
OBJ_DESTRUCT(&mca_pml_csum.recv_pending);
207
OBJ_DESTRUCT(&mca_pml_csum.send_pending);
208
OBJ_DESTRUCT(&mca_pml_csum.non_existing_communicator_pending);
209
OBJ_DESTRUCT(&mca_pml_csum.buffers);
210
OBJ_DESTRUCT(&mca_pml_csum.pending_pckts);
211
OBJ_DESTRUCT(&mca_pml_csum.recv_frags);
212
OBJ_DESTRUCT(&mca_pml_csum.rdma_frags);
213
OBJ_DESTRUCT(&mca_pml_csum.lock);
215
if(OMPI_SUCCESS != (rc = mca_pml_csum.allocator->alc_finalize(mca_pml_csum.allocator))) {
220
if (mca_pml_base_send_requests.fl_num_allocated !=
221
mca_pml_base_send_requests.super.opal_list_length) {
222
opal_output(0, "csum send requests: %d allocated %d returned\n",
223
mca_pml_base_send_requests.fl_num_allocated,
224
mca_pml_base_send_requests.super.opal_list_length);
226
if (mca_pml_base_recv_requests.fl_num_allocated !=
227
mca_pml_base_recv_requests.super.opal_list_length) {
228
opal_output(0, "csum recv requests: %d allocated %d returned\n",
229
mca_pml_base_recv_requests.fl_num_allocated,
230
mca_pml_base_recv_requests.super.opal_list_length);
237
void *mca_pml_csum_seg_alloc( struct mca_mpool_base_module_t* mpool,
239
mca_mpool_base_registration_t** registration) {
240
return malloc(*size);
243
void mca_pml_csum_seg_free( struct mca_mpool_base_module_t* mpool,