2010-07-13 14:46:20 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; -*- */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2009 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 (c) 2007-2010 Cisco Systems, Inc. All rights reserved.
|
|
|
|
* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
2014-05-19 14:40:18 +04:00
|
|
|
* Copyright (c) 2014 Research Organization for Information Science
|
|
|
|
* and Technology (RIST). All rights reserved.
|
2010-07-13 14:46:20 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
Update libevent to the 2.0 series, currently at 2.0.7rc. We will update to their final release when it becomes available. Currently known errors exist in unused portions of the libevent code. This revision passes the IBM test suite on a Linux machine and on a standalone Mac.
This is a fairly intrusive change, but outside of the moving of opal/event to opal/mca/event, the only changes involved (a) changing all calls to opal_event functions to reflect the new framework instead, and (b) ensuring that all opal_event_t objects are properly constructed since they are now true opal_objects.
Note: Shiqing has just returned from vacation and has not yet had a chance to complete the Windows integration. Thus, this commit almost certainly breaks Windows support on the trunk. However, I want this to have a chance to soak for as long as possible before I become less available a week from today (going to be at a class for 5 days, and thus will only be sparingly available) so we can find and fix any problems.
Biggest change is moving the libevent code from opal/event to a new opal/mca/event framework. This was done to make it much easier to update libevent in the future. New versions can be inserted as a new component and tested in parallel with the current version until validated, then we can remove the earlier version if we so choose. This is a statically built framework ala installdirs, so only one component will build at a time. There is no selection logic - the sole compiled component simply loads its function pointers into the opal_event struct.
I have gone thru the code base and converted all the libevent calls I could find. However, I cannot compile nor test every environment. It is therefore quite likely that errors remain in the system. Please keep an eye open for two things:
1. compile-time errors: these will be obvious as calls to the old functions (e.g., opal_evtimer_new) must be replaced by the new framework APIs (e.g., opal_event.evtimer_new)
2. run-time errors: these will likely show up as segfaults due to missing constructors on opal_event_t objects. It appears that it became a typical practice for people to "init" an opal_event_t by simply using memset to zero it out. This will no longer work - you must either OBJ_NEW or OBJ_CONSTRUCT an opal_event_t. I tried to catch these cases, but may have missed some. Believe me, you'll know when you hit it.
There is also the issue of the new libevent "no recursion" behavior. As I described on a recent email, we will have to discuss this and figure out what, if anything, we need to do.
This commit was SVN r23925.
2010-10-24 22:35:54 +04:00
|
|
|
#include "opal/mca/event/event.h"
|
2010-07-13 14:46:20 +04:00
|
|
|
#include "mpi.h"
|
|
|
|
#include "ompi/runtime/params.h"
|
|
|
|
#include "ompi/mca/pml/pml.h"
|
|
|
|
#include "ompi/mca/pml/base/pml_base_bsend.h"
|
|
|
|
#include "pml_bfo.h"
|
|
|
|
#include "pml_bfo_hdr.h"
|
|
|
|
#include "pml_bfo_sendreq.h"
|
|
|
|
#include "pml_bfo_recvreq.h"
|
|
|
|
#include "pml_bfo_rdmafrag.h"
|
|
|
|
#include "pml_bfo_recvfrag.h"
|
|
|
|
#include "ompi/mca/bml/base/base.h"
|
|
|
|
#include "pml_bfo_component.h"
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
#include "opal/mca/allocator/base/base.h"
|
|
|
|
#include "opal/runtime/opal_params.h"
|
2010-07-13 14:46:20 +04:00
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE( mca_pml_bfo_pckt_pending_t,
|
|
|
|
ompi_free_list_item_t,
|
|
|
|
NULL,
|
|
|
|
NULL );
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
static int mca_pml_bfo_component_register(void);
|
2010-07-13 14:46:20 +04:00
|
|
|
static int mca_pml_bfo_component_open(void);
|
|
|
|
static int mca_pml_bfo_component_close(void);
|
|
|
|
static mca_pml_base_module_t*
|
|
|
|
mca_pml_bfo_component_init( int* priority, bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads );
|
|
|
|
static int mca_pml_bfo_component_fini(void);
|
|
|
|
int mca_pml_bfo_output = 0;
|
2013-03-28 01:09:41 +04:00
|
|
|
static int mca_pml_bfo_verbose = 0;
|
2010-07-13 14:46:20 +04:00
|
|
|
|
|
|
|
mca_pml_base_component_2_0_0_t mca_pml_bfo_component = {
|
|
|
|
|
|
|
|
/* First, the mca_base_component_t struct containing meta
|
|
|
|
information about the component itself */
|
|
|
|
|
|
|
|
{
|
|
|
|
MCA_PML_BASE_VERSION_2_0_0,
|
|
|
|
|
|
|
|
"bfo", /* MCA component name */
|
|
|
|
OMPI_MAJOR_VERSION, /* MCA component major version */
|
|
|
|
OMPI_MINOR_VERSION, /* MCA component minor version */
|
|
|
|
OMPI_RELEASE_VERSION, /* MCA component release version */
|
|
|
|
mca_pml_bfo_component_open, /* component open */
|
2013-03-28 01:09:41 +04:00
|
|
|
mca_pml_bfo_component_close, /* component close */
|
|
|
|
NULL,
|
|
|
|
mca_pml_bfo_component_register
|
2010-07-13 14:46:20 +04:00
|
|
|
},
|
|
|
|
{
|
|
|
|
/* The component is checkpoint ready */
|
|
|
|
MCA_BASE_METADATA_PARAM_CHECKPOINT
|
|
|
|
},
|
|
|
|
|
|
|
|
mca_pml_bfo_component_init, /* component init */
|
|
|
|
mca_pml_bfo_component_fini /* component finalize */
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
void *mca_pml_bfo_seg_alloc( struct mca_mpool_base_module_t* mpool,
|
|
|
|
size_t* size,
|
|
|
|
mca_mpool_base_registration_t** registration);
|
|
|
|
|
|
|
|
void mca_pml_bfo_seg_free( struct mca_mpool_base_module_t* mpool,
|
|
|
|
void* segment );
|
|
|
|
|
|
|
|
static inline int mca_pml_bfo_param_register_int(
|
|
|
|
const char* param_name,
|
2013-03-28 01:09:41 +04:00
|
|
|
int default_value,
|
|
|
|
int *storage)
|
2010-07-13 14:46:20 +04:00
|
|
|
{
|
2013-03-28 01:09:41 +04:00
|
|
|
*storage = default_value;
|
|
|
|
(void) mca_base_component_var_register(&mca_pml_bfo_component.pmlm_version, param_name,
|
|
|
|
NULL, MCA_BASE_VAR_TYPE_INT, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY, storage);
|
2012-10-30 23:45:18 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
return *storage;
|
|
|
|
}
|
2012-10-30 23:45:18 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
static inline unsigned int mca_pml_bfo_param_register_uint(
|
|
|
|
const char* param_name,
|
|
|
|
unsigned int default_value,
|
|
|
|
unsigned int *storage)
|
|
|
|
{
|
|
|
|
*storage = default_value;
|
|
|
|
(void) mca_base_component_var_register(&mca_pml_bfo_component.pmlm_version, param_name,
|
|
|
|
NULL, MCA_BASE_VAR_TYPE_UNSIGNED_INT, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY, storage);
|
|
|
|
|
|
|
|
return *storage;
|
2010-07-13 14:46:20 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
static int mca_pml_bfo_component_register(void)
|
2010-07-13 14:46:20 +04:00
|
|
|
{
|
2013-03-28 01:09:41 +04:00
|
|
|
int default_priority;
|
2010-07-13 14:46:20 +04:00
|
|
|
|
2010-11-24 01:19:32 +03:00
|
|
|
#if PML_BFO
|
2013-03-28 01:09:41 +04:00
|
|
|
default_priority = 5;
|
2010-11-24 01:19:32 +03:00
|
|
|
#else /* PML_BFO */
|
2013-03-28 01:09:41 +04:00
|
|
|
default_priority = 20;
|
2010-11-24 01:19:32 +03:00
|
|
|
mca_pml_bfo_param_register_int("priority", 20);
|
|
|
|
#endif /* PML_BFO */
|
2013-03-28 01:09:41 +04:00
|
|
|
|
|
|
|
(void) mca_pml_bfo_param_register_int("verbose", 0, &mca_pml_bfo_verbose);
|
|
|
|
(void) mca_pml_bfo_param_register_int("free_list_num", 4, &mca_pml_bfo.free_list_num);
|
|
|
|
(void) mca_pml_bfo_param_register_int("free_list_max", -1, &mca_pml_bfo.free_list_max);
|
|
|
|
(void) mca_pml_bfo_param_register_int("free_list_inc", 64, &mca_pml_bfo.free_list_inc);
|
|
|
|
(void) mca_pml_bfo_param_register_int("priority", default_priority, &mca_pml_bfo.priority);
|
|
|
|
(void) mca_pml_bfo_param_register_uint("send_pipeline_depth", 3, &mca_pml_bfo.send_pipeline_depth);
|
|
|
|
(void) mca_pml_bfo_param_register_uint("recv_pipeline_depth", 4, &mca_pml_bfo.recv_pipeline_depth);
|
|
|
|
(void) mca_pml_bfo_param_register_uint("rdma_put_retries_limit", 5, &mca_pml_bfo.rdma_put_retries_limit);
|
|
|
|
(void) mca_pml_bfo_param_register_int("max_rdma_per_request", 4, &mca_pml_bfo.max_rdma_per_request);
|
|
|
|
(void) mca_pml_bfo_param_register_int("max_send_per_range", 4, &mca_pml_bfo.max_send_per_range);
|
|
|
|
(void) mca_pml_bfo_param_register_uint("unexpected_limit", 128, &mca_pml_bfo.unexpected_limit);
|
|
|
|
|
|
|
|
mca_pml_bfo.allocator_name = "bucket";
|
|
|
|
(void) mca_base_component_var_register(&mca_pml_bfo_component.pmlm_version,
|
|
|
|
"allocator",
|
|
|
|
"Name of allocator component for unexpected messages",
|
|
|
|
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&mca_pml_bfo.allocator_name);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_pml_bfo_component_open(void)
|
|
|
|
{
|
|
|
|
mca_pml_bfo_output = opal_output_open(NULL);
|
|
|
|
opal_output_set_verbosity(mca_pml_bfo_output, mca_pml_bfo_verbose);
|
2010-07-13 14:46:20 +04:00
|
|
|
|
|
|
|
mca_pml_bfo.enabled = false;
|
2013-03-28 01:17:31 +04:00
|
|
|
return mca_base_framework_open(&ompi_bml_base_framework, 0);
|
2010-07-13 14:46:20 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int mca_pml_bfo_component_close(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
2013-03-28 01:17:31 +04:00
|
|
|
if (OMPI_SUCCESS != (rc = mca_base_framework_close(&ompi_bml_base_framework))) {
|
2010-07-13 14:46:20 +04:00
|
|
|
return rc;
|
|
|
|
}
|
2011-07-08 20:39:58 +04:00
|
|
|
opal_output_close(mca_pml_bfo_output);
|
2010-07-13 14:46:20 +04:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static mca_pml_base_module_t*
|
|
|
|
mca_pml_bfo_component_init( int* priority,
|
|
|
|
bool enable_progress_threads,
|
|
|
|
bool enable_mpi_threads )
|
|
|
|
{
|
2014-05-19 14:40:18 +04:00
|
|
|
mca_allocator_base_component_t* allocator_component;
|
|
|
|
|
2010-09-21 01:22:33 +04:00
|
|
|
opal_output_verbose( 10, mca_pml_bfo_output,
|
2010-07-13 14:46:20 +04:00
|
|
|
"in bfo, my priority is %d\n", mca_pml_bfo.priority);
|
2010-09-21 01:22:33 +04:00
|
|
|
|
2010-07-13 14:46:20 +04:00
|
|
|
if((*priority) > mca_pml_bfo.priority) {
|
|
|
|
*priority = mca_pml_bfo.priority;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
*priority = mca_pml_bfo.priority;
|
|
|
|
|
2014-05-19 14:40:18 +04:00
|
|
|
allocator_component = mca_allocator_component_lookup( mca_pml_bfo.allocator_name );
|
|
|
|
if(NULL == allocator_component) {
|
2014-05-21 00:08:42 +04:00
|
|
|
opal_output(0, "mca_pml_bfo_component_init: can't find allocator: %s\n", mca_pml_bfo.allocator_name);
|
2014-05-19 14:40:18 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
mca_pml_bfo.allocator = allocator_component->allocator_init(true,
|
|
|
|
mca_pml_bfo_seg_alloc,
|
|
|
|
mca_pml_bfo_seg_free, NULL);
|
|
|
|
if(NULL == mca_pml_bfo.allocator) {
|
2014-05-21 00:08:42 +04:00
|
|
|
opal_output(0, "mca_pml_bfo_component_init: unable to initialize allocator\n");
|
2014-05-19 14:40:18 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-13 14:46:20 +04:00
|
|
|
if(OMPI_SUCCESS != mca_bml_base_init( enable_progress_threads,
|
|
|
|
enable_mpi_threads)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Set this here (vs in component_open()) because
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
opal_leave_pinned* may have been set after MCA params were
|
2010-07-13 14:46:20 +04:00
|
|
|
read (e.g., by the openib btl) */
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
mca_pml_bfo.leave_pinned = (1 == opal_leave_pinned);
|
|
|
|
mca_pml_bfo.leave_pinned_pipeline = (int) opal_leave_pinned_pipeline;
|
2010-07-13 14:46:20 +04:00
|
|
|
|
|
|
|
return &mca_pml_bfo.super;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_pml_bfo_component_fini(void)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
/* Shutdown BML */
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_bml.bml_finalize()))
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
if(!mca_pml_bfo.enabled)
|
|
|
|
return OMPI_SUCCESS; /* never selected.. return success.. */
|
|
|
|
mca_pml_bfo.enabled = false; /* not anymore */
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.rdma_pending);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.pckt_pending);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.recv_pending);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.send_pending);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.non_existing_communicator_pending);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.buffers);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.pending_pckts);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.recv_frags);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.rdma_frags);
|
|
|
|
OBJ_DESTRUCT(&mca_pml_bfo.lock);
|
|
|
|
|
|
|
|
if(OMPI_SUCCESS != (rc = mca_pml_bfo.allocator->alc_finalize(mca_pml_bfo.allocator))) {
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
if (mca_pml_base_send_requests.fl_num_allocated !=
|
|
|
|
mca_pml_base_send_requests.super.opal_list_length) {
|
|
|
|
opal_output(0, "bfo send requests: %d allocated %d returned\n",
|
|
|
|
mca_pml_base_send_requests.fl_num_allocated,
|
|
|
|
mca_pml_base_send_requests.super.opal_list_length);
|
|
|
|
}
|
|
|
|
if (mca_pml_base_recv_requests.fl_num_allocated !=
|
|
|
|
mca_pml_base_recv_requests.super.opal_list_length) {
|
|
|
|
opal_output(0, "bfo recv requests: %d allocated %d returned\n",
|
|
|
|
mca_pml_base_recv_requests.fl_num_allocated,
|
|
|
|
mca_pml_base_recv_requests.super.opal_list_length);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *mca_pml_bfo_seg_alloc( struct mca_mpool_base_module_t* mpool,
|
|
|
|
size_t* size,
|
|
|
|
mca_mpool_base_registration_t** registration) {
|
|
|
|
return malloc(*size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void mca_pml_bfo_seg_free( struct mca_mpool_base_module_t* mpool,
|
|
|
|
void* segment ) {
|
|
|
|
free(segment);
|
|
|
|
}
|