2013-08-27 20:36:54 +04:00
|
|
|
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
|
2012-08-16 23:11:35 +04:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2009-2012 Oak Ridge National Laboratory. All rights reserved.
|
|
|
|
* Copyright (c) 2009-2012 Mellanox Technologies. All rights reserved.
|
2013-08-27 20:36:54 +04:00
|
|
|
* Copyright (c) 2013 Los Alamos National Security, LLC. All rights
|
|
|
|
* reserved.
|
2012-08-16 23:11:35 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/mman.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
|
|
|
#include "ompi/constants.h"
|
|
|
|
#include "ompi/communicator/communicator.h"
|
|
|
|
#include "ompi/mca/bcol/bcol.h"
|
|
|
|
#include "ompi/mca/bcol/base/base.h"
|
|
|
|
#include "coll_ml.h"
|
2012-08-29 18:10:42 +04:00
|
|
|
#include "coll_ml_inlines.h"
|
2012-08-16 23:11:35 +04:00
|
|
|
#include "coll_ml_mca.h"
|
|
|
|
#include "coll_ml_lmngr.h"
|
2013-02-06 01:52:55 +04:00
|
|
|
#include "ompi/patterns/net/netpatterns.h"
|
2012-08-16 23:11:35 +04:00
|
|
|
#include "opal/mca/installdirs/installdirs.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local flags
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
REGINT_NEG_ONE_OK = 0x01,
|
|
|
|
REGINT_GE_ZERO = 0x02,
|
|
|
|
REGINT_GE_ONE = 0x04,
|
|
|
|
REGINT_NONZERO = 0x08,
|
|
|
|
REGINT_MAX = 0x88
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
REGSTR_EMPTY_OK = 0x01,
|
|
|
|
REGSTR_MAX = 0x88
|
|
|
|
};
|
|
|
|
|
2013-08-27 20:36:54 +04:00
|
|
|
/*
|
|
|
|
* Enumerators
|
|
|
|
*/
|
|
|
|
mca_base_var_enum_value_t fragmentation_enable_enum[] = {
|
|
|
|
{0, "disable"},
|
|
|
|
{1, "enable"},
|
|
|
|
{2, "auto"}
|
|
|
|
};
|
|
|
|
|
2012-08-16 23:11:35 +04:00
|
|
|
/*
|
|
|
|
* utility routine for string parameter registration
|
|
|
|
*/
|
|
|
|
static int reg_string(const char* param_name,
|
|
|
|
const char* deprecated_param_name,
|
|
|
|
const char* param_desc,
|
2013-03-28 01:09:41 +04:00
|
|
|
const char* default_value, char **storage,
|
2012-08-16 23:11:35 +04:00
|
|
|
int flags)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
*storage = (char *) default_value;
|
|
|
|
index = mca_base_component_var_register(&mca_coll_ml_component.super.collm_version,
|
|
|
|
param_name, param_desc, MCA_BASE_VAR_TYPE_STRING,
|
|
|
|
NULL, 0, 0, OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY, storage);
|
2012-08-16 23:11:35 +04:00
|
|
|
if (NULL != deprecated_param_name) {
|
2013-03-28 01:09:41 +04:00
|
|
|
(void) mca_base_var_register_synonym(index, "ompi", "coll", "ml", deprecated_param_name,
|
|
|
|
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
2012-08-16 23:11:35 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
if (0 != (flags & REGSTR_EMPTY_OK) && (NULL == *storage || 0 == strlen(*storage))) {
|
2012-08-16 23:11:35 +04:00
|
|
|
opal_output(0, "Bad parameter value for parameter \"%s\"",
|
|
|
|
param_name);
|
|
|
|
return OMPI_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
2013-03-28 01:09:41 +04:00
|
|
|
|
2012-08-16 23:11:35 +04:00
|
|
|
/*
|
|
|
|
* utility routine for integer parameter registration
|
|
|
|
*/
|
2013-03-28 01:09:41 +04:00
|
|
|
static int reg_int(const char* param_name,
|
2012-08-16 23:11:35 +04:00
|
|
|
const char* deprecated_param_name,
|
|
|
|
const char* param_desc,
|
2013-03-28 01:09:41 +04:00
|
|
|
int default_value, int *storage, int flags)
|
2012-08-16 23:11:35 +04:00
|
|
|
{
|
2013-03-28 01:09:41 +04:00
|
|
|
int index;
|
|
|
|
|
|
|
|
*storage = default_value;
|
|
|
|
index = mca_base_component_var_register(&mca_coll_ml_component.super.collm_version,
|
|
|
|
param_name, param_desc, MCA_BASE_VAR_TYPE_INT,
|
|
|
|
NULL, 0, 0,OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY, storage);
|
2012-08-16 23:11:35 +04:00
|
|
|
if (NULL != deprecated_param_name) {
|
2013-03-28 01:09:41 +04:00
|
|
|
(void) mca_base_var_register_synonym(index, "ompi", "coll", "ml", deprecated_param_name,
|
|
|
|
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
2012-08-16 23:11:35 +04:00
|
|
|
}
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
if (0 != (flags & REGINT_NEG_ONE_OK) && -1 == *storage) {
|
2012-08-16 23:11:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
if ((0 != (flags & REGINT_GE_ZERO) && *storage < 0) ||
|
|
|
|
(0 != (flags & REGINT_GE_ONE) && *storage < 1) ||
|
|
|
|
(0 != (flags & REGINT_NONZERO) && 0 == *storage)) {
|
2012-08-16 23:11:35 +04:00
|
|
|
opal_output(0, "Bad parameter value for parameter \"%s\"",
|
|
|
|
param_name);
|
|
|
|
return OMPI_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int reg_bool(const char* param_name,
|
|
|
|
const char* deprecated_param_name,
|
|
|
|
const char* param_desc,
|
|
|
|
bool default_value, bool *storage)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
|
|
|
|
*storage = default_value;
|
|
|
|
index = mca_base_component_var_register(&mca_coll_ml_component.super.collm_version,
|
|
|
|
param_name, param_desc, MCA_BASE_VAR_TYPE_BOOL,
|
|
|
|
NULL, 0, 0,OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY, storage);
|
|
|
|
if (NULL != deprecated_param_name) {
|
|
|
|
(void) mca_base_var_register_synonym(index, "ompi", "coll", "ml", deprecated_param_name,
|
|
|
|
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int reg_ullint(const char* param_name,
|
|
|
|
const char* deprecated_param_name,
|
|
|
|
const char* param_desc,
|
|
|
|
unsigned long long default_value, unsigned long long *storage, int flags)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
|
|
|
|
*storage = default_value;
|
|
|
|
index = mca_base_component_var_register(&mca_coll_ml_component.super.collm_version,
|
|
|
|
param_name, param_desc, MCA_BASE_VAR_TYPE_UNSIGNED_LONG_LONG,
|
|
|
|
NULL, 0, 0,OPAL_INFO_LVL_9,
|
|
|
|
MCA_BASE_VAR_SCOPE_READONLY, storage);
|
|
|
|
if (NULL != deprecated_param_name) {
|
|
|
|
(void) mca_base_var_register_synonym(index, "ompi", "coll", "ml", deprecated_param_name,
|
|
|
|
MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((0 != (flags & REGINT_GE_ONE) && *storage < 1) ||
|
|
|
|
(0 != (flags & REGINT_NONZERO) && 0 == *storage)) {
|
|
|
|
opal_output(0, "Bad parameter value for parameter \"%s\"",
|
|
|
|
param_name);
|
|
|
|
return OMPI_ERR_BAD_PARAM;
|
|
|
|
}
|
|
|
|
|
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mca_coll_ml_verify_params(void)
|
|
|
|
{
|
|
|
|
int dummy;
|
|
|
|
|
|
|
|
/* Make sure that the the number of memory banks is a power of 2 */
|
|
|
|
mca_coll_ml_component.n_payload_mem_banks =
|
|
|
|
roundup_to_power_radix(2, mca_coll_ml_component.n_payload_mem_banks,
|
|
|
|
&dummy);
|
|
|
|
|
|
|
|
/* Make sure that the the number of buffers is a power of 2 */
|
|
|
|
mca_coll_ml_component.n_payload_buffs_per_bank =
|
|
|
|
roundup_to_power_radix(2, mca_coll_ml_component.n_payload_buffs_per_bank,
|
|
|
|
&dummy);
|
|
|
|
|
2012-08-16 23:11:35 +04:00
|
|
|
return OMPI_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
int mca_coll_ml_register_params(void)
|
|
|
|
{
|
2013-08-27 20:36:54 +04:00
|
|
|
mca_base_var_enum_t *new_enum;
|
2013-03-28 01:09:41 +04:00
|
|
|
int ret, tmp;
|
2012-08-16 23:11:35 +04:00
|
|
|
char *str = NULL;
|
|
|
|
|
|
|
|
ret = OMPI_SUCCESS;
|
|
|
|
#define CHECK(expr) do { \
|
|
|
|
tmp = (expr); \
|
|
|
|
if (OMPI_SUCCESS != tmp) ret = tmp; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
/* register openib component parameters */
|
|
|
|
|
|
|
|
CHECK(reg_int("priority", NULL,
|
|
|
|
"ML component priority"
|
2013-03-28 01:09:41 +04:00
|
|
|
"(from 0(low) to 90 (high))", 0, &mca_coll_ml_component.ml_priority, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("verbose", NULL,
|
|
|
|
"Output some verbose ML information "
|
2013-03-28 01:09:41 +04:00
|
|
|
"(0 = no output, nonzero = output)", 0, &mca_coll_ml_component.verbose, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("n_levels", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
"number of levels in the hierarchy ", 1, &mca_coll_ml_component.ml_n_levels, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("max_comm", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
"max of communicators available to run ML", 12, (int *) &mca_coll_ml_component.max_comm, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("min_comm_size", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
" min size of comm to be available to run ML", 0, &mca_coll_ml_component.min_comm_size, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("n_payload_mem_banks", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
"number of payload memory banks", 2, &mca_coll_ml_component.n_payload_mem_banks, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("n_payload_buffs_per_bank", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
"number of payload buffers per bank", 16, &mca_coll_ml_component.n_payload_buffs_per_bank, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
/* RLG: need to handle alignment and size */
|
2013-03-28 01:09:41 +04:00
|
|
|
CHECK(reg_ullint("payload_buffer_size", NULL,
|
|
|
|
"size of payload buffer", 4*1024, &mca_coll_ml_component.payload_buffer_size, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
/* get the pipeline depth, default is 2 */
|
|
|
|
CHECK(reg_int("pipeline_depth", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
"size of fragmentation pipeline", 2, &mca_coll_ml_component.pipeline_depth, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("free_list_init_size", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
" Initial size for free lists in ML", 128, &mca_coll_ml_component.free_list_init_size, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("free_list_grow_size", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
" Initial size for free lists in ML", 64, &mca_coll_ml_component.free_list_grow_size, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("free_list_max_size", NULL,
|
2013-03-28 01:09:41 +04:00
|
|
|
" Initial size for free lists in ML", -1, &mca_coll_ml_component.free_list_max_size, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("use_knomial_allreduce", NULL,
|
|
|
|
"Use k-nomial Allreduce supports only p2p currently"
|
2013-03-28 01:09:41 +04:00
|
|
|
, 1, &mca_coll_ml_component.use_knomial_allreduce, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
CHECK(reg_bool("use_static_bcast", NULL,
|
|
|
|
"Use new bcast static algorithm", true, &mca_coll_ml_component.use_static_bcast));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
CHECK(reg_bool("use_sequential_bcast", NULL,
|
|
|
|
"Use new bcast static algorithm", false, &mca_coll_ml_component.use_sequential_bcast));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
CHECK(reg_bool("disable_allgather", NULL,
|
2012-08-16 23:11:35 +04:00
|
|
|
"Allgather disabling",
|
2013-03-28 01:09:41 +04:00
|
|
|
false, &mca_coll_ml_component.disable_allgather));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
CHECK(reg_bool("disable_alltoall", NULL,
|
2012-08-16 23:11:35 +04:00
|
|
|
"Alltoall disabling",
|
2013-03-28 01:09:41 +04:00
|
|
|
false, &mca_coll_ml_component.disable_alltoall));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
2013-08-27 20:36:54 +04:00
|
|
|
tmp = mca_base_var_enum_create ("coll_ml_enable_fragmentation_enum", fragmentation_enable_enum, &new_enum);
|
|
|
|
if (OPAL_SUCCESS != ret) {
|
|
|
|
return tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* default to auto-enable fragmentation */
|
|
|
|
mca_coll_ml_component.enable_fragmentation = 2;
|
|
|
|
tmp = mca_base_component_var_register (&mca_coll_ml_component.super.collm_version, "enable_fragmentation",
|
|
|
|
"Disable/Enable fragmentation for large messages", MCA_BASE_VAR_TYPE_INT,
|
|
|
|
new_enum, 0, 0, OPAL_INFO_LVL_9, MCA_BASE_VAR_SCOPE_READONLY,
|
|
|
|
&mca_coll_ml_component.enable_fragmentation);
|
|
|
|
if (0 > tmp) {
|
|
|
|
ret = tmp;
|
|
|
|
}
|
|
|
|
OBJ_RELEASE(new_enum);
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
CHECK(reg_int("use_brucks_smsg_alltoall", NULL,
|
|
|
|
"Use Bruck's Algo for Small Msg Alltoall"
|
|
|
|
"1 - Bruck's Algo with RDMA; 2 - Bruck's with Send Recv"
|
2013-03-28 01:09:41 +04:00
|
|
|
, 0, &mca_coll_ml_component.use_brucks_smsg_alltoall, 0));
|
2012-08-16 23:11:35 +04:00
|
|
|
|
|
|
|
asprintf(&str, "%s/mca-coll-ml.config",
|
|
|
|
opal_install_dirs.pkgdatadir);
|
|
|
|
if (NULL == str) {
|
|
|
|
return OMPI_ERR_OUT_OF_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
CHECK(reg_string("config_file", NULL,
|
|
|
|
"ML collectives configuration file",
|
|
|
|
str, &mca_coll_ml_component.config_file_name,
|
|
|
|
0));
|
|
|
|
free(str);
|
|
|
|
|
|
|
|
/* Reading parameters for list manager */
|
|
|
|
CHECK(mca_coll_ml_lmngr_reg());
|
|
|
|
|
2013-03-28 01:09:41 +04:00
|
|
|
/* Verify the parameters */
|
|
|
|
CHECK(mca_coll_ml_verify_params());
|
|
|
|
|
2012-08-16 23:11:35 +04:00
|
|
|
return ret;
|
|
|
|
}
|