1
1

Further reduce the RARP load by removing getaddrinfo for IPv6 connections. Correct typo when checking return on inet_pton. Don't consider the TCP component for apps that are launched via mpirun as it will never be used.

Этот коммит содержится в:
Ralph Castain 2015-03-16 19:42:05 -07:00
родитель 5ae42c816e
Коммит a0487e014c
4 изменённых файлов: 36 добавлений и 36 удалений

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

@ -232,28 +232,31 @@ static int rte_init(void)
/*** PUSH DATA FOR OTHERS TO FIND ***/
/* if our URI was not provided by the system, then
* push our URI so others can find us */
OBJ_CONSTRUCT(&vals, opal_list_t);
if (OPAL_SUCCESS != opal_dstore.fetch(opal_dstore_internal, &OPAL_PROC_MY_NAME,
OPAL_DSTORE_URI, &vals)) {
/* construct the RTE string */
rmluri = orte_rml.get_contact_info();
/* push it out for others to use */
OBJ_CONSTRUCT(&kvn, opal_value_t);
kvn.key = strdup(OPAL_DSTORE_URI);
kvn.type = OPAL_STRING;
kvn.data.string = strdup(rmluri);
if (ORTE_SUCCESS != (ret = opal_pmix.put(PMIX_GLOBAL, &kvn))) {
error = "db store uri";
/* if we are direct launched, then push our RML URI - there
* is no need to do so when launched by mpirun as all apps
* communicate thru their local daemon */
if (orte_standalone_operation) {
OBJ_CONSTRUCT(&vals, opal_list_t);
if (OPAL_SUCCESS != opal_dstore.fetch(opal_dstore_internal, &OPAL_PROC_MY_NAME,
OPAL_DSTORE_URI, &vals)) {
/* construct the RTE string */
rmluri = orte_rml.get_contact_info();
/* push it out for others to use */
OBJ_CONSTRUCT(&kvn, opal_value_t);
kvn.key = strdup(OPAL_DSTORE_URI);
kvn.type = OPAL_STRING;
kvn.data.string = strdup(rmluri);
if (ORTE_SUCCESS != (ret = opal_pmix.put(PMIX_GLOBAL, &kvn))) {
error = "db store uri";
OBJ_DESTRUCT(&kvn);
goto error;
}
OBJ_DESTRUCT(&kvn);
goto error;
free(rmluri);
}
OBJ_DESTRUCT(&kvn);
free(rmluri);
OPAL_LIST_DESTRUCT(&vals);
}
OPAL_LIST_DESTRUCT(&vals);
/* push our hostname so others can find us, if they need to */
OBJ_CONSTRUCT(&kvn, opal_value_t);
kvn.key = strdup(OPAL_DSTORE_HOSTNAME);

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

@ -216,16 +216,14 @@ static void accept_connection(const int accepted_fd,
ORTE_ACTIVATE_TCP_ACCEPT_STATE(accepted_fd, addr, recv_handler);
}
/* the host in this case is always in "dot" notation, and
* thus we do not need to do a DNS lookup to convert it */
static int parse_uri(const uint16_t af_family,
const char* host,
const char *port,
struct sockaddr* inaddr)
{
struct sockaddr_in *in;
#if OPAL_ENABLE_IPV6
struct addrinfo hints, *res;
int ret;
#endif
if (AF_INET == af_family) {
memset(inaddr, 0, sizeof(struct sockaddr_in));
@ -239,21 +237,14 @@ static int parse_uri(const uint16_t af_family,
}
#if OPAL_ENABLE_IPV6
else if (AF_INET6 == af_family) {
size_t len;
struct sockaddr_in6 *in6;
memset(inaddr, 0, sizeof(struct sockaddr_in6));
memset(&hints, 0, sizeof(hints));
hints.ai_family = af_family;
hints.ai_socktype = SOCK_STREAM;
ret = getaddrinfo(host, NULL, &hints, &res);
in6 = (struct sockaddr_in6*) inaddr;
if (ret) {
opal_output (0, "oob_tcp_parse_uri: Could not resolve %s. [Error: %s]\n",
host, gai_strerror (ret));
if (0 == inet_pton(AF_INET6, host, (void*)&in6->sin6_addr)) {
opal_output (0, "oob_tcp_parse_uri: Could not convert %s\n", host);
return ORTE_ERR_BAD_PARAM;
}
len = (res->ai_addrlen < sizeof(struct sockaddr_in6)) ? res->ai_addrlen : sizeof(struct sockaddr_in6);
memcpy(inaddr, res->ai_addr, len);
freeaddrinfo(res);
}
#endif
else {

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

@ -451,6 +451,12 @@ static bool component_available(void)
opal_output_verbose(5, orte_oob_base_framework.framework_output,
"oob:tcp: component_available called");
/* if we are an APP and we are not direct launched,
* then we don't want to be considered */
if (ORTE_PROC_IS_APP && !orte_standalone_operation) {
return false;
}
/* if interface include was given, construct a list
* of those interfaces which match the specifications - remember,
* the includes could be given as named interfaces, IP addrs, or

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

@ -173,8 +173,8 @@ int orte_proc_info(void)
gethostname(hostname, ORTE_MAX_HOSTNAME_SIZE);
if (!orte_keep_fqdn_hostnames) {
/* if the nodename is an IP address, do not mess with it! */
if (0 != inet_pton(AF_INET, hostname, &buf) &&
0 != inet_pton(AF_INET6, hostname, &buf)) {
if (0 == inet_pton(AF_INET, hostname, &buf) &&
0 == inet_pton(AF_INET6, hostname, &buf)) {
/* not an IP address, so remove any domain info */
if (NULL != (ptr = strchr(hostname, '.'))) {
*ptr = '\0';