1
1

r24976 wasn't quite right -- you now actually get a warning if you

specify btl_tcp_if_include because btl_tcp_if_exclude is defaulted to
the loopback devices.

This commit does a few things:

 * Introduce a new OPAL MCA base function:
   mca_base_param_check_exclusive_string().  It checks to see that the
   ''user'' does not set two MCA parameters that are mutually
   exclusive by checking the source of those MCS param values.
 * Use the above function in many BTLs (and the OOB TCP) to ensure
   that <foo>_if_include and <foo>_if_exclude are not both specified
   ''by the user''.
 * Re-arrange many of these BTLs to move their MCA registration code
   into a separate component_register() function (vs. the
   component_open() function).

This code has been nominally reviewed and checked by Ralph, George,
Terry, and Shiqing.

This commit was SVN r25043.

The following SVN revision numbers were found above:
  r24976 --> open-mpi/ompi@8f4ac54336
Этот коммит содержится в:
Jeff Squyres 2011-08-10 17:24:36 +00:00
родитель e3c869d83b
Коммит 1cbfb53801
16 изменённых файлов: 486 добавлений и 246 удалений

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -127,16 +128,6 @@ struct mca_btl_mx_module_t {
typedef struct mca_btl_mx_module_t mca_btl_mx_module_t;
extern mca_btl_mx_module_t mca_btl_mx_module;
/**
* Register MX component parameters with the MCA framework
*/
extern int mca_btl_mx_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_btl_mx_component_close(void);
/**
* MX component initialization.
*

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved.
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -39,6 +40,11 @@
#include "mx_internals/mx__driver_interface.h"
#endif /* MX_HAVE_MAPPER_STATE */
static int mca_btl_mx_component_register(void);
static int mca_btl_mx_component_open(void);
static int mca_btl_mx_component_close(void);
mca_btl_mx_component_t mca_btl_mx_component = {
{
/* First, the mca_base_component_t struct containing meta information
@ -52,7 +58,9 @@ mca_btl_mx_component_t mca_btl_mx_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
mca_btl_mx_component_open, /* component open */
mca_btl_mx_component_close /* component close */
mca_btl_mx_component_close, /* component close */
NULL, /* component query */
mca_btl_mx_component_register, /* component register */
},
{
/* The component is checkpoint ready */
@ -64,20 +72,9 @@ mca_btl_mx_component_t mca_btl_mx_component = {
}
};
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
int mca_btl_mx_component_open(void)
static int mca_btl_mx_component_register(void)
{
/* initialize state */
mca_btl_mx_component.mx_num_btls = 0;
mca_btl_mx_component.mx_btls = NULL;
mca_btl_mx_component.mx_use_unexpected = 0;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_mx_component.mx_procs, opal_list_t);
mca_base_param_reg_int( (mca_base_component_t*)&mca_btl_mx_component, "max_btls",
"Maximum number of accepted Myrinet cards",
false, false, 8, &mca_btl_mx_component.mx_max_btls );
@ -164,6 +161,24 @@ int mca_btl_mx_component_open(void)
mca_btl_base_param_register(&mca_btl_mx_component.super.btl_version,
&mca_btl_mx_module.super);
return OMPI_SUCCESS;
}
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
static int mca_btl_mx_component_open(void)
{
/* initialize state */
mca_btl_mx_component.mx_num_btls = 0;
mca_btl_mx_component.mx_btls = NULL;
mca_btl_mx_component.mx_use_unexpected = 0;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_mx_component.mx_procs, opal_list_t);
if( 0 == mca_btl_mx_component.mx_support_sharedmem )
opal_setenv( "MX_DISABLE_SHMEM", "1", true, &environ );
if( 0 == mca_btl_mx_component.mx_support_self )
@ -178,7 +193,7 @@ int mca_btl_mx_component_open(void)
* component cleanup - sanity checking of queue lengths
*/
int mca_btl_mx_component_close(void)
static int mca_btl_mx_component_close(void)
{
if( NULL == mca_btl_mx_component.mx_btls )
return OMPI_SUCCESS;

Просмотреть файл

@ -11,6 +11,7 @@
* All rights reserved.
* Copyright (c) 2006 Sandia National Laboratories. All rights
* reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -163,20 +164,6 @@ struct mca_btl_ud_frag_t;
extern mca_btl_ud_module_t mca_btl_ofud_module;
/**
* Open the component; register UD/IB parameters with the MCA framework
*/
extern int mca_btl_ud_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_btl_ud_component_close(void);
/**
* IB component initialization.
*

Просмотреть файл

@ -11,7 +11,7 @@
* All rights reserved.
* Copyright (c) 2006 Sandia National Laboratories. All rights
* reserved.
* Copyright (c) 2008-2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -49,6 +49,10 @@
#include "btl_ofud_endpoint.h"
static int mca_btl_ud_component_register(void);
static int mca_btl_ud_component_open(void);
static int mca_btl_ud_component_close(void);
mca_btl_ud_component_t mca_btl_ofud_component = {
{
/* First, the mca_base_component_t struct containing meta information
@ -61,7 +65,9 @@ mca_btl_ud_component_t mca_btl_ofud_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
mca_btl_ud_component_open, /* component open */
mca_btl_ud_component_close /* component close */
mca_btl_ud_component_close, /* component close */
NULL, /* component query */
mca_btl_ud_component_register, /* component register */
},
{
/* The component is not checkpoint ready */
@ -108,22 +114,9 @@ static inline void mca_btl_ud_param_reg_int(const char* param_name,
}
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
int mca_btl_ud_component_open(void)
static int mca_btl_ud_component_register(void)
{
int val;
/* initialize state */
mca_btl_ofud_component.num_btls = 0;
mca_btl_ofud_component.ud_btls = NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_ofud_component.ud_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_btl_ofud_component.ud_procs, opal_list_t);
/* register IB component parameters */
mca_btl_ud_param_reg_int("max_btls",
@ -180,7 +173,7 @@ int mca_btl_ud_component_open(void)
mca_btl_ud_param_reg_int("bandwidth",
"Approximate maximum bandwidth of interconnect",
800, (int*)&mca_btl_ofud_module.super.btl_bandwidth);
mca_btl_ofud_module.super.btl_eager_limit -= sizeof(mca_btl_ud_header_t);
mca_btl_ofud_module.super.btl_max_send_size -= sizeof(mca_btl_ud_header_t);
@ -188,11 +181,43 @@ int mca_btl_ud_component_open(void)
}
/*
* Called by MCA framework to open the component
*/
static int mca_btl_ud_component_open(void)
{
/* initialize state */
mca_btl_ofud_component.num_btls = 0;
mca_btl_ofud_component.ud_btls = NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_ofud_component.ud_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_btl_ofud_component.ud_procs, opal_list_t);
/* if_include and if_exclude need to be mutually exclusive */
if (OPAL_SUCCESS !=
mca_base_param_check_exclusive_string(
mca_btl_ofud_component.super.btl_version.mca_type_name,
mca_btl_ofud_component.super.btl_version.mca_component_name,
"if_include",
mca_btl_ofud_component.super.btl_version.mca_type_name,
mca_btl_ofud_component.super.btl_version.mca_component_name,
"if_exclude")) {
/* Return ERR_NOT_AVAILABLE so that a warning message about
"open" failing is not printed */
return OMPI_ERR_NOT_AVAILABLE;
}
return OMPI_SUCCESS;
}
/*
* Component cleanup
*/
int mca_btl_ud_component_close(void)
static int mca_btl_ud_component_close(void)
{
OBJ_DESTRUCT(&mca_btl_ofud_component.ud_lock);
OBJ_DESTRUCT(&mca_btl_ofud_component.ud_procs);

Просмотреть файл

@ -101,6 +101,7 @@ const char *ibv_get_sysfs_path(void);
/*
* Local functions
*/
static int btl_openib_component_register(void);
static int btl_openib_component_open(void);
static int btl_openib_component_close(void);
static mca_btl_base_module_t **btl_openib_component_init(int*, bool, bool);
@ -124,7 +125,9 @@ mca_btl_openib_component_t mca_btl_openib_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
btl_openib_component_open, /* component open */
btl_openib_component_close /* component close */
btl_openib_component_close, /* component close */
NULL, /* component query */
btl_openib_component_register, /* component register */
},
{
/* The component is checkpoint ready */
@ -136,14 +139,40 @@ mca_btl_openib_component_t mca_btl_openib_component = {
}
};
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
int btl_openib_component_open(void)
static int btl_openib_component_register(void)
{
int ret;
/* register IB component parameters */
ret = btl_openib_register_mca_params();
mca_btl_openib_component.max_send_size =
mca_btl_openib_module.super.btl_max_send_size;
mca_btl_openib_component.eager_limit =
mca_btl_openib_module.super.btl_eager_limit;
/* if_include and if_exclude need to be mutually exclusive */
if (OPAL_SUCCESS !=
mca_base_param_check_exclusive_string(
mca_btl_openib_component.super.btl_version.mca_type_name,
mca_btl_openib_component.super.btl_version.mca_component_name,
"if_include",
mca_btl_openib_component.super.btl_version.mca_type_name,
mca_btl_openib_component.super.btl_version.mca_component_name,
"if_exclude")) {
/* Return ERR_NOT_AVAILABLE so that a warning message about
"open" failing is not printed */
return OMPI_ERR_NOT_AVAILABLE;
}
return OMPI_SUCCESS;
}
/*
* Called by MCA framework to open the component
*/
static int btl_openib_component_open(void)
{
#if OPAL_HAVE_THREADS
opal_mutex_t *lock = &mca_btl_openib_component.srq_manager.lock;
opal_hash_table_t *srq_addr_table = &mca_btl_openib_component.srq_manager.srq_addr_table;
@ -164,16 +193,8 @@ int btl_openib_component_open(void)
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_openib_component.ib_procs, opal_list_t);
/* register IB component parameters */
ret = btl_openib_register_mca_params();
mca_btl_openib_component.max_send_size =
mca_btl_openib_module.super.btl_max_send_size;
mca_btl_openib_component.eager_limit =
mca_btl_openib_module.super.btl_eager_limit;
srand48(getpid() * time(NULL));
return ret;
return OMPI_SUCCESS;
}
/*

Просмотреть файл

@ -9,6 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -120,16 +121,6 @@ extern mca_btl_sctp_module_t mca_btl_sctp_module;
#define CLOSE_THE_SOCKET(socket) close(socket)
#endif /* defined(__WINDOWS__) */
/**
* Register SCTP component parameters with the MCA framework
*/
extern int mca_btl_sctp_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_btl_sctp_component_close(void);
/**
* SCTP component initialization.
*

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* $COPYRIGHT$
*
@ -66,6 +66,11 @@
#include "btl_sctp_recv_handler.h"
#include "btl_sctp_component.h"
static int mca_btl_sctp_component_register(void);
static int mca_btl_sctp_component_open(void);
static int mca_btl_sctp_component_close(void);
mca_btl_sctp_component_t mca_btl_sctp_component = {
{
/* First, the mca_base_component_t struct containing meta information
@ -79,7 +84,9 @@ mca_btl_sctp_component_t mca_btl_sctp_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
mca_btl_sctp_component_open, /* component open */
mca_btl_sctp_component_close /* component close */
mca_btl_sctp_component_close, /* component close */
NULL,
mca_btl_sctp_component_register, /* component register */
},
{
/* Whether the component is checkpointable or not */
@ -164,47 +171,8 @@ static void mca_btl_sctp_component_recv_handler(int, short, void*); /* for 1-1 *
/* mca_btl_sctp_recv_handler(int, short, void*) for 1-many is in btl_sctp_recv_handler.h */
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
int mca_btl_sctp_component_open(void)
static int mca_btl_sctp_component_register(void)
{
#ifdef __WINDOWS__
WSADATA win_sock_data;
if (WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0) {
BTL_ERROR(("failed to initialise windows sockets:%d", WSAGetLastError()));
return OMPI_ERROR;
}
#endif
/* initialize state */
mca_btl_sctp_component.sctp_listen_sd = -1;
/* TODO different sd for ipv6 */
mca_btl_sctp_component.sctp_num_btls=0;
/* addr_count */
mca_btl_sctp_component.sctp_btls=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_procs, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_frag_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_frag_max, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_frag_user, ompi_free_list_t);
opal_hash_table_init(&mca_btl_sctp_component.sctp_procs, 256);
#if MCA_BTL_SCTP_DONT_USE_HASH
/* TODO make this only allocate how much it needs to. Currently
* allocates 256 (to match sctp_procs). recvr_proc_table and
* sender_proc_table are malloc'd in mca_btl_sctp_component_init.
*/
recvr_proc_table = NULL;
sender_proc_table = NULL;
#else
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_assocID_hash, opal_hash_table_t);
opal_hash_table_init(&mca_btl_sctp_component.sctp_assocID_hash, 256);
#endif
/* register SCTP component parameters */
/* num links */
mca_btl_sctp_component.sctp_if_include =
@ -254,7 +222,63 @@ int mca_btl_sctp_component_open(void)
mca_btl_base_param_register(&mca_btl_sctp_component.super.btl_version,
&mca_btl_sctp_module.super);
/* disable_family */
return OMPI_SUCCESS;
}
/*
* Called by MCA framework to open the component
*/
static int mca_btl_sctp_component_open(void)
{
#ifdef __WINDOWS__
WSADATA win_sock_data;
if (WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0) {
BTL_ERROR(("failed to initialise windows sockets:%d", WSAGetLastError()));
return OMPI_ERROR;
}
#endif
/* initialize state */
mca_btl_sctp_component.sctp_listen_sd = -1;
/* TODO different sd for ipv6 */
mca_btl_sctp_component.sctp_num_btls=0;
/* addr_count */
mca_btl_sctp_component.sctp_btls=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_procs, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_frag_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_frag_max, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_frag_user, ompi_free_list_t);
opal_hash_table_init(&mca_btl_sctp_component.sctp_procs, 256);
#if MCA_BTL_SCTP_DONT_USE_HASH
/* TODO make this only allocate how much it needs to. Currently
* allocates 256 (to match sctp_procs). recvr_proc_table and
* sender_proc_table are malloc'd in mca_btl_sctp_component_init.
*/
recvr_proc_table = NULL;
sender_proc_table = NULL;
#else
OBJ_CONSTRUCT(&mca_btl_sctp_component.sctp_assocID_hash, opal_hash_table_t);
opal_hash_table_init(&mca_btl_sctp_component.sctp_assocID_hash, 256);
#endif
/* if_include and if_exclude need to be mutually exclusive */
if (OPAL_SUCCESS !=
mca_base_param_check_exclusive_string(
mca_btl_sctp_component.super.btl_version.mca_type_name,
mca_btl_sctp_component.super.btl_version.mca_component_name,
"if_include",
mca_btl_sctp_component.super.btl_version.mca_type_name,
mca_btl_sctp_component.super.btl_version.mca_component_name,
"if_exclude")) {
/* Return ERR_NOT_AVAILABLE so that a warning message about
"open" failing is not printed */
return OMPI_ERR_NOT_AVAILABLE;
}
/* setup receive buffer */
if(0 == mca_btl_sctp_recv_handler_initbuf()) {

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -128,16 +128,6 @@ extern mca_btl_tcp_module_t mca_btl_tcp_module;
#define CLOSE_THE_SOCKET(socket) close(socket)
#endif /* defined(__WINDOWS__) */
/**
* Register TCP component parameters with the MCA framework
*/
extern int mca_btl_tcp_component_open(void);
/**
* Any final cleanup before being unloaded.
*/
extern int mca_btl_tcp_component_close(void);
/**
* TCP component initialization.
*

Просмотреть файл

@ -73,6 +73,14 @@
#include "btl_tcp_endpoint.h"
/*
* Local functions
*/
static int mca_btl_tcp_component_register(void);
static int mca_btl_tcp_component_open(void);
static int mca_btl_tcp_component_close(void);
mca_btl_tcp_component_t mca_btl_tcp_component = {
{
/* First, the mca_base_component_t struct containing meta information
@ -86,7 +94,9 @@ mca_btl_tcp_component_t mca_btl_tcp_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
mca_btl_tcp_component_open, /* component open */
mca_btl_tcp_component_close /* component close */
mca_btl_tcp_component_close, /* component close */
NULL, /* component query */
mca_btl_tcp_component_register, /* component register */
},
{
/* The component is checkpoint ready */
@ -170,34 +180,9 @@ static void mca_btl_tcp_component_accept_handler(int, short, void*);
* component parameters.
*/
int mca_btl_tcp_component_open(void)
static int mca_btl_tcp_component_register(void)
{
char* message;
#ifdef __WINDOWS__
WSADATA win_sock_data;
if( WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0 ) {
BTL_ERROR(("failed to initialise windows sockets:%d", WSAGetLastError()));
return OMPI_ERROR;
}
#endif
/* initialize state */
mca_btl_tcp_component.tcp_listen_sd = -1;
#if OPAL_WANT_IPV6
mca_btl_tcp_component.tcp6_listen_sd = -1;
#endif
mca_btl_tcp_component.tcp_num_btls=0;
mca_btl_tcp_component.tcp_addr_count = 0;
mca_btl_tcp_component.tcp_btls=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_procs, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_frag_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_frag_max, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_frag_user, ompi_free_list_t);
opal_hash_table_init(&mca_btl_tcp_component.tcp_procs, 256);
/* register TCP component parameters */
mca_btl_tcp_component.tcp_num_links =
@ -206,6 +191,7 @@ int mca_btl_tcp_component_open(void)
mca_btl_tcp_param_register_string("if_include", "Comma-delimited list of devices or CIDR notation of networks to use for MPI communication (e.g., \"eth0,eth1\" or \"192.168.0.0/16,10.1.4.0/24\"). Mutually exclusive with btl_tcp_if_exclude.", "");
mca_btl_tcp_component.tcp_if_exclude =
mca_btl_tcp_param_register_string("if_exclude", "Comma-delimited list of devices or CIDR notation of networks to NOT use for MPI communication -- all devices not matching these specifications will be used (e.g., \"eth0,eth1\" or \"192.168.0.0/16,10.1.4.0/24\"). Mutually exclusive with btl_tcp_if_include.", "lo,sppp");
mca_btl_tcp_component.tcp_free_list_num =
mca_btl_tcp_param_register_int ("free_list_num", NULL, 8);
mca_btl_tcp_component.tcp_free_list_max =
@ -262,6 +248,7 @@ int mca_btl_tcp_component_open(void)
(0x1 << 16) - mca_btl_tcp_component.tcp6_port_min - 1);
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;
@ -276,6 +263,7 @@ int mca_btl_tcp_component_open(void)
MCA_BTL_FLAGS_HETEROGENEOUS_RDMA;
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);
@ -332,12 +320,57 @@ int mca_btl_tcp_component_open(void)
return OMPI_SUCCESS;
}
static int mca_btl_tcp_component_open(void)
{
#ifdef __WINDOWS__
WSADATA win_sock_data;
if( WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0 ) {
BTL_ERROR(("failed to initialise windows sockets:%d", WSAGetLastError()));
return OMPI_ERROR;
}
#endif
/* initialize state */
mca_btl_tcp_component.tcp_listen_sd = -1;
#if OPAL_WANT_IPV6
mca_btl_tcp_component.tcp6_listen_sd = -1;
#endif
mca_btl_tcp_component.tcp_num_btls=0;
mca_btl_tcp_component.tcp_addr_count = 0;
mca_btl_tcp_component.tcp_btls=NULL;
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_procs, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_frag_eager, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_frag_max, ompi_free_list_t);
OBJ_CONSTRUCT(&mca_btl_tcp_component.tcp_frag_user, ompi_free_list_t);
opal_hash_table_init(&mca_btl_tcp_component.tcp_procs, 256);
/* if_include and if_exclude need to be mutually exclusive */
if (OPAL_SUCCESS !=
mca_base_param_check_exclusive_string(
mca_btl_tcp_component.super.btl_version.mca_type_name,
mca_btl_tcp_component.super.btl_version.mca_component_name,
"if_include",
mca_btl_tcp_component.super.btl_version.mca_type_name,
mca_btl_tcp_component.super.btl_version.mca_component_name,
"if_exclude")) {
/* Return ERR_NOT_AVAILABLE so that a warning message about
"open" failing is not printed */
return OMPI_ERR_NOT_AVAILABLE;
}
return OMPI_SUCCESS;
}
/*
* module cleanup - sanity checking of queue lengths
*/
int mca_btl_tcp_component_close(void)
static int mca_btl_tcp_component_close(void)
{
opal_list_item_t* item;
opal_list_item_t* next;
@ -633,21 +666,6 @@ static int mca_btl_tcp_component_create_instances(void)
mca_btl_tcp_component.tcp_addr_count = if_count;
/* It's an error to specify both tcp_if_include and
tcp_if_exclude */
if ((NULL != mca_btl_tcp_component.tcp_if_include &&
strlen(mca_btl_tcp_component.tcp_if_include) > 0) &&
(NULL != mca_btl_tcp_component.tcp_if_exclude &&
strlen(mca_btl_tcp_component.tcp_if_exclude) > 0)) {
orte_show_help("help-mpi-btl-tcp.txt",
"both if_include and if_exclude specified",
true, orte_process_info.nodename,
mca_btl_tcp_component.tcp_if_include,
mca_btl_tcp_component.tcp_if_exclude);
ret = OMPI_ERR_BAD_PARAM;
goto cleanup;
}
/* if the user specified an interface list - use these exclusively */
argv = include = split_and_resolve(&mca_btl_tcp_component.tcp_if_include,
"include");

Просмотреть файл

@ -18,19 +18,6 @@ value will be ignored.
Value: %s
Message: %s
#
[both if_include and if_exclude specified]
WARNING: Values for both the btl_tcp_if_include and btl_tcp_if_exclude
MCA parameters were specified. These two parameters are mututally
exclusive; you can only specify one or the other.
The TCP BTL will exclude itself from this run; your MPI job *may* end
up aborting with messages about how MPI processes are not reachable
from each other.
Local host: %s
if_include value: %s
if_exclude value: %s
#
[invalid minimum port]
WARNING: An invalid value was given for the btl_tcp_port_min_%s. Legal
values are in the range [1 .. 2^16-1]. This value will be ignored

Просмотреть файл

@ -10,7 +10,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2006-2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2006-2009 Mellanox Technologies. All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
* reserved.
@ -75,6 +75,7 @@
/*
* Local functions
*/
static int btl_wv_component_register(void);
static int btl_wv_component_open(void);
static int btl_wv_component_close(void);
static mca_btl_base_module_t **btl_wv_component_init(int*, bool, bool);
@ -99,7 +100,9 @@ mca_btl_wv_component_t mca_btl_wv_component = {
OMPI_MINOR_VERSION, /* MCA component minor version */
OMPI_RELEASE_VERSION, /* MCA component release version */
btl_wv_component_open, /* component open */
btl_wv_component_close /* component close */
btl_wv_component_close, /* component close */
NULL, /* component query */
btl_wv_component_register, /* component register */
},
{
/* The component is checkpoint ready */
@ -123,13 +126,27 @@ static enum wv_mtu wv_convert_mtu(UINT32 mtu)
}
}
static int btl_wv_component_register(void)
{
int ret;
/* register IB component parameters */
ret = btl_wv_register_mca_params();
mca_btl_wv_component.max_send_size =
mca_btl_wv_module.super.btl_max_send_size;
mca_btl_wv_component.eager_limit =
mca_btl_wv_module.super.btl_eager_limit;
return OMPI_SUCCESS;
}
/*
* Called by MCA framework to open the component, registers
* component parameters.
*/
int btl_wv_component_open(void)
static int btl_wv_component_open(void)
{
int ret;
/* initialize state */
mca_btl_wv_component.ib_num_btls = 0;
mca_btl_wv_component.wv_btls = NULL;
@ -141,14 +158,6 @@ int btl_wv_component_open(void)
/* initialize objects */
OBJ_CONSTRUCT(&mca_btl_wv_component.ib_procs, opal_list_t);
/* register IB component parameters */
ret = btl_wv_register_mca_params();
mca_btl_wv_component.max_send_size =
mca_btl_wv_module.super.btl_max_send_size;
mca_btl_wv_component.eager_limit =
mca_btl_wv_module.super.btl_eager_limit;
srand48(getpid() * time(NULL));
return ret;
}

Просмотреть файл

@ -10,7 +10,7 @@
# University of Stuttgart. All rights reserved.
# Copyright (c) 2004-2005 The Regents of the University of California.
# All rights reserved.
# Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
# Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
@ -42,3 +42,13 @@ file. Deprecated MCA parameters should be avoided; they may disappear
in future releases.
Deprecated parameter: %s
#
[mutually exclusive params]
Two mutually-exclusive MCA parameters were specified. This can result
in undefined behavior, such as ignoring the components that the MCA
parameters are supposed to affect.
1st MCA parameter: %s
Source of value: %s
2nd MCA parameter: %s
Source of value: %s

Просмотреть файл

@ -2304,3 +2304,117 @@ int mca_base_param_find_string_name(const char *type,
return rc;
}
static char *source_name(mca_base_param_source_t source,
const char *filename)
{
char *ret;
switch (source) {
case MCA_BASE_PARAM_SOURCE_DEFAULT:
return strdup("default value");
break;
case MCA_BASE_PARAM_SOURCE_ENV:
return strdup("command line or environment variable");
break;
case MCA_BASE_PARAM_SOURCE_FILE:
asprintf(&ret, "file (%s)", filename);
return ret;
break;
case MCA_BASE_PARAM_SOURCE_OVERRIDE:
return strdup("internal override");
break;
default:
return strdup("unknown (!)");
break;
}
}
int mca_base_param_check_exclusive_string(const char *type_a,
const char *component_a,
const char *param_a,
const char *type_b,
const char *component_b,
const char *param_b)
{
int i, ret;
mca_base_param_source_t source_a, source_b;
char *filename_a, *filename_b;
i = mca_base_param_find(type_a, component_a, param_a);
if (i < 0) {
return OPAL_ERR_NOT_FOUND;
}
ret = mca_base_param_lookup_source(i, &source_a, &filename_a);
if (OPAL_SUCCESS != ret) {
return ret;
}
i = mca_base_param_find(type_b, component_b, param_b);
if (i < 0) {
return OPAL_ERR_NOT_FOUND;
}
ret = mca_base_param_lookup_source(i, &source_b, &filename_b);
if (OPAL_SUCCESS != ret) {
return ret;
}
if (MCA_BASE_PARAM_SOURCE_DEFAULT != source_a &&
MCA_BASE_PARAM_SOURCE_DEFAULT != source_b) {
size_t len;
char *str_a, *str_b, *name_a, *name_b;
/* Form cosmetic string names for A */
str_a = source_name(source_a, filename_a);
len = 5;
if (NULL != type_a) len += strlen(type_a);
if (NULL != component_a) len += strlen(component_a);
if (NULL != param_a) len += strlen(param_a);
name_a = calloc(1, len);
if (NULL == name_a) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
if (NULL != type_a) {
strncat(name_a, type_a, len);
strncat(name_a, "_", len);
}
if (NULL != component_a) strncat(name_a, component_a, len);
strncat(name_a, "_", len);
strncat(name_a, param_a, len);
/* Form cosmetic string names for B */
str_b = source_name(source_b, filename_b);
len = 5;
if (NULL != type_b) len += strlen(type_b);
if (NULL != component_b) len += strlen(component_b);
if (NULL != param_b) len += strlen(param_b);
name_b = calloc(1, len);
if (NULL == name_b) {
return OPAL_ERR_OUT_OF_RESOURCE;
}
if (NULL != type_b) {
strncat(name_b, type_b, len);
strncat(name_b, "_", len);
}
if (NULL != component_b) strncat(name_b, component_b, len);
strncat(name_b, "_", len);
strncat(name_b, param_b, len);
/* Print it all out */
opal_show_help("help-mca-param.txt",
"mutually exclusive params",
true, name_a, str_a, name_b, str_b);
/* Free the temp strings */
free(str_a);
free(name_a);
free(str_b);
free(name_b);
return OPAL_ERR_BAD_PARAM;
}
return OPAL_SUCCESS;
}

Просмотреть файл

@ -9,7 +9,7 @@
* University of Stuttgart. All rights reserved.
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2008-2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -715,6 +715,41 @@ OPAL_DECLSPEC int mca_base_param_find_string_name(const char *type,
char **env,
char **current_value);
/**
* Check that two MCA parameters were not both set to non-default
* values.
*
* @param type_a [in] Framework name of parameter A (string).
* @param component_a [in] Component name of parameter A (string).
* @param param_a [in] Parameter name of parameter A (string.
* @param type_b [in] Framework name of parameter A (string).
* @param component_b [in] Component name of parameter A (string).
* @param param_b [in] Parameter name of parameter A (string.
*
* This function is useful for checking that the user did not set both
* of 2 mutually-exclusive MCA parameters.
*
* This function will print an opal_show_help() message and return
* OPAL_ERR_BAD_PARAM if it finds that the two parameters both have
* value sources that are not MCA_BASE_PARAM_SOURCE_DEFAULT. This
* means that both parameters have been set by the user (i.e., they're
* not default values).
*
* Note that opal_show_help() allows itself to be hooked, so if this
* happens after the aggregated orte_show_help() system is
* initialized, the messages will be aggregated (w00t).
*
* @returns OPAL_ERR_BAD_PARAM if the two parameters have sources that
* are not MCA_BASE_PARAM_SOURCE_DEFAULT.
* @returns OPAL_SUCCESS otherwise.
*/
OPAL_DECLSPEC int mca_base_param_check_exclusive_string(const char *type_a,
const char *component_a,
const char *param_a,
const char *type_b,
const char *component_b,
const char *param_b);
/**
* Set the "internal" flag on an MCA parameter to true or false.
*

Просмотреть файл

@ -11,7 +11,7 @@
* All rights reserved.
* Copyright (c) 2006-2010 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2009-2011 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2011 Oak Ridge National Labs. All rights reserved.
* $COPYRIGHT$
*
@ -98,6 +98,9 @@ OBJ_CLASS_INSTANCE(
* Local utility functions
*/
static int mca_oob_tcp_component_register(void);
static int mca_oob_tcp_component_open(void);
static int mca_oob_tcp_component_close(void);
static int mca_oob_tcp_create_listen(int *target_sd, unsigned short *port, uint16_t af_family);
static int mca_oob_tcp_create_listen_thread(void);
static void mca_oob_tcp_recv_handler(int sd, short flags, void* user);
@ -126,7 +129,9 @@ mca_oob_tcp_component_t mca_oob_tcp_component = {
ORTE_MINOR_VERSION,
ORTE_RELEASE_VERSION,
mca_oob_tcp_component_open, /* component open */
mca_oob_tcp_component_close /* component close */
mca_oob_tcp_component_close, /* component close */
NULL, /* component query */
mca_oob_tcp_component_register, /* component register */
},
{
/* The component is checkpoint ready */
@ -153,49 +158,19 @@ mca_oob_t mca_oob_tcp = {
mca_oob_tcp_ft_event
};
/*
* Initialize global variables used w/in this module.
*/
int mca_oob_tcp_component_open(void)
static int mca_oob_tcp_component_register(void)
{
int tmp, value = 0;
char *listen_type, *str = NULL;
#ifdef __WINDOWS__
WSADATA win_sock_data;
if (WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0) {
opal_output (0, "mca_oob_tcp_component_init: failed to initialise windows sockets: error %d\n", WSAGetLastError());
return ORTE_ERROR;
}
#endif
mca_base_param_reg_int(&mca_oob_tcp_component.super.oob_base,
"verbose",
"Verbose level for the OOB tcp component",
false, false,
0,
&value);
mca_oob_tcp_output_handle = opal_output_open(NULL);
opal_output_set_verbosity(mca_oob_tcp_output_handle, value);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_list, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peers, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_names, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_free, opal_free_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msgs, opal_free_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msg_post, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msg_recv, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msg_completed, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_match_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_match_cond, opal_condition_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_available_devices, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_listen_thread, opal_thread_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_pending_connections, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_connections_return, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_connections_lock, opal_mutex_t);
/* register oob module parameters */
mca_base_param_reg_int(&mca_oob_tcp_component.super.oob_base,
"peer_limit",
@ -313,10 +288,6 @@ int mca_oob_tcp_component_open(void)
mca_oob_tcp_component.tcp_listen_thread_tv.tv_sec = tmp / (1000);
mca_oob_tcp_component.tcp_listen_thread_tv.tv_usec = (tmp % 1000) * 1000;
mca_oob_tcp_component.tcp_listen_thread_num_sockets = 0;
mca_oob_tcp_component.tcp_listen_thread_sds[0] = -1;
mca_oob_tcp_component.tcp_listen_thread_sds[1] = -1;
mca_base_param_reg_string(&mca_oob_tcp_component.super.oob_base,
"static_ports", "Static ports for daemons and procs (IPv4)",
false, false,
@ -407,11 +378,65 @@ int mca_oob_tcp_component_open(void)
mca_oob_tcp_component.tcp6_listen_sd = -1;
#endif /* OPAL_WANT_IPV6 */
return ORTE_SUCCESS;
}
/*
* Initialize global variables used w/in this module.
*/
static int mca_oob_tcp_component_open(void)
{
#ifdef __WINDOWS__
WSADATA win_sock_data;
if (WSAStartup(MAKEWORD(2,2), &win_sock_data) != 0) {
opal_output (0, "mca_oob_tcp_component_init: failed to initialise windows sockets: error %d\n", WSAGetLastError());
return ORTE_ERROR;
}
#endif
mca_oob_tcp_output_handle = opal_output_open(NULL);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_list, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peers, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_names, opal_hash_table_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_peer_free, opal_free_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msgs, opal_free_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_events, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msg_post, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msg_recv, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_msg_completed, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_match_lock, opal_mutex_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_match_cond, opal_condition_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_available_devices, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_listen_thread, opal_thread_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_pending_connections, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_connections_return, opal_list_t);
OBJ_CONSTRUCT(&mca_oob_tcp_component.tcp_connections_lock, opal_mutex_t);
mca_oob_tcp_component.tcp_listen_thread_num_sockets = 0;
mca_oob_tcp_component.tcp_listen_thread_sds[0] = -1;
mca_oob_tcp_component.tcp_listen_thread_sds[1] = -1;
/* initialize state */
mca_oob_tcp_component.tcp_shutdown = false;
mca_oob_tcp_component.tcp_listen_sd = -1;
mca_oob_tcp_component.tcp_match_count = 0;
/* if_include and if_exclude need to be mutually exclusive */
if (OPAL_SUCCESS !=
mca_base_param_check_exclusive_string(
mca_oob_tcp_component.super.oob_base.mca_type_name,
mca_oob_tcp_component.super.oob_base.mca_component_name,
"if_include",
mca_oob_tcp_component.super.oob_base.mca_type_name,
mca_oob_tcp_component.super.oob_base.mca_component_name,
"if_exclude")) {
/* Return ERR_NOT_AVAILABLE so that a warning message about
"open" failing is not printed */
return ORTE_ERR_NOT_AVAILABLE;
}
return ORTE_SUCCESS;
}
@ -419,7 +444,7 @@ int mca_oob_tcp_component_open(void)
* Cleanup of global variables used by this module.
*/
int mca_oob_tcp_component_close(void)
static int mca_oob_tcp_component_close(void)
{
opal_list_item_t *item;

Просмотреть файл

@ -11,7 +11,7 @@
* All rights reserved.
* Copyright (c) 2006-2007 Los Alamos National Security, LLC.
* All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2011 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -64,8 +64,6 @@ extern mca_oob_t mca_oob_tcp;
/*
* standard component functions
*/
int mca_oob_tcp_component_open(void);
int mca_oob_tcp_component_close(void);
mca_oob_t* mca_oob_tcp_component_init(int* priority);
/**