2014-01-22 15:39:19 +00:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2012-08-16 19:11:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
|
|
|
|
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
|
2014-01-22 15:39:19 +00:00
|
|
|
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
|
2014-03-27 23:25:31 +00:00
|
|
|
* Copyright (c) 2013-2014 Los Alamos National Security, LLC. All rights
|
2014-01-22 15:39:19 +00:00
|
|
|
* reserved.
|
2015-03-02 12:48:02 +09:00
|
|
|
* Copyright (c) 2014-2015 Research Organization for Information Science
|
2014-03-27 23:25:31 +00:00
|
|
|
* and Technology (RIST). All rights reserved.
|
2012-08-16 19:11:35 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif /* HAVE_UNIST_H */
|
2015-03-05 20:50:44 -07:00
|
|
|
#include "ompi/mca/mca.h"
|
2012-08-16 19:11:35 +00:00
|
|
|
#include "opal/mca/base/base.h"
|
|
|
|
#include "opal/util/argv.h"
|
|
|
|
|
|
|
|
#include "ompi/mca/bcol/bcol.h"
|
|
|
|
#include "ompi/mca/bcol/base/base.h"
|
|
|
|
#include "ompi/include/ompi/constants.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 00:47:28 +00:00
|
|
|
#include "opal/mca/mpool/mpool.h"
|
2012-08-16 19:11:35 +00:00
|
|
|
#include "opal/class/opal_list.h"
|
|
|
|
/*
|
|
|
|
* The following file was created by configure. It contains extern
|
|
|
|
* statements and the definition of an array of pointers to each
|
|
|
|
* component's public mca_base_component_t struct.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi/mca/bcol/base/static-components.h"
|
|
|
|
|
2013-03-27 21:17:31 +00:00
|
|
|
static int mca_bcol_base_open(mca_base_open_flag_t flags);
|
2014-05-13 21:22:18 +00:00
|
|
|
static int mca_bcol_base_close (void);
|
2013-03-27 21:17:31 +00:00
|
|
|
static int mca_bcol_base_register(mca_base_register_flag_t flags);
|
|
|
|
|
2012-08-16 19:11:35 +00:00
|
|
|
/*
|
|
|
|
** * Global variables
|
|
|
|
** */
|
2014-05-13 21:22:18 +00:00
|
|
|
MCA_BASE_FRAMEWORK_DECLARE(ompi, bcol, NULL, mca_bcol_base_register, mca_bcol_base_open, mca_bcol_base_close,
|
2013-03-27 21:17:31 +00:00
|
|
|
mca_bcol_base_static_components, 0);
|
2013-03-27 21:09:41 +00:00
|
|
|
|
2015-05-08 09:19:02 +09:00
|
|
|
OMPI_DECLSPEC opal_list_t mca_bcol_base_components_in_use = {{0}};
|
|
|
|
OMPI_DECLSPEC char *ompi_bcol_bcols_string = NULL;
|
|
|
|
OMPI_DECLSPEC int bcol_mpool_compatibility[BCOL_SIZE][BCOL_SIZE] = {{0}};
|
|
|
|
OMPI_DECLSPEC int bcol_mpool_index[BCOL_SIZE][BCOL_SIZE] = {{0}};
|
2012-08-16 19:11:35 +00:00
|
|
|
|
|
|
|
static void bcol_base_module_constructor(mca_bcol_base_module_t *module)
|
|
|
|
{
|
|
|
|
int fnc;
|
|
|
|
|
|
|
|
module->bcol_component = NULL;
|
|
|
|
module->network_context = NULL;
|
|
|
|
module->context_index = -1;
|
|
|
|
module->supported_mode = 0;
|
|
|
|
module->init_module = NULL;
|
|
|
|
module->sbgp_partner_module = NULL;
|
|
|
|
module->squence_number_offset = 0;
|
|
|
|
module->n_poll_loops = 0;
|
|
|
|
|
|
|
|
for (fnc = 0; fnc < BCOL_NUM_OF_FUNCTIONS; fnc++) {
|
|
|
|
module->bcol_function_table[fnc] = NULL;
|
|
|
|
module->small_message_thresholds[fnc] = BCOL_THRESHOLD_UNLIMITED;
|
|
|
|
}
|
|
|
|
|
|
|
|
module->set_small_msg_thresholds = NULL;
|
|
|
|
|
|
|
|
module->header_size = 0;
|
|
|
|
module->bcol_memory_init = NULL;
|
|
|
|
|
|
|
|
module->next_inorder = NULL;
|
|
|
|
|
|
|
|
mca_bcol_base_fn_table_construct(module);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bcol_base_module_destructor(mca_bcol_base_module_t *module)
|
|
|
|
{
|
|
|
|
int fnc;
|
|
|
|
|
|
|
|
module->bcol_component = NULL;
|
|
|
|
|
|
|
|
module->context_index = -1;
|
|
|
|
module->init_module = NULL;
|
|
|
|
module->sbgp_partner_module = NULL;
|
|
|
|
module->squence_number_offset = 0;
|
|
|
|
module->n_poll_loops = 0;
|
|
|
|
|
|
|
|
for (fnc = 0; fnc < BCOL_NUM_OF_FUNCTIONS; fnc++) {
|
|
|
|
module->bcol_function_table[fnc] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
module->bcol_memory_init = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(mca_bcol_base_module_t,
|
|
|
|
opal_object_t,
|
|
|
|
bcol_base_module_constructor,
|
|
|
|
bcol_base_module_destructor);
|
|
|
|
|
|
|
|
static void bcol_base_network_context_constructor(bcol_base_network_context_t *nc)
|
|
|
|
{
|
|
|
|
nc->context_id = -1;
|
|
|
|
nc->context_data = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bcol_base_network_context_destructor(bcol_base_network_context_t *nc)
|
|
|
|
{
|
|
|
|
nc->context_id = -1;
|
|
|
|
nc->context_data = NULL;
|
|
|
|
nc->register_memory_fn = NULL;
|
|
|
|
nc->deregister_memory_fn = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_CLASS_INSTANCE(bcol_base_network_context_t,
|
|
|
|
opal_object_t,
|
|
|
|
bcol_base_network_context_constructor,
|
|
|
|
bcol_base_network_context_destructor);
|
|
|
|
|
|
|
|
/* get list of subgrouping coponents to use */
|
|
|
|
static int mca_bcol_base_set_components_to_use(opal_list_t *bcol_components_avail,
|
|
|
|
opal_list_t *bcol_components_in_use)
|
|
|
|
{
|
|
|
|
/* local variables */
|
|
|
|
const mca_base_component_t *b_component;
|
|
|
|
|
|
|
|
mca_base_component_list_item_t *b_cli;
|
|
|
|
mca_base_component_list_item_t *b_clj;
|
|
|
|
|
|
|
|
char **bcols_requested;
|
|
|
|
const char *b_component_name;
|
|
|
|
|
|
|
|
/* split the requst for the bcol modules */
|
|
|
|
bcols_requested = opal_argv_split(ompi_bcol_bcols_string, ',');
|
|
|
|
if (NULL == bcols_requested) {
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialize list */
|
|
|
|
OBJ_CONSTRUCT(bcol_components_in_use, opal_list_t);
|
|
|
|
|
|
|
|
/* figure out basic collective modules to use */
|
|
|
|
/* loop over list of components requested */
|
2014-05-13 21:22:18 +00:00
|
|
|
for (int i = 0 ; bcols_requested[i] ; ++i) {
|
2012-08-16 19:11:35 +00:00
|
|
|
/* loop over discovered components */
|
2014-01-22 15:39:19 +00:00
|
|
|
OPAL_LIST_FOREACH(b_cli, bcol_components_avail, mca_base_component_list_item_t) {
|
2012-08-16 19:11:35 +00:00
|
|
|
b_component = b_cli->cli_component;
|
|
|
|
b_component_name = b_component->mca_component_name;
|
|
|
|
|
2014-05-13 21:22:18 +00:00
|
|
|
if (0 == strcmp (b_component_name, bcols_requested[i])) {
|
2012-08-16 19:11:35 +00:00
|
|
|
/* found selected component */
|
|
|
|
b_clj = OBJ_NEW(mca_base_component_list_item_t);
|
|
|
|
if (NULL == b_clj) {
|
2015-03-02 12:48:02 +09:00
|
|
|
opal_argv_free (bcols_requested);
|
2012-08-16 19:11:35 +00:00
|
|
|
return OPAL_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
b_clj->cli_component = b_component;
|
|
|
|
opal_list_append(bcol_components_in_use,
|
|
|
|
(opal_list_item_t *) b_clj);
|
|
|
|
break;
|
|
|
|
} /* end check for bcol component */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Note: Need to add error checking to make sure all requested functions
|
|
|
|
** were found */
|
|
|
|
|
|
|
|
/*
|
|
|
|
** release resources
|
|
|
|
** */
|
|
|
|
|
2014-05-13 21:22:18 +00:00
|
|
|
opal_argv_free (bcols_requested);
|
2012-08-16 19:11:35 +00:00
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-03-27 21:17:31 +00:00
|
|
|
static int mca_bcol_base_register(mca_base_register_flag_t flags)
|
2013-03-27 21:09:41 +00:00
|
|
|
{
|
|
|
|
/* figure out which bcol and sbgp components will actually be used */
|
|
|
|
/* get list of sub-grouping functions to use */
|
|
|
|
ompi_bcol_bcols_string = "basesmuma,basesmuma,iboffload,ptpcoll,ugni";
|
|
|
|
(void) mca_base_var_register("ompi", "bcol", "base", "string",
|
|
|
|
"Default set of basic collective components to use",
|
|
|
|
MCA_BASE_VAR_TYPE_STRING, NULL, 0, 0,
|
|
|
|
OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&ompi_bcol_bcols_string);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2012-08-16 19:11:35 +00:00
|
|
|
/**
|
|
|
|
* Function for finding and opening either all MCA components, or the one
|
|
|
|
* that was specifically requested via a MCA parameter.
|
|
|
|
*/
|
2013-03-27 21:17:31 +00:00
|
|
|
static int mca_bcol_base_open(mca_base_open_flag_t flags)
|
2012-08-16 19:11:35 +00:00
|
|
|
{
|
2013-03-27 21:09:41 +00:00
|
|
|
int ret;
|
2012-08-16 19:11:35 +00:00
|
|
|
|
|
|
|
/* Open up all available components */
|
|
|
|
if (OMPI_SUCCESS !=
|
2013-03-27 21:17:31 +00:00
|
|
|
(ret = mca_base_framework_components_open(&ompi_bcol_base_framework, flags))) {
|
|
|
|
return ret;
|
2012-08-16 19:11:35 +00:00
|
|
|
}
|
|
|
|
|
2013-03-27 21:17:31 +00:00
|
|
|
ret = mca_bcol_base_set_components_to_use(&ompi_bcol_base_framework.framework_components,
|
2012-08-16 19:11:35 +00:00
|
|
|
&mca_bcol_base_components_in_use);
|
2014-05-13 21:22:18 +00:00
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return ret;
|
|
|
|
}
|
2012-08-16 19:11:35 +00:00
|
|
|
|
|
|
|
/* memory registration compatibilities */
|
|
|
|
bcol_mpool_compatibility[BCOL_SHARED_MEMORY_UMA][BCOL_SHARED_MEMORY_UMA]=1;
|
|
|
|
bcol_mpool_compatibility[BCOL_SHARED_MEMORY_UMA][BCOL_SHARED_MEMORY_SOCKET]=1;
|
|
|
|
bcol_mpool_compatibility[BCOL_SHARED_MEMORY_UMA][BCOL_POINT_TO_POINT]=1;
|
|
|
|
bcol_mpool_compatibility[BCOL_SHARED_MEMORY_UMA][BCOL_IB_OFFLOAD]=1;
|
|
|
|
bcol_mpool_compatibility[BCOL_SHARED_MEMORY_SOCKET][BCOL_SHARED_MEMORY_UMA]=1;
|
|
|
|
bcol_mpool_compatibility[BCOL_POINT_TO_POINT] [BCOL_SHARED_MEMORY_UMA]=1;
|
|
|
|
bcol_mpool_compatibility[BCOL_IB_OFFLOAD] [BCOL_SHARED_MEMORY_UMA]=1;
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-05-13 21:22:18 +00:00
|
|
|
static int mca_bcol_base_close (void)
|
|
|
|
{
|
|
|
|
opal_list_item_t *item;
|
|
|
|
|
|
|
|
while (NULL != (item = opal_list_remove_first (&mca_bcol_base_components_in_use))) {
|
|
|
|
OBJ_RELEASE(item);
|
|
|
|
}
|
|
|
|
|
|
|
|
OBJ_DESTRUCT(&mca_bcol_base_components_in_use);
|
|
|
|
|
|
|
|
return mca_base_framework_components_close(&ompi_bcol_base_framework, NULL);
|
|
|
|
}
|
|
|
|
|
2012-08-16 19:11:35 +00:00
|
|
|
/*
|
|
|
|
* Prototype implementation of selection logic
|
|
|
|
*/
|
|
|
|
int mca_bcol_base_fn_table_construct(struct mca_bcol_base_module_t *bcol_module){
|
|
|
|
|
|
|
|
int bcol_fn;
|
|
|
|
/* Call all init functions */
|
|
|
|
|
|
|
|
/* Create a function table */
|
|
|
|
for (bcol_fn = 0; bcol_fn < BCOL_NUM_OF_FUNCTIONS; bcol_fn++){
|
|
|
|
/* Create a list object for each bcol type list */
|
|
|
|
OBJ_CONSTRUCT(&(bcol_module->bcol_fns_table[bcol_fn]), opal_list_t);
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_bcol_base_fn_table_destroy(struct mca_bcol_base_module_t *bcol_module){
|
|
|
|
|
|
|
|
int bcol_fn;
|
|
|
|
|
|
|
|
for (bcol_fn = 0; bcol_fn < BCOL_NUM_OF_FUNCTIONS; bcol_fn++){
|
|
|
|
/* gvm FIX: Go through the list and destroy each item */
|
|
|
|
/* Destroy the function table object for each bcol type list */
|
|
|
|
OBJ_DESTRUCT(&(bcol_module->bcol_fns_table[bcol_fn]));
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_bcol_base_set_attributes(struct mca_bcol_base_module_t *bcol_module,
|
|
|
|
mca_bcol_base_coll_fn_comm_attributes_t *arg_comm_attribs,
|
|
|
|
mca_bcol_base_coll_fn_invoke_attributes_t *arg_inv_attribs,
|
|
|
|
mca_bcol_base_module_collective_fn_primitives_t bcol_fn,
|
|
|
|
mca_bcol_base_module_collective_fn_primitives_t progress_fn
|
|
|
|
)
|
|
|
|
{
|
|
|
|
mca_bcol_base_coll_fn_comm_attributes_t *comm_attribs = NULL;
|
|
|
|
mca_bcol_base_coll_fn_invoke_attributes_t *inv_attribs = NULL;
|
|
|
|
struct mca_bcol_base_coll_fn_desc_t *fn_filtered = NULL;
|
|
|
|
int coll_type;
|
|
|
|
|
|
|
|
comm_attribs = malloc(sizeof(mca_bcol_base_coll_fn_comm_attributes_t));
|
2015-03-02 12:48:02 +09:00
|
|
|
if (NULL == comm_attribs) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
2012-08-16 19:11:35 +00:00
|
|
|
inv_attribs = malloc(sizeof(mca_bcol_base_coll_fn_invoke_attributes_t));
|
|
|
|
|
2015-03-02 12:48:02 +09:00
|
|
|
if (NULL == inv_attribs) {
|
|
|
|
free(comm_attribs);
|
2012-08-16 19:11:35 +00:00
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
coll_type = comm_attribs->bcoll_type = arg_comm_attribs->bcoll_type;
|
|
|
|
comm_attribs->comm_size_min = arg_comm_attribs->comm_size_min;
|
|
|
|
comm_attribs->comm_size_max = arg_comm_attribs->comm_size_max;
|
|
|
|
comm_attribs->data_src = arg_comm_attribs->data_src;
|
|
|
|
comm_attribs->waiting_semantics = arg_comm_attribs->waiting_semantics;
|
|
|
|
|
|
|
|
inv_attribs->bcol_msg_min = arg_inv_attribs->bcol_msg_min;
|
|
|
|
inv_attribs->bcol_msg_max = arg_inv_attribs->bcol_msg_max ;
|
|
|
|
inv_attribs->datatype_bitmap = arg_inv_attribs->datatype_bitmap ;
|
|
|
|
inv_attribs->op_types_bitmap = arg_inv_attribs->op_types_bitmap;
|
|
|
|
|
|
|
|
fn_filtered = OBJ_NEW(mca_bcol_base_coll_fn_desc_t);
|
|
|
|
|
|
|
|
fn_filtered->coll_fn = bcol_fn;
|
|
|
|
fn_filtered->progress_fn = progress_fn;
|
|
|
|
|
|
|
|
fn_filtered->comm_attr = comm_attribs;
|
|
|
|
fn_filtered->inv_attr = inv_attribs;
|
|
|
|
|
|
|
|
|
|
|
|
opal_list_append(&(bcol_module->bcol_fns_table[coll_type]),(opal_list_item_t*)fn_filtered);
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_bcol_base_bcol_fns_table_init(struct mca_bcol_base_module_t *bcol_module){
|
|
|
|
|
|
|
|
int ret, bcol_init_fn;
|
|
|
|
|
|
|
|
for (bcol_init_fn =0; bcol_init_fn < BCOL_NUM_OF_FUNCTIONS; bcol_init_fn++) {
|
|
|
|
if (NULL != bcol_module->bcol_function_init_table[bcol_init_fn]) {
|
|
|
|
ret = (bcol_module->bcol_function_init_table[bcol_init_fn]) (bcol_module);
|
|
|
|
if (OMPI_SUCCESS != ret) {
|
|
|
|
return OMPI_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2014-03-27 23:25:31 +00:00
|
|
|
static void mca_bcol_base_coll_fn_desc_constructor(mca_bcol_base_coll_fn_desc_t *fn)
|
|
|
|
{
|
|
|
|
fn->comm_attr = NULL;
|
|
|
|
fn->inv_attr = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mca_bcol_base_coll_fn_desc_destructor(mca_bcol_base_coll_fn_desc_t *fn)
|
|
|
|
{
|
2014-05-13 21:22:18 +00:00
|
|
|
if (fn->comm_attr) {
|
|
|
|
free(fn->comm_attr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fn->inv_attr) {
|
|
|
|
free(fn->inv_attr);
|
|
|
|
}
|
2014-03-27 23:25:31 +00:00
|
|
|
}
|
|
|
|
|
2012-08-16 19:11:35 +00:00
|
|
|
OBJ_CLASS_INSTANCE(mca_bcol_base_coll_fn_desc_t,
|
|
|
|
opal_list_item_t,
|
2014-03-27 23:25:31 +00:00
|
|
|
mca_bcol_base_coll_fn_desc_constructor,
|
|
|
|
mca_bcol_base_coll_fn_desc_destructor);
|
2014-02-07 19:15:45 +00:00
|
|
|
|
2015-06-23 20:59:57 -07:00
|
|
|
static void lmngr_block_constructor(mca_bcol_base_lmngr_block_t *item)
|
2014-02-07 19:15:45 +00:00
|
|
|
{
|
|
|
|
item->base_addr = NULL;
|
|
|
|
}
|
|
|
|
|
2015-06-23 20:59:57 -07:00
|
|
|
static void lnmgr_block_destructor(mca_bcol_base_lmngr_block_t *item)
|
2014-02-07 19:15:45 +00:00
|
|
|
{
|
|
|
|
/* I have nothing to do here */
|
|
|
|
}
|
|
|
|
OBJ_CLASS_INSTANCE(mca_bcol_base_lmngr_block_t,
|
|
|
|
opal_list_item_t,
|
|
|
|
lmngr_block_constructor,
|
|
|
|
lnmgr_block_destructor);
|