本文整理汇总了C++中opal_argv_free函数的典型用法代码示例。如果您正苦于以下问题:C++ opal_argv_free函数的具体用法?C++ opal_argv_free怎么用?C++ opal_argv_free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opal_argv_free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: orte_node_destruct
static void orte_node_destruct(orte_node_t* node)
{
int i;
opal_node_stats_t *stats;
if (NULL != node->name) {
free(node->name);
node->name = NULL;
}
if (NULL != node->alias) {
opal_argv_free(node->alias);
node->alias = NULL;
}
if (NULL != node->daemon) {
node->daemon->node = NULL;
OBJ_RELEASE(node->daemon);
node->daemon = NULL;
}
for (i=0; i < node->procs->size; i++) {
if (NULL != node->procs->addr[i]) {
((orte_proc_t*)(node->procs->addr[i]))->node = NULL;
OBJ_RELEASE(node->procs->addr[i]);
node->procs->addr[i] = NULL;
}
}
OBJ_RELEASE(node->procs);
if (NULL != node->cpu_set) {
free(node->cpu_set);
node->cpu_set = NULL;
}
if (NULL != node->username) {
free(node->username);
node->username = NULL;
}
/* do NOT destroy the topology */
while (NULL != (stats = (opal_node_stats_t*)opal_ring_buffer_pop(&node->stats))) {
OBJ_RELEASE(stats);
}
OBJ_DESTRUCT(&node->stats);
}
示例2: test2
static bool test2(void)
{
int i, j;
char **argv = NULL;
int argc;
char *a[] = { "aaa", "bbb", "ccc", NULL };
char *b[4];
/* Similar test to above, but ensure that opal_argv_add is actually
*copying* the string by value, not by reference. So copy the a
array into b, and then opal_argv_add() from b. After that,
scribble in the first character of the b[] string that we just
added, and compare all entries in a to argv -- they should be
identical (even though b is now corrupted). */
for (i = 0; a[i] != NULL; ++i) {
b[i] = strdup(a[i]);
}
b[i] = NULL;
for (i = 0; b[i] != NULL; ++i) {
if (opal_argv_append(&argc, &argv, b[i]) != OPAL_SUCCESS) {
return false;
}
++b[i][0];
for (j = 0; j <= i; ++j) {
if (strcmp(argv[j], a[j]) != 0) {
return false;
}
}
if (NULL != argv[i + 1]) {
return false;
}
if (argc != i + 1) {
return false;
}
}
opal_argv_free(argv);
for (i = 0; b[i] != NULL; ++i) {
free(b[i]);
}
return true;
}
示例3: get_node_list
static char* get_node_list(orte_app_context_t *app)
{
int j;
char **total_host = NULL;
char *nodes;
if (NULL == app->dash_host) {
return NULL;
}
for (j=0; NULL != app->dash_host[j]; j++) {
opal_argv_append_unique_nosize(&total_host, app->dash_host[j], false);
}
if (NULL == total_host) {
return NULL;
}
nodes = opal_argv_join(total_host, ',');
opal_argv_free(total_host);
return nodes;
}
示例4: opal_event_init
int opal_event_init(void)
{
char **includes=NULL;
bool dumpit=false;
int i, j;
if (opal_output_get_verbosity(opal_event_base_framework.framework_output) > 4) {
event_enable_debug_mode();
dumpit = true;
}
if (NULL == event_module_include) {
/* Shouldn't happen, but... */
event_module_include = strdup("select");
}
includes = opal_argv_split(event_module_include,',');
/* get a configuration object */
config = event_config_new();
/* cycle thru the available subsystems */
for (i = 0 ; NULL != eventops[i] ; ++i) {
/* if this module isn't included in the given ones,
* then exclude it
*/
dumpit = true;
for (j=0; NULL != includes[j]; j++) {
if (0 == strcmp("all", includes[j]) ||
0 == strcmp(eventops[i]->name, includes[j])) {
dumpit = false;
break;
}
}
if (dumpit) {
event_config_avoid_method(config, eventops[i]->name);
}
}
opal_argv_free(includes);
return OPAL_SUCCESS;
}
示例5: test6
static bool test6(void)
{
char *a = "the quick brown fox jumped over the lazy dog a_really_long_argument_to_force_a_long_copy_zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz";
char **b;
char *c;
/* split the string above and then join it -- the joined version
should be just like the original */
b = opal_argv_split(a, ' ');
c = opal_argv_join(b, ' ');
if (strcmp(a, c) != 0) {
return false;
}
/* All done */
free(c);
opal_argv_free(b);
return true;
}
示例6: test1
static bool test1(void)
{
char *a[] = { "argv1", "argv2", "argv3", NULL };
char **argv = NULL;
int i, j, argc = 28;
/* Test basic functionality. Start with a NULL argv and add the
contents of the a array.
Set argc to be an initiall bogus number -- opal_argv_add() should
reset it back to zero after the first iteration.
After adding the a[i], ensure that argv[0 - (i-1)] are the same
as a[0 - (i-1)].
Also ensure that a[i + 1] == NULL and that argc is the proper
value. */
for (i = 0; a[i] != NULL; ++i) {
if (opal_argv_append(&argc, &argv, a[i]) != OPAL_SUCCESS) {
return false;
}
for (j = 0; j <= i; ++j) {
if (strcmp(argv[j], a[j]) != 0) {
return false;
}
}
if (NULL != argv[i + 1]) {
return false;
}
if (argc != i + 1) {
return false;
}
}
opal_argv_free(argv);
return true;
}
示例7: load_env_data_argv
static void
load_env_data_argv(const char *project, const char *flag, char ***data)
{
char *envname;
char *envvalue;
if (NULL == project || NULL == flag) return;
asprintf(&envname, "%s_MPI%s", project, flag);
if (NULL == (envvalue = getenv(envname))) {
free(envname);
asprintf(&envname, "%s_%s", project, flag);
if (NULL == (envvalue = getenv(envname))) {
free(envname);
return;
}
}
free(envname);
if (NULL != *data) opal_argv_free(*data);
*data = opal_argv_split(envvalue, ' ');
}
示例8: options_data_expand
static void
options_data_expand(const char *value)
{
/* make space for the new set of args */
parse_options_idx++;
options_data = (struct options_data_t *) realloc(options_data, sizeof(struct options_data_t) * (parse_options_idx + 1));
options_data_init(&(options_data[parse_options_idx]));
/* if there are values, this is not the default case.
Otherwise, it's the default case... */
if (NULL != value && 0 != strcmp(value, "")) {
char **values = opal_argv_split(value, ';');
opal_argv_insert(&(options_data[parse_options_idx].compiler_args),
opal_argv_count(options_data[parse_options_idx].compiler_args),
values);
opal_argv_free(values);
} else {
free(options_data[parse_options_idx].compiler_args);
options_data[parse_options_idx].compiler_args = NULL;
/* this is a default */
default_data_idx = parse_options_idx;
}
}
示例9: allocate
static int allocate(opal_list_t *nodes)
{
char **nodelist;
orte_node_t *node;
int i, num_nodes;
/* get the list of allocated nodes */
if ((num_nodes = lsb_getalloc(&nodelist)) < 0) {
orte_show_help("help-ras-lsf.txt", "nodelist-failed", true);
return ORTE_ERR_NOT_AVAILABLE;
}
node = NULL;
/* step through the list */
for (i = 0; i < num_nodes; i++) {
/* is this a repeat of the current node? */
if (NULL != node && 0 == strcmp(nodelist[i], node->name)) {
/* it is a repeat - just bump the slot count */
++node->slots;
continue;
}
/* not a repeat - create a node entry for it */
node = OBJ_NEW(orte_node_t);
node->name = strdup(nodelist[i]);
node->slots_inuse = 0;
node->slots_max = 0;
node->slots = 1;
opal_list_append(nodes, &node->super);
}
/* release the nodelist from lsf */
opal_argv_free(nodelist);
return ORTE_SUCCESS;
}
示例10: main
//.........这里部分代码省略.........
opal_pointer_array_add(&mca_types, "mtl");
opal_pointer_array_add(&mca_types, "topo");
opal_pointer_array_add(&mca_types, "osc");
opal_pointer_array_add(&mca_types, "op");
opal_pointer_array_add(&mca_types, "common");
#if OPAL_ENABLE_FT_CR == 1
opal_pointer_array_add(&mca_types, "crcp");
#endif
#if !ORTE_DISABLE_FULL_SUPPORT
opal_pointer_array_add(&mca_types, "iof");
opal_pointer_array_add(&mca_types, "oob");
opal_pointer_array_add(&mca_types, "odls");
opal_pointer_array_add(&mca_types, "ras");
opal_pointer_array_add(&mca_types, "rmaps");
opal_pointer_array_add(&mca_types, "rml");
opal_pointer_array_add(&mca_types, "routed");
opal_pointer_array_add(&mca_types, "plm");
#if OPAL_ENABLE_FT_CR == 1
opal_pointer_array_add(&mca_types, "snapc");
#endif
opal_pointer_array_add(&mca_types, "filem");
#endif
/* these are always included */
opal_pointer_array_add(&mca_types, "errmgr");
opal_pointer_array_add(&mca_types, "ess");
opal_pointer_array_add(&mca_types, "grpcomm");
opal_pointer_array_add(&mca_types, "notifier");
/* Execute the desired action(s) */
if (opal_cmd_line_is_taken(ompi_info_cmd_line, "ompi_info_pretty")) {
ompi_info_pretty = true;
} else if (opal_cmd_line_is_taken(ompi_info_cmd_line, "parsable") || opal_cmd_line_is_taken(ompi_info_cmd_line, "parseable")) {
ompi_info_pretty = false;
}
want_all = opal_cmd_line_is_taken(ompi_info_cmd_line, "all");
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "version")) {
ompi_info_do_version(want_all, ompi_info_cmd_line);
acted = true;
}
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "path")) {
ompi_info_do_path(want_all, ompi_info_cmd_line);
acted = true;
}
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "arch")) {
ompi_info_do_arch();
acted = true;
}
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "hostname")) {
ompi_info_do_hostname();
acted = true;
}
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "config")) {
ompi_info_do_config(true);
acted = true;
}
if (want_all || opal_cmd_line_is_taken(ompi_info_cmd_line, "param")) {
ompi_info_do_params(want_all, opal_cmd_line_is_taken(ompi_info_cmd_line, "internal"));
acted = true;
}
/* If no command line args are specified, show default set */
if (!acted) {
ompi_info_show_ompi_version(ompi_info_ver_full);
ompi_info_show_path(ompi_info_path_prefix, opal_install_dirs.prefix);
ompi_info_do_arch();
ompi_info_do_hostname();
ompi_info_do_config(false);
ompi_info_open_components();
for (i = 0; i < mca_types.size; ++i) {
if (NULL == (str = (char*)opal_pointer_array_get_item(&mca_types, i))) {
continue;
}
if (0 != strcmp("mpi", str)) {
ompi_info_show_component_version(str, ompi_info_component_all,
ompi_info_ver_full, ompi_info_type_all);
}
}
}
/* All done */
if (NULL != app_env) {
opal_argv_free(app_env);
}
if (NULL != global_env) {
opal_argv_free(global_env);
}
ompi_info_close_components();
OBJ_RELEASE(ompi_info_cmd_line);
OBJ_DESTRUCT(&mca_types);
mca_base_close();
opal_finalize_util();
return 0;
}
示例11: opal_os_dirpath_create
int opal_os_dirpath_create(const char *path, const mode_t mode)
{
struct stat buf;
char **parts, *tmp;
int i, len;
int ret;
if (NULL == path) { /* protect ourselves from errors */
return(OPAL_ERROR);
}
if (0 == (ret = stat(path, &buf))) { /* already exists */
if (mode == (mode & buf.st_mode)) { /* has correct mode */
return(OPAL_SUCCESS);
}
if (0 == (ret = chmod(path, (buf.st_mode | mode)))) { /* successfully change mode */
return(OPAL_SUCCESS);
}
opal_output(0,
"opal_os_dirpath_create: "
"Error: Unable to create directory (%s), unable to set the correct mode [%d]\n",
path, ret);
return(OPAL_ERROR); /* can't set correct mode */
}
/* quick -- try to make directory */
if (0 == mkdir(path, mode)) {
return(OPAL_SUCCESS);
}
/* didnt work, so now have to build our way down the tree */
/* Split the requested path up into its individual parts */
parts = opal_argv_split(path, path_sep[0]);
/* Ensure to allocate enough space for tmp: the strlen of the
incoming path + 1 (for \0) */
tmp = (char*)malloc(strlen(path) + 1);
tmp[0] = '\0';
/* Iterate through all the subdirectory names in the path,
building up a directory name. Check to see if that dirname
exists. If it doesn't, create it. */
len = opal_argv_count(parts);
for (i = 0; i < len; ++i) {
if (i == 0) {
/* If in POSIX-land, ensure that we never end a directory
name with path_sep */
if ('/' == path[0]) {
strcat(tmp, path_sep);
}
strcat(tmp, parts[i]);
}
/* If it's not the first part, ensure that there's a
preceeding path_sep and then append this part */
else {
if (path_sep[0] != tmp[strlen(tmp) - 1]) {
strcat(tmp, path_sep);
}
strcat(tmp, parts[i]);
}
/* Now that we finally have the name to check, check it.
Create it if it doesn't exist. */
ret = mkdir(tmp, mode);
if ((0 > ret && EEXIST != errno) || 0 != stat(tmp, &buf)) {
opal_output(0,
"opal_os_dirpath_create: "
"Error: Unable to create the sub-directory (%s) of (%s), mkdir failed [%d]\n",
tmp, path, ret);
opal_argv_free(parts);
free(tmp);
return OPAL_ERROR;
}
}
/* All done */
opal_argv_free(parts);
free(tmp);
return OPAL_SUCCESS;
}
示例12: opal_util_init_sys_limits
//.........这里部分代码省略.........
* that we set the limits on #files, #children,
* and max file size
*/
if (0 == strcmp(lim[0], "1")) {
#if HAVE_DECL_RLIMIT_NOFILE
if (OPAL_SUCCESS !=
opal_setlimit(RLIMIT_NOFILE, "max", &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "openfiles", "max");
goto out;
}
opal_sys_limits.num_files = value;
#endif
#if HAVE_DECL_RLIMIT_NPROC
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_NPROC, "max", &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "maxchildren", "max");
goto out;
}
opal_sys_limits.num_procs = value;
#endif
#if HAVE_DECL_RLIMIT_FSIZE
if (OPAL_SUCCESS !=
opal_setlimit(RLIMIT_FSIZE, "max", &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "filesize", "max");
goto out;
}
opal_sys_limits.file_size = value;
#endif
break;
} else if (0 == strcmp(lim[0], "0")) {
/* user didn't want anything set */
break;
}
/* process them separately */
if (0 == strcmp(lim[0], "core")) {
#if HAVE_DECL_RLIMIT_CORE
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_CORE, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "openfiles", setlim);
goto out;
}
#endif
} else if (0 == strcmp(lim[0], "filesize")) {
#if HAVE_DECL_RLIMIT_FSIZE
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_FSIZE, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "filesize", setlim);
goto out;
}
opal_sys_limits.file_size = value;
#endif
} else if (0 == strcmp(lim[0], "maxmem")) {
#if HAVE_DECL_RLIMIT_AS
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_AS, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "maxmem", setlim);
goto out;
}
#endif
} else if (0 == strcmp(lim[0], "openfiles")) {
#if HAVE_DECL_RLIMIT_NOFILE
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_NOFILE, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "openfiles", setlim);
goto out;
}
opal_sys_limits.num_files = value;
#endif
} else if (0 == strcmp(lim[0], "stacksize")) {
#if HAVE_DECL_RLIMIT_STACK
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_STACK, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "stacksize", setlim);
goto out;
}
#endif
} else if (0 == strcmp(lim[0], "maxchildren")) {
#if HAVE_DECL_RLIMIT_NPROC
if (OPAL_SUCCESS != opal_setlimit(RLIMIT_NPROC, setlim, &value)) {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-failed", true, "maxchildren", setlim);
goto out;
}
opal_sys_limits.num_procs = value;
#endif
} else {
*errmsg = opal_show_help_string("help-opal-util.txt", "sys-limit-unrecognized", true, lim[0], setlim);
goto out;
}
opal_argv_free(lim);
lim = NULL;
}
/* indicate we initialized the limits structure */
opal_sys_limits.initialized = true;
rc = OPAL_SUCCESS;
out:
opal_argv_free(lims);
if (NULL != lim) {
opal_argv_free(lim);
}
return rc;
}
示例13: rte_init
static int rte_init(void)
{
int ret;
char *error = NULL;
char **hosts = NULL;
/* run the prolog */
if (ORTE_SUCCESS != (ret = orte_ess_base_std_prolog())) {
error = "orte_ess_base_std_prolog";
goto error;
}
/* Start by getting a unique name */
tm_set_name();
/* if I am a daemon, complete my setup using the
* default procedure
*/
if (ORTE_PROC_IS_DAEMON) {
if (NULL != orte_node_regex) {
/* extract the nodes */
if (ORTE_SUCCESS != (ret =
orte_regex_extract_node_names(orte_node_regex, &hosts)) ||
NULL == hosts) {
error = "orte_regex_extract_node_names";
goto error;
}
}
if (ORTE_SUCCESS != (ret = orte_ess_base_orted_setup(hosts))) {
ORTE_ERROR_LOG(ret);
error = "orte_ess_base_orted_setup";
goto error;
}
opal_argv_free(hosts);
return ORTE_SUCCESS;
}
if (ORTE_PROC_IS_TOOL) {
/* otherwise, if I am a tool proc, use that procedure */
if (ORTE_SUCCESS != (ret = orte_ess_base_tool_setup())) {
ORTE_ERROR_LOG(ret);
error = "orte_ess_base_tool_setup";
goto error;
}
return ORTE_SUCCESS;
}
/* no other options are supported! */
error = "ess_error";
ret = ORTE_ERROR;
error:
if (ORTE_ERR_SILENT != ret && !orte_report_silent_errors) {
orte_show_help("help-orte-runtime.txt",
"orte_init:startup:internal-failure",
true, error, ORTE_ERROR_NAME(ret), ret);
}
return ret;
}
示例14: orte_util_add_dash_host_nodes
/* we can only enter this routine if no other allocation
* was found, so we only need to know that finding any
* relative node syntax should generate an immediate error
*/
int orte_util_add_dash_host_nodes(opal_list_t *nodes,
bool *override_oversubscribed,
char ** host_argv)
{
opal_list_item_t* item;
orte_std_cntr_t i, j, k;
int rc;
char **mapped_nodes = NULL, **mini_map;
orte_node_t *node;
/* Accumulate all of the host name mappings */
for (j = 0; j < opal_argv_count(host_argv); ++j) {
mini_map = opal_argv_split(host_argv[j], ',');
if (mapped_nodes == NULL) {
mapped_nodes = mini_map;
} else {
for (k = 0; NULL != mini_map[k]; ++k) {
rc = opal_argv_append_nosize(&mapped_nodes,
mini_map[k]);
if (OPAL_SUCCESS != rc) {
goto cleanup;
}
}
opal_argv_free(mini_map);
}
}
/* Did we find anything? If not, then do nothing */
if (NULL == mapped_nodes) {
return ORTE_SUCCESS;
}
/* go through the names found and
add them to the host list. If they're not unique, then
bump the slots count for each duplicate */
for (i = 0; NULL != mapped_nodes[i]; ++i) {
/* if the specified node contains a relative node syntax,
* this is an error
*/
if ('+' == mapped_nodes[i][0]) {
orte_show_help("help-dash-host.txt", "dash-host:relative-syntax",
true, mapped_nodes[i]);
rc = ORTE_ERR_SILENT;
goto cleanup;
}
/* see if the node is already on the list */
for (item = opal_list_get_first(nodes);
item != opal_list_get_end(nodes);
item = opal_list_get_next(item)) {
node = (orte_node_t*) item;
if (0 == strcmp(node->name, mapped_nodes[i]) ||
(0 == strcmp(node->name, orte_process_info.nodename) &&
(0 == strcmp(mapped_nodes[i], "localhost") || opal_ifislocal(mapped_nodes[i])))) {
++node->slots;
break;
}
}
/* If we didn't find it, add it to the list */
if (item == opal_list_get_end(nodes)) {
node = OBJ_NEW(orte_node_t);
if (NULL == node) {
return ORTE_ERR_OUT_OF_RESOURCE;
}
/* check to see if this is a local name */
if (0 == strcmp(mapped_nodes[i], "localhost") ||
opal_ifislocal(mapped_nodes[i])) {
/* it is local, so use the local nodename to avoid
* later confusion
*/
if (orte_show_resolved_nodenames &&
0 != strcmp(mapped_nodes[i], orte_process_info.nodename)) {
/* add to list of aliases for this node - only add if unique */
opal_argv_append_unique_nosize(&node->alias, mapped_nodes[i]);
}
node->name = strdup(orte_process_info.nodename);
} else {
/* not local - use the given name */
node->name = strdup(mapped_nodes[i]);
}
node->state = ORTE_NODE_STATE_UP;
node->slots_inuse = 0;
node->slots_max = 0;
node->slots = 1;
/* indicate that ORTE should override any oversubscribed conditions
* based on local hardware limits since the user (a) might not have
* provided us any info on the #slots for a node, and (b) the user
* might have been wrong! If we don't check the number of local physical
* processors, then we could be too aggressive on our sched_yield setting
* and cause performance problems.
*/
*override_oversubscribed = true;
//.........这里部分代码省略.........
示例15: mca_btl_tcp_component_register
static int mca_btl_tcp_component_register(void)
{
char* message;
/* register TCP component parameters */
mca_btl_tcp_param_register_uint("links", NULL, 1, OPAL_INFO_LVL_4, &mca_btl_tcp_component.tcp_num_links);
mca_btl_tcp_param_register_string("if_include", "Comma-delimited list of devices and/or CIDR notation of networks to use for MPI communication (e.g., \"eth0,192.168.0.0/16\"). Mutually exclusive with btl_tcp_if_exclude.", "", OPAL_INFO_LVL_1, &mca_btl_tcp_component.tcp_if_include);
mca_btl_tcp_param_register_string("if_exclude", "Comma-delimited list of devices and/or CIDR notation of networks to NOT use for MPI communication -- all devices not matching these specifications will be used (e.g., \"eth0,192.168.0.0/16\"). If set to a non-default value, it is mutually exclusive with btl_tcp_if_include.",
"127.0.0.1/8,sppp",
OPAL_INFO_LVL_1, &mca_btl_tcp_component.tcp_if_exclude);
mca_btl_tcp_param_register_int ("free_list_num", NULL, 8, OPAL_INFO_LVL_5, &mca_btl_tcp_component.tcp_free_list_num);
mca_btl_tcp_param_register_int ("free_list_max", NULL, -1, OPAL_INFO_LVL_5, &mca_btl_tcp_component.tcp_free_list_max);
mca_btl_tcp_param_register_int ("free_list_inc", NULL, 32, OPAL_INFO_LVL_5, &mca_btl_tcp_component.tcp_free_list_inc);
mca_btl_tcp_param_register_int ("sndbuf", NULL, 128*1024, OPAL_INFO_LVL_4, &mca_btl_tcp_component.tcp_sndbuf);
mca_btl_tcp_param_register_int ("rcvbuf", NULL, 128*1024, OPAL_INFO_LVL_4, &mca_btl_tcp_component.tcp_rcvbuf);
mca_btl_tcp_param_register_int ("endpoint_cache",
"The size of the internal cache for each TCP connection. This cache is"
" used to reduce the number of syscalls, by replacing them with memcpy."
" Every read will read the expected data plus the amount of the"
" endpoint_cache", 30*1024, OPAL_INFO_LVL_4, &mca_btl_tcp_component.tcp_endpoint_cache);
mca_btl_tcp_param_register_int ("use_nagle", "Whether to use Nagle's algorithm or not (using Nagle's algorithm may increase short message latency)", 0, OPAL_INFO_LVL_4, &mca_btl_tcp_component.tcp_not_use_nodelay);
mca_btl_tcp_param_register_int( "port_min_v4",
"The minimum port where the TCP BTL will try to bind (default 1024)",
1024, OPAL_INFO_LVL_2, &mca_btl_tcp_component.tcp_port_min);
asprintf( &message,
"The number of ports where the TCP BTL will try to bind (default %d)."
" This parameter together with the port min, define a range of ports"
" where Open MPI will open sockets.",
(0x1 << 16) - mca_btl_tcp_component.tcp_port_min - 1 );
mca_btl_tcp_param_register_int( "port_range_v4", message,
(0x1 << 16) - mca_btl_tcp_component.tcp_port_min - 1,
OPAL_INFO_LVL_2, &mca_btl_tcp_component.tcp_port_range);
free(message);
#if OPAL_WANT_IPV6
mca_btl_tcp_param_register_int( "port_min_v6",
"The minimum port where the TCP BTL will try to bind (default 1024)", 1024,
OPAL_INFO_LVL_2, & mca_btl_tcp_component.tcp6_port_min );
asprintf( &message,
"The number of ports where the TCP BTL will try to bind (default %d)."
" This parameter together with the port min, define a range of ports"
" where Open MPI will open sockets.",
(0x1 << 16) - mca_btl_tcp_component.tcp6_port_min - 1 );
mca_btl_tcp_param_register_int( "port_range_v6", message,
(0x1 << 16) - mca_btl_tcp_component.tcp6_port_min - 1,
OPAL_INFO_LVL_2, &mca_btl_tcp_component.tcp6_port_range );
free(message);
#endif
mca_btl_tcp_module.super.btl_exclusivity = MCA_BTL_EXCLUSIVITY_LOW + 100;
mca_btl_tcp_module.super.btl_eager_limit = 64*1024;
mca_btl_tcp_module.super.btl_rndv_eager_limit = 64*1024;
mca_btl_tcp_module.super.btl_max_send_size = 128*1024;
mca_btl_tcp_module.super.btl_rdma_pipeline_send_length = 128*1024;
mca_btl_tcp_module.super.btl_rdma_pipeline_frag_size = INT_MAX;
mca_btl_tcp_module.super.btl_min_rdma_pipeline_size = 0;
mca_btl_tcp_module.super.btl_flags = MCA_BTL_FLAGS_PUT |
MCA_BTL_FLAGS_SEND_INPLACE |
MCA_BTL_FLAGS_NEED_CSUM |
MCA_BTL_FLAGS_NEED_ACK |
MCA_BTL_FLAGS_HETEROGENEOUS_RDMA;
mca_btl_tcp_module.super.btl_seg_size = sizeof (mca_btl_base_segment_t);
mca_btl_tcp_module.super.btl_bandwidth = 100;
mca_btl_tcp_module.super.btl_latency = 100;
mca_btl_base_param_register(&mca_btl_tcp_component.super.btl_version,
&mca_btl_tcp_module.super);
mca_btl_tcp_param_register_int ("disable_family", NULL, 0, OPAL_INFO_LVL_2, &mca_btl_tcp_component.tcp_disable_family);
/* Register a list of interfaces to use in sequence */
mca_btl_tcp_param_register_string("if_seq",
"If specified, a comma-delimited list of TCP interfaces. Interfaces will be assigned, one to each MPI process, in a round-robin fashion on each server. For example, if the list is \"eth0,eth1\" and four MPI processes are run on a single server, then local ranks 0 and 2 will use eth0 and local ranks 1 and 3 will use eth1.", NULL, OPAL_INFO_LVL_9, &mca_btl_tcp_if_seq_string);
mca_btl_tcp_component.tcp_if_seq = NULL;
if (NULL != mca_btl_tcp_if_seq_string && '\0' != *mca_btl_tcp_if_seq_string) {
char **argv = opal_argv_split(mca_btl_tcp_if_seq_string, ',');
if (NULL != argv && '\0' != *(argv[0])) {
int if_index, rc, count;
ompi_node_rank_t node_rank;
char name[256];
node_rank = ompi_process_info.my_node_rank;
/* Now that we've got that local rank, take the
corresponding entry from the tcp_if_seq list (wrapping
if necessary) */
count = opal_argv_count(argv);
mca_btl_tcp_component.tcp_if_seq =
strdup(argv[node_rank % count]);
opal_argv_free(argv);
/* Double check that the selected interface actually exists */
for (if_index = opal_ifbegin(); if_index >= 0;
if_index = opal_ifnext(if_index)){
if (OPAL_SUCCESS !=
(rc = opal_ifindextoname(if_index, name, sizeof(name)))) {
return rc;
//.........这里部分代码省略.........