1
1

Merge pull request #6196 from hjelmn/pmix_prte

rte/pmix: fill in opal_process_info when using prrte/pmix
Этот коммит содержится в:
Ralph Castain 2018-12-17 12:18:08 -08:00 коммит произвёл GitHub
родитель 804a517929 06baa518f7
Коммит c79eb1da78
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 27 добавлений и 9 удалений

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
@ -7,6 +8,8 @@
* and Technology (RIST). All rights reserved.
* Copyright (c) 2015 Intel, Inc. All rights reserved.
* Copyright (c) 2016-2017 IBM Corporation. All rights reserved.
* Copyright (c) 2018 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -115,6 +118,7 @@ typedef struct {
int32_t num_local_peers;
uint32_t num_procs;
uint32_t app_num;
char *cpuset;
} pmix_process_info_t;
OMPI_DECLSPEC extern pmix_process_info_t pmix_process_info;
#define ompi_process_info pmix_process_info

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

@ -1,3 +1,4 @@
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
/*
* Copyright (c) 2012-2013 Los Alamos National Security, LLC.
* All rights reserved.
@ -7,6 +8,8 @@
* reserved.
* Copyright (c) 2014-2018 Cisco Systems, Inc. All rights reserved
* Copyright (c) 2018 Amazon.com, Inc. or its affiliates. All Rights reserved.
* Copyright (c) 2018 Triad National Security, LLC. All rights
* reserved.
* $COPYRIGHT$
*/
#include "ompi_config.h"
@ -500,7 +503,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
opal_proc_t *myproc;
int u32, *u32ptr;
uint16_t u16, *u16ptr;
char **peers=NULL, *mycpuset;
char **peers=NULL;
char *envar, *ev1, *ev2;
opal_value_t *kv;
char *val;
@ -684,9 +687,9 @@ int ompi_rte_init(int *pargc, char ***pargv)
OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, OPAL_PMIX_LOCALITY_STRING,
&pmix_process_info.my_name, &val, OPAL_STRING);
if (OPAL_SUCCESS == ret && NULL != val) {
mycpuset = val;
pmix_process_info.cpuset = val;
} else {
mycpuset = NULL;
pmix_process_info.cpuset = NULL;
}
pname.jobid = pmix_process_info.my_name.jobid;
for (i=0; NULL != peers[i]; i++) {
@ -699,7 +702,7 @@ int ompi_rte_init(int *pargc, char ***pargv)
OPAL_MODEX_RECV_VALUE_OPTIONAL(ret, OPAL_PMIX_LOCALITY_STRING,
&pname, &val, OPAL_STRING);
if (OPAL_SUCCESS == ret && NULL != val) {
u16 = opal_hwloc_compute_relative_locality(mycpuset, val);
u16 = opal_hwloc_compute_relative_locality(pmix_process_info.cpuset, val);
free(val);
} else {
/* all we can say is that it shares our node */
@ -718,17 +721,14 @@ int ompi_rte_init(int *pargc, char ***pargv)
if (OPAL_SUCCESS != ret) {
error = "local store of locality";
opal_argv_free(peers);
if (NULL != mycpuset) {
free(mycpuset);
if (NULL != pmix_process_info.cpuset) {
free(pmix_process_info.cpuset);
}
goto error;
}
OBJ_RELEASE(kv);
}
opal_argv_free(peers);
if (NULL != mycpuset) {
free(mycpuset);
}
}
/* poor attempt to detect we are bound */
@ -736,6 +736,16 @@ int ompi_rte_init(int *pargc, char ***pargv)
pmix_proc_is_bound = true;
}
/* set the remaining opal_process_info fields. Note that
* the OPAL layer will have initialized these to NULL, and
* anyone between us would not have strdup'd the string, so
* we cannot free it here */
opal_process_info.job_session_dir = pmix_process_info.job_session_dir;
opal_process_info.proc_session_dir = pmix_process_info.proc_session_dir;
opal_process_info.num_local_peers = (int32_t)pmix_process_info.num_local_peers;
opal_process_info.my_local_rank = (int32_t)pmix_process_info.my_local_rank;
opal_process_info.cpuset = pmix_process_info.cpuset;
/* push our hostname so others can find us, if they need to - the
* native PMIx component will ignore this request as the hostname
* is provided by the system */
@ -807,6 +817,10 @@ int ompi_rte_finalize(void)
false, check_file);
free(pmix_process_info.job_session_dir);
}
free (pmix_process_info.cpuset);
pmix_process_info.cpuset = NULL;
return OMPI_SUCCESS;
}