1
1

opal/pmix: fix indentation in some files.

Этот коммит содержится в:
Artem Polyakov 2016-08-15 18:21:50 +07:00
родитель 2228d2efc2
Коммит f3c816b52e
3 изменённых файлов: 1124 добавлений и 1124 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -40,20 +40,20 @@ static size_t errhdler_ref = 0;
#define PMIX_WAIT_FOR_COMPLETION(a) \ #define PMIX_WAIT_FOR_COMPLETION(a) \
do { \ do { \
while ((a)) { \ while ((a)) { \
usleep(10); \ usleep(10); \
} \ } \
} while (0) } while (0)
static void errreg_cbfunc (pmix_status_t status, static void errreg_cbfunc (pmix_status_t status,
size_t errhandler_ref, size_t errhandler_ref,
void *cbdata) void *cbdata)
{ {
errhdler_ref = errhandler_ref; errhdler_ref = errhandler_ref;
opal_output_verbose(5, opal_pmix_base_framework.framework_output, opal_output_verbose(5, opal_pmix_base_framework.framework_output,
"PMIX client errreg_cbfunc - error handler registered status=%d, reference=%lu", "PMIX client errreg_cbfunc - error handler registered status=%d, reference=%lu",
status, (unsigned long)errhandler_ref); status, (unsigned long)errhandler_ref);
} }
int ext20_client_init(void) int ext20_client_init(void)
@ -64,28 +64,28 @@ int ext20_client_init(void)
opal_ext20_jobid_trkr_t *job; opal_ext20_jobid_trkr_t *job;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client init"); "PMIx_client init");
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) { if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg); asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
putenv(dbgvalue); putenv(dbgvalue);
} }
rc = PMIx_Init(&my_proc, NULL, 0); rc = PMIx_Init(&my_proc, NULL, 0);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
return ext20_convert_rc(rc); return ext20_convert_rc(rc);
} }
/* store our jobid and rank */ /* store our jobid and rank */
if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) { if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) {
/* if we were launched by the OMPI RTE, then /* if we were launched by the OMPI RTE, then
* the jobid is in a special format - so get it */ * the jobid is in a special format - so get it */
mca_pmix_ext20_component.native_launch = true; mca_pmix_ext20_component.native_launch = true;
opal_convert_string_to_jobid(&pname.jobid, my_proc.nspace); opal_convert_string_to_jobid(&pname.jobid, my_proc.nspace);
} else { } else {
/* we were launched by someone else, so make the /* we were launched by someone else, so make the
* jobid just be the hash of the nspace */ * jobid just be the hash of the nspace */
OPAL_HASH_STR(my_proc.nspace, pname.jobid); OPAL_HASH_STR(my_proc.nspace, pname.jobid);
} }
/* insert this into our list of jobids - it will be the /* insert this into our list of jobids - it will be the
* first, and so we'll check it first */ * first, and so we'll check it first */
@ -108,7 +108,7 @@ int ext20_client_finalize(void)
pmix_status_t rc; pmix_status_t rc;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client finalize"); "PMIx_client finalize");
/* deregister the default event handler */ /* deregister the default event handler */
PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL); PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL);
@ -120,13 +120,13 @@ int ext20_client_finalize(void)
int ext20_initialized(void) int ext20_initialized(void)
{ {
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client initialized"); "PMIx_client initialized");
return PMIx_Initialized(); return PMIx_Initialized();
} }
int ext20_abort(int flag, const char *msg, int ext20_abort(int flag, const char *msg,
opal_list_t *procs) opal_list_t *procs)
{ {
pmix_status_t rc; pmix_status_t rc;
pmix_proc_t *parray=NULL; pmix_proc_t *parray=NULL;
@ -135,31 +135,31 @@ int ext20_abort(int flag, const char *msg,
opal_ext20_jobid_trkr_t *job, *jptr; opal_ext20_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client abort"); "PMIx_client abort");
/* convert the list of procs to an array /* convert the list of procs to an array
* of pmix_proc_t */ * of pmix_proc_t */
if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) { if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) {
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = ext20_convert_opalrank(ptr->name.vpid); parray[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
} }
/* call the library abort */ /* call the library abort */
@ -182,25 +182,25 @@ int ext20_store_local(const opal_process_name_t *proc, opal_value_t *val)
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
if (NULL != proc) { if (NULL != proc) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) { if (jptr->jobid == proc->jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN);
p.rank = ext20_convert_opalrank(proc->vpid); p.rank = ext20_convert_opalrank(proc->vpid);
} else { } else {
/* use our name */ /* use our name */
(void)strncpy(p.nspace, my_proc.nspace, PMIX_MAX_NSLEN); (void)strncpy(p.nspace, my_proc.nspace, PMIX_MAX_NSLEN);
p.rank = ext20_convert_opalrank(OPAL_PROC_MY_NAME.vpid); p.rank = ext20_convert_opalrank(OPAL_PROC_MY_NAME.vpid);
} }
PMIX_VALUE_CONSTRUCT(&kv); PMIX_VALUE_CONSTRUCT(&kv);
@ -225,7 +225,7 @@ static void opcbfunc(pmix_status_t status, void *cbdata)
ext20_opcaddy_t *op = (ext20_opcaddy_t*)cbdata; ext20_opcaddy_t *op = (ext20_opcaddy_t*)cbdata;
if (NULL != op->opcbfunc) { if (NULL != op->opcbfunc) {
op->opcbfunc(ext20_convert_rc(status), op->cbdata); op->opcbfunc(ext20_convert_rc(status), op->cbdata);
} }
OBJ_RELEASE(op); OBJ_RELEASE(op);
} }
@ -240,41 +240,41 @@ int ext20_fence(opal_list_t *procs, int collect_data)
opal_ext20_jobid_trkr_t *job, *jptr; opal_ext20_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client fence"); "PMIx_client fence");
/* convert the list of procs to an array /* convert the list of procs to an array
* of pmix_proc_t */ * of pmix_proc_t */
if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) { if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) {
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = ext20_convert_opalrank(ptr->name.vpid); parray[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
} }
if (collect_data) { if (collect_data) {
PMIX_INFO_CONSTRUCT(&info); PMIX_INFO_CONSTRUCT(&info);
(void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN); (void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN);
info.value.type = PMIX_BOOL; info.value.type = PMIX_BOOL;
info.value.data.flag = true; info.value.data.flag = true;
iptr = &info; iptr = &info;
n = 1; n = 1;
} else { } else {
iptr = NULL; iptr = NULL;
n = 0; n = 0;
} }
/* call the library function */ /* call the library function */
@ -283,7 +283,7 @@ int ext20_fence(opal_list_t *procs, int collect_data)
/* release the array */ /* release the array */
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
if (NULL != iptr) { if (NULL != iptr) {
PMIX_INFO_DESTRUCT(&info); PMIX_INFO_DESTRUCT(&info);
} }
return ext20_convert_rc(rc); return ext20_convert_rc(rc);
@ -291,7 +291,7 @@ int ext20_fence(opal_list_t *procs, int collect_data)
} }
int ext20_fencenb(opal_list_t *procs, int collect_data, int ext20_fencenb(opal_list_t *procs, int collect_data,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata) opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t rc; pmix_status_t rc;
pmix_proc_t *parray=NULL; pmix_proc_t *parray=NULL;
@ -305,43 +305,43 @@ int ext20_fencenb(opal_list_t *procs, int collect_data,
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client fence_nb"); "PMIx_client fence_nb");
/* convert the list of procs to an array /* convert the list of procs to an array
* of pmix_proc_t */ * of pmix_proc_t */
if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) { if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) {
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = ext20_convert_opalrank(ptr->name.vpid); parray[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
} }
if (collect_data) { if (collect_data) {
PMIX_INFO_CONSTRUCT(&info); PMIX_INFO_CONSTRUCT(&info);
(void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN); (void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN);
info.value.type = PMIX_BOOL; info.value.type = PMIX_BOOL;
info.value.data.flag = true; info.value.data.flag = true;
iptr = &info; iptr = &info;
n = 1; n = 1;
} else { } else {
iptr = NULL; iptr = NULL;
n = 0; n = 0;
} }
/* create the caddy */ /* create the caddy */
@ -354,7 +354,7 @@ int ext20_fencenb(opal_list_t *procs, int collect_data,
/* call the library function */ /* call the library function */
rc = PMIx_Fence_nb(parray, cnt, iptr, n, opcbfunc, op); rc = PMIx_Fence_nb(parray, cnt, iptr, n, opcbfunc, op);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op); OBJ_RELEASE(op);
} }
return ext20_convert_rc(rc); return ext20_convert_rc(rc);
@ -362,14 +362,14 @@ int ext20_fencenb(opal_list_t *procs, int collect_data,
} }
int ext20_put(opal_pmix_scope_t opal_scope, int ext20_put(opal_pmix_scope_t opal_scope,
opal_value_t *val) opal_value_t *val)
{ {
pmix_value_t kv; pmix_value_t kv;
pmix_scope_t pmix_scope = ext20_convert_opalscope(opal_scope); pmix_scope_t pmix_scope = ext20_convert_opalscope(opal_scope);
pmix_status_t rc; pmix_status_t rc;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client put"); "PMIx_client put");
PMIX_VALUE_CONSTRUCT(&kv); PMIX_VALUE_CONSTRUCT(&kv);
ext20_value_load(&kv, val); ext20_value_load(&kv, val);
@ -380,7 +380,7 @@ int ext20_put(opal_pmix_scope_t opal_scope,
} }
int ext20_get(const opal_process_name_t *proc, const char *key, int ext20_get(const opal_process_name_t *proc, const char *key,
opal_list_t *info, opal_value_t **val) opal_list_t *info, opal_value_t **val)
{ {
int ret; int ret;
pmix_value_t *kv; pmix_value_t *kv;
@ -485,8 +485,8 @@ static void val_cbfunc(pmix_status_t status,
} }
int ext20_getnb(const opal_process_name_t *proc, const char *key, int ext20_getnb(const opal_process_name_t *proc, const char *key,
opal_list_t *info, opal_list_t *info,
opal_pmix_value_cbfunc_t cbfunc, void *cbdata) opal_pmix_value_cbfunc_t cbfunc, void *cbdata)
{ {
ext20_opcaddy_t *op; ext20_opcaddy_t *op;
pmix_status_t rc; pmix_status_t rc;
@ -582,7 +582,7 @@ int ext20_publish(opal_list_t *info)
} }
int ext20_publishnb(opal_list_t *info, int ext20_publishnb(opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata) opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
opal_value_t *iptr; opal_value_t *iptr;
@ -683,7 +683,7 @@ int ext20_lookup(opal_list_t *data, opal_list_t *info)
} }
} }
if (NULL == job) { if (NULL == job) {
job = OBJ_NEW(opal_ext20_jobid_trkr_t); job = OBJ_NEW(opal_ext20_jobid_trkr_t);
(void)strncpy(job->nspace, pdata[n].proc.nspace, PMIX_MAX_NSLEN); (void)strncpy(job->nspace, pdata[n].proc.nspace, PMIX_MAX_NSLEN);
job->jobid = d->proc.jobid; job->jobid = d->proc.jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super); opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
@ -713,11 +713,11 @@ static void lk_cbfunc(pmix_status_t status,
size_t n; size_t n;
opal_ext20_jobid_trkr_t *job, *jptr; opal_ext20_jobid_trkr_t *job, *jptr;
/* this is in the PMIx local thread - need to threadshift to /* this is in the PMIx local thread - need to threadshift to
* our own thread as we will be accessing framework-global * our own thread as we will be accessing framework-global
* lists and objects */ * lists and objects */
if (NULL == op->lkcbfunc) { if (NULL == op->lkcbfunc) {
OBJ_RELEASE(op); OBJ_RELEASE(op);
return; return;
} }
@ -762,7 +762,7 @@ static void lk_cbfunc(pmix_status_t status,
} }
r = &results; r = &results;
} }
release: release:
/* execute the callback */ /* execute the callback */
op->lkcbfunc(rc, r, op->cbdata); op->lkcbfunc(rc, r, op->cbdata);
@ -773,7 +773,7 @@ static void lk_cbfunc(pmix_status_t status,
} }
int ext20_lookupnb(char **keys, opal_list_t *info, int ext20_lookupnb(char **keys, opal_list_t *info,
opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata) opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
ext20_opcaddy_t *op; ext20_opcaddy_t *op;
@ -835,7 +835,7 @@ int ext20_unpublish(char **keys, opal_list_t *info)
} }
int ext20_unpublishnb(char **keys, opal_list_t *info, int ext20_unpublishnb(char **keys, opal_list_t *info,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata) opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
ext20_opcaddy_t *op; ext20_opcaddy_t *op;
@ -930,7 +930,7 @@ int ext20_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
} }
static void spcbfunc(pmix_status_t status, static void spcbfunc(pmix_status_t status,
char *nspace, void *cbdata) char *nspace, void *cbdata)
{ {
ext20_opcaddy_t *op = (ext20_opcaddy_t*)cbdata; ext20_opcaddy_t *op = (ext20_opcaddy_t*)cbdata;
int rc; int rc;
@ -943,20 +943,20 @@ static void spcbfunc(pmix_status_t status,
rc = ext20_convert_rc(status); rc = ext20_convert_rc(status);
if (PMIX_SUCCESS == status) { if (PMIX_SUCCESS == status) {
if (mca_pmix_ext20_component.native_launch) { if (mca_pmix_ext20_component.native_launch) {
/* if we were launched by the OMPI RTE, then /* if we were launched by the OMPI RTE, then
* the jobid is in a special format - so get it */ * the jobid is in a special format - so get it */
opal_convert_string_to_jobid(&jobid, nspace); opal_convert_string_to_jobid(&jobid, nspace);
} else { } else {
/* we were launched by someone else, so make the /* we were launched by someone else, so make the
* jobid just be the hash of the nspace */ * jobid just be the hash of the nspace */
OPAL_HASH_STR(nspace, jobid); OPAL_HASH_STR(nspace, jobid);
} }
/* add this to our jobid tracker */ /* add this to our jobid tracker */
job = OBJ_NEW(opal_ext20_jobid_trkr_t); job = OBJ_NEW(opal_ext20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN); (void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid; job->jobid = jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super); opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
} }
op->spcbfunc(rc, jobid, op->cbdata); op->spcbfunc(rc, jobid, op->cbdata);
@ -964,7 +964,7 @@ static void spcbfunc(pmix_status_t status,
} }
int ext20_spawnnb(opal_list_t *job_info, opal_list_t *apps, int ext20_spawnnb(opal_list_t *job_info, opal_list_t *apps,
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata) opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
ext20_opcaddy_t *op; ext20_opcaddy_t *op;
@ -978,34 +978,34 @@ int ext20_spawnnb(opal_list_t *job_info, opal_list_t *apps,
op->cbdata = cbdata; op->cbdata = cbdata;
if (NULL != job_info && 0 < (op->ninfo = opal_list_get_size(job_info))) { if (NULL != job_info && 0 < (op->ninfo = opal_list_get_size(job_info))) {
PMIX_INFO_CREATE(op->info, op->ninfo); PMIX_INFO_CREATE(op->info, op->ninfo);
n=0; n=0;
OPAL_LIST_FOREACH(info, job_info, opal_value_t) { OPAL_LIST_FOREACH(info, job_info, opal_value_t) {
(void)strncpy(op->info[n].key, info->key, PMIX_MAX_KEYLEN); (void)strncpy(op->info[n].key, info->key, PMIX_MAX_KEYLEN);
ext20_value_load(&op->info[n].value, info); ext20_value_load(&op->info[n].value, info);
++n; ++n;
} }
} }
op->sz = opal_list_get_size(apps); op->sz = opal_list_get_size(apps);
PMIX_APP_CREATE(op->apps, op->sz); PMIX_APP_CREATE(op->apps, op->sz);
n=0; n=0;
OPAL_LIST_FOREACH(app, apps, opal_pmix_app_t) { OPAL_LIST_FOREACH(app, apps, opal_pmix_app_t) {
op->apps[n].cmd = strdup(app->cmd); op->apps[n].cmd = strdup(app->cmd);
op->apps[n].argc = app->argc; op->apps[n].argc = app->argc;
op->apps[n].argv = opal_argv_copy(app->argv); op->apps[n].argv = opal_argv_copy(app->argv);
op->apps[n].env = opal_argv_copy(app->env); op->apps[n].env = opal_argv_copy(app->env);
op->apps[n].maxprocs = app->maxprocs; op->apps[n].maxprocs = app->maxprocs;
if (0 < (op->apps[n].ninfo = opal_list_get_size(&app->info))) { if (0 < (op->apps[n].ninfo = opal_list_get_size(&app->info))) {
PMIX_INFO_CREATE(op->apps[n].info, op->apps[n].ninfo); PMIX_INFO_CREATE(op->apps[n].info, op->apps[n].ninfo);
m=0; m=0;
OPAL_LIST_FOREACH(info, &app->info, opal_value_t) { OPAL_LIST_FOREACH(info, &app->info, opal_value_t) {
(void)strncpy(op->apps[n].info[m].key, info->key, PMIX_MAX_KEYLEN); (void)strncpy(op->apps[n].info[m].key, info->key, PMIX_MAX_KEYLEN);
ext20_value_load(&op->apps[n].info[m].value, info); ext20_value_load(&op->apps[n].info[m].value, info);
++m; ++m;
} }
} }
++n; ++n;
} }
ret = PMIx_Spawn_nb(op->info, op->ninfo, op->apps, op->sz, spcbfunc, op); ret = PMIx_Spawn_nb(op->info, op->ninfo, op->apps, op->sz, spcbfunc, op);
@ -1023,7 +1023,7 @@ int ext20_connect(opal_list_t *procs)
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* convert the list of procs to an array /* convert the list of procs to an array
@ -1031,23 +1031,23 @@ int ext20_connect(opal_list_t *procs)
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = ext20_convert_opalrank(ptr->name.vpid); parray[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Connect(parray, cnt, NULL, 0); ret = PMIx_Connect(parray, cnt, NULL, 0);
@ -1057,8 +1057,8 @@ int ext20_connect(opal_list_t *procs)
} }
int ext20_connectnb(opal_list_t *procs, int ext20_connectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc, opal_pmix_op_cbfunc_t cbfunc,
void *cbdata) void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
size_t n, cnt=0; size_t n, cnt=0;
@ -1071,7 +1071,7 @@ int ext20_connectnb(opal_list_t *procs,
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* create the caddy */ /* create the caddy */
@ -1085,16 +1085,16 @@ int ext20_connectnb(opal_list_t *procs,
PMIX_PROC_CREATE(op->procs, op->nprocs); PMIX_PROC_CREATE(op->procs, op->nprocs);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) { if (job->jobid == ptr->name.jobid) {
(void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break; break;
} }
} }
op->procs[n].rank = ext20_convert_opalrank(ptr->name.vpid); op->procs[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Connect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op); ret = PMIx_Connect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op);
@ -1112,7 +1112,7 @@ int ext20_disconnect(opal_list_t *procs)
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* convert the list of procs to an array /* convert the list of procs to an array
@ -1120,16 +1120,16 @@ int ext20_disconnect(opal_list_t *procs)
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) { if (job->jobid == ptr->name.jobid) {
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break; break;
} }
} }
parray[n].rank = ext20_convert_opalrank(ptr->name.vpid); parray[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Disconnect(parray, cnt, NULL, 0); ret = PMIx_Disconnect(parray, cnt, NULL, 0);
@ -1139,8 +1139,8 @@ int ext20_disconnect(opal_list_t *procs)
} }
int ext20_disconnectnb(opal_list_t *procs, int ext20_disconnectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc, opal_pmix_op_cbfunc_t cbfunc,
void *cbdata) void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
size_t n, cnt=0; size_t n, cnt=0;
@ -1153,7 +1153,7 @@ int ext20_disconnectnb(opal_list_t *procs,
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* create the caddy */ /* create the caddy */
@ -1167,16 +1167,16 @@ int ext20_disconnectnb(opal_list_t *procs,
PMIX_PROC_CREATE(op->procs, op->nprocs); PMIX_PROC_CREATE(op->procs, op->nprocs);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(job, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) { if (job->jobid == ptr->name.jobid) {
(void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break; break;
} }
} }
op->procs[n].rank = ext20_convert_opalrank(ptr->name.vpid); op->procs[n].rank = ext20_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Disconnect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op); ret = PMIx_Disconnect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op);
@ -1186,7 +1186,7 @@ int ext20_disconnectnb(opal_list_t *procs,
int ext20_resolve_peers(const char *nodename, opal_jobid_t jobid, int ext20_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_list_t *procs) opal_list_t *procs)
{ {
char *nspace; char *nspace;
pmix_proc_t *array=NULL; pmix_proc_t *array=NULL;
@ -1200,53 +1200,53 @@ int ext20_resolve_peers(const char *nodename, opal_jobid_t jobid,
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
if (OPAL_JOBID_WILDCARD == jobid) { if (OPAL_JOBID_WILDCARD == jobid) {
nspace = NULL; nspace = NULL;
} else { } else {
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == jobid) { if (jptr->jobid == jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
nspace = job->nspace; nspace = job->nspace;
} }
ret = PMIx_Resolve_peers(nodename, nspace, &array, &nprocs); ret = PMIx_Resolve_peers(nodename, nspace, &array, &nprocs);
rc = ext20_convert_rc(ret); rc = ext20_convert_rc(ret);
if (NULL != array && 0 < nprocs) { if (NULL != array && 0 < nprocs) {
for (n=0; n < nprocs; n++) { for (n=0; n < nprocs; n++) {
nm = OBJ_NEW(opal_namelist_t); nm = OBJ_NEW(opal_namelist_t);
opal_list_append(procs, &nm->super); opal_list_append(procs, &nm->super);
if (mca_pmix_ext20_component.native_launch) { if (mca_pmix_ext20_component.native_launch) {
/* if we were launched by the OMPI RTE, then /* if we were launched by the OMPI RTE, then
* the jobid is in a special format - so get it */ * the jobid is in a special format - so get it */
opal_convert_string_to_jobid(&nm->name.jobid, array[n].nspace); opal_convert_string_to_jobid(&nm->name.jobid, array[n].nspace);
} else { } else {
/* we were launched by someone else, so make the /* we were launched by someone else, so make the
* jobid just be the hash of the nspace */ * jobid just be the hash of the nspace */
OPAL_HASH_STR(array[n].nspace, nm->name.jobid); OPAL_HASH_STR(array[n].nspace, nm->name.jobid);
} }
/* if we don't already have it, add this to our jobid tracker */ /* if we don't already have it, add this to our jobid tracker */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == nm->name.jobid) { if (jptr->jobid == nm->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
job = OBJ_NEW(opal_ext20_jobid_trkr_t); job = OBJ_NEW(opal_ext20_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN); (void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid; job->jobid = jobid;
opal_list_append(&mca_pmix_ext20_component.jobids, &job->super); opal_list_append(&mca_pmix_ext20_component.jobids, &job->super);
} }
nm->name.vpid = ext20_convert_rank(array[n].rank); nm->name.vpid = ext20_convert_rank(array[n].rank);
} }
} }
PMIX_PROC_FREE(array, nprocs); PMIX_PROC_FREE(array, nprocs);
@ -1263,19 +1263,19 @@ int ext20_resolve_nodes(opal_jobid_t jobid, char **nodelist)
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
if (OPAL_JOBID_WILDCARD != jobid) { if (OPAL_JOBID_WILDCARD != jobid) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_ext20_component.jobids, opal_ext20_jobid_trkr_t) {
if (jptr->jobid == jobid) { if (jptr->jobid == jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
nspace = job->nspace; nspace = job->nspace;
} }
ret = PMIx_Resolve_nodes(nspace, nodelist); ret = PMIx_Resolve_nodes(nspace, nodelist);

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

@ -40,20 +40,20 @@ static size_t errhdler_ref = 0;
#define PMIX_WAIT_FOR_COMPLETION(a) \ #define PMIX_WAIT_FOR_COMPLETION(a) \
do { \ do { \
while ((a)) { \ while ((a)) { \
usleep(10); \ usleep(10); \
} \ } \
} while (0) } while (0)
static void errreg_cbfunc (pmix_status_t status, static void errreg_cbfunc (pmix_status_t status,
size_t errhandler_ref, size_t errhandler_ref,
void *cbdata) void *cbdata)
{ {
errhdler_ref = errhandler_ref; errhdler_ref = errhandler_ref;
opal_output_verbose(5, opal_pmix_base_framework.framework_output, opal_output_verbose(5, opal_pmix_base_framework.framework_output,
"PMIX client errreg_cbfunc - error handler registered status=%d, reference=%lu", "PMIX client errreg_cbfunc - error handler registered status=%d, reference=%lu",
status, (unsigned long)errhandler_ref); status, (unsigned long)errhandler_ref);
} }
int pmix2x_client_init(void) int pmix2x_client_init(void)
@ -64,28 +64,28 @@ int pmix2x_client_init(void)
opal_pmix2x_jobid_trkr_t *job; opal_pmix2x_jobid_trkr_t *job;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client init"); "PMIx_client init");
if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) { if (0 < (dbg = opal_output_get_verbosity(opal_pmix_base_framework.framework_output))) {
asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg); asprintf(&dbgvalue, "PMIX_DEBUG=%d", dbg);
putenv(dbgvalue); putenv(dbgvalue);
} }
rc = PMIx_Init(&my_proc, NULL, 0); rc = PMIx_Init(&my_proc, NULL, 0);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
return pmix2x_convert_rc(rc); return pmix2x_convert_rc(rc);
} }
/* store our jobid and rank */ /* store our jobid and rank */
if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) { if (NULL != getenv(OPAL_MCA_PREFIX"orte_launch")) {
/* if we were launched by the OMPI RTE, then /* if we were launched by the OMPI RTE, then
* the jobid is in a special format - so get it */ * the jobid is in a special format - so get it */
mca_pmix_pmix2x_component.native_launch = true; mca_pmix_pmix2x_component.native_launch = true;
opal_convert_string_to_jobid(&pname.jobid, my_proc.nspace); opal_convert_string_to_jobid(&pname.jobid, my_proc.nspace);
} else { } else {
/* we were launched by someone else, so make the /* we were launched by someone else, so make the
* jobid just be the hash of the nspace */ * jobid just be the hash of the nspace */
OPAL_HASH_STR(my_proc.nspace, pname.jobid); OPAL_HASH_STR(my_proc.nspace, pname.jobid);
} }
/* insert this into our list of jobids - it will be the /* insert this into our list of jobids - it will be the
* first, and so we'll check it first */ * first, and so we'll check it first */
@ -108,7 +108,7 @@ int pmix2x_client_finalize(void)
pmix_status_t rc; pmix_status_t rc;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client finalize"); "PMIx_client finalize");
/* deregister the default event handler */ /* deregister the default event handler */
PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL); PMIx_Deregister_event_handler(errhdler_ref, NULL, NULL);
@ -120,13 +120,13 @@ int pmix2x_client_finalize(void)
int pmix2x_initialized(void) int pmix2x_initialized(void)
{ {
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client initialized"); "PMIx_client initialized");
return PMIx_Initialized(); return PMIx_Initialized();
} }
int pmix2x_abort(int flag, const char *msg, int pmix2x_abort(int flag, const char *msg,
opal_list_t *procs) opal_list_t *procs)
{ {
pmix_status_t rc; pmix_status_t rc;
pmix_proc_t *parray=NULL; pmix_proc_t *parray=NULL;
@ -135,31 +135,31 @@ int pmix2x_abort(int flag, const char *msg,
opal_pmix2x_jobid_trkr_t *job, *jptr; opal_pmix2x_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client abort"); "PMIx_client abort");
/* convert the list of procs to an array /* convert the list of procs to an array
* of pmix_proc_t */ * of pmix_proc_t */
if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) { if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) {
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
} }
/* call the library abort */ /* call the library abort */
@ -182,25 +182,25 @@ int pmix2x_store_local(const opal_process_name_t *proc, opal_value_t *val)
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
if (NULL != proc) { if (NULL != proc) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == proc->jobid) { if (jptr->jobid == proc->jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(p.nspace, job->nspace, PMIX_MAX_NSLEN);
p.rank = pmix2x_convert_opalrank(proc->vpid); p.rank = pmix2x_convert_opalrank(proc->vpid);
} else { } else {
/* use our name */ /* use our name */
(void)strncpy(p.nspace, my_proc.nspace, PMIX_MAX_NSLEN); (void)strncpy(p.nspace, my_proc.nspace, PMIX_MAX_NSLEN);
p.rank = pmix2x_convert_opalrank(OPAL_PROC_MY_NAME.vpid); p.rank = pmix2x_convert_opalrank(OPAL_PROC_MY_NAME.vpid);
} }
PMIX_VALUE_CONSTRUCT(&kv); PMIX_VALUE_CONSTRUCT(&kv);
@ -225,7 +225,7 @@ static void opcbfunc(pmix_status_t status, void *cbdata)
pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata; pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata;
if (NULL != op->opcbfunc) { if (NULL != op->opcbfunc) {
op->opcbfunc(pmix2x_convert_rc(status), op->cbdata); op->opcbfunc(pmix2x_convert_rc(status), op->cbdata);
} }
OBJ_RELEASE(op); OBJ_RELEASE(op);
} }
@ -240,41 +240,41 @@ int pmix2x_fence(opal_list_t *procs, int collect_data)
opal_pmix2x_jobid_trkr_t *job, *jptr; opal_pmix2x_jobid_trkr_t *job, *jptr;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client fence"); "PMIx_client fence");
/* convert the list of procs to an array /* convert the list of procs to an array
* of pmix_proc_t */ * of pmix_proc_t */
if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) { if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) {
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
} }
if (collect_data) { if (collect_data) {
PMIX_INFO_CONSTRUCT(&info); PMIX_INFO_CONSTRUCT(&info);
(void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN); (void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN);
info.value.type = PMIX_BOOL; info.value.type = PMIX_BOOL;
info.value.data.flag = true; info.value.data.flag = true;
iptr = &info; iptr = &info;
n = 1; n = 1;
} else { } else {
iptr = NULL; iptr = NULL;
n = 0; n = 0;
} }
/* call the library function */ /* call the library function */
@ -283,7 +283,7 @@ int pmix2x_fence(opal_list_t *procs, int collect_data)
/* release the array */ /* release the array */
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
if (NULL != iptr) { if (NULL != iptr) {
PMIX_INFO_DESTRUCT(&info); PMIX_INFO_DESTRUCT(&info);
} }
return pmix2x_convert_rc(rc); return pmix2x_convert_rc(rc);
@ -291,7 +291,7 @@ int pmix2x_fence(opal_list_t *procs, int collect_data)
} }
int pmix2x_fencenb(opal_list_t *procs, int collect_data, int pmix2x_fencenb(opal_list_t *procs, int collect_data,
opal_pmix_op_cbfunc_t cbfunc, void *cbdata) opal_pmix_op_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t rc; pmix_status_t rc;
pmix_proc_t *parray=NULL; pmix_proc_t *parray=NULL;
@ -305,43 +305,43 @@ int pmix2x_fencenb(opal_list_t *procs, int collect_data,
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client fence_nb"); "PMIx_client fence_nb");
/* convert the list of procs to an array /* convert the list of procs to an array
* of pmix_proc_t */ * of pmix_proc_t */
if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) { if (NULL != procs && 0 < (cnt = opal_list_get_size(procs))) {
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
} }
if (collect_data) { if (collect_data) {
PMIX_INFO_CONSTRUCT(&info); PMIX_INFO_CONSTRUCT(&info);
(void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN); (void)strncpy(info.key, PMIX_COLLECT_DATA, PMIX_MAX_KEYLEN);
info.value.type = PMIX_BOOL; info.value.type = PMIX_BOOL;
info.value.data.flag = true; info.value.data.flag = true;
iptr = &info; iptr = &info;
n = 1; n = 1;
} else { } else {
iptr = NULL; iptr = NULL;
n = 0; n = 0;
} }
/* create the caddy */ /* create the caddy */
@ -354,7 +354,7 @@ int pmix2x_fencenb(opal_list_t *procs, int collect_data,
/* call the library function */ /* call the library function */
rc = PMIx_Fence_nb(parray, cnt, iptr, n, opcbfunc, op); rc = PMIx_Fence_nb(parray, cnt, iptr, n, opcbfunc, op);
if (PMIX_SUCCESS != rc) { if (PMIX_SUCCESS != rc) {
OBJ_RELEASE(op); OBJ_RELEASE(op);
} }
return pmix2x_convert_rc(rc); return pmix2x_convert_rc(rc);
@ -362,14 +362,14 @@ int pmix2x_fencenb(opal_list_t *procs, int collect_data,
} }
int pmix2x_put(opal_pmix_scope_t opal_scope, int pmix2x_put(opal_pmix_scope_t opal_scope,
opal_value_t *val) opal_value_t *val)
{ {
pmix_value_t kv; pmix_value_t kv;
pmix_scope_t pmix_scope = pmix2x_convert_opalscope(opal_scope); pmix_scope_t pmix_scope = pmix2x_convert_opalscope(opal_scope);
pmix_status_t rc; pmix_status_t rc;
opal_output_verbose(1, opal_pmix_base_framework.framework_output, opal_output_verbose(1, opal_pmix_base_framework.framework_output,
"PMIx_client put"); "PMIx_client put");
PMIX_VALUE_CONSTRUCT(&kv); PMIX_VALUE_CONSTRUCT(&kv);
pmix2x_value_load(&kv, val); pmix2x_value_load(&kv, val);
@ -683,7 +683,7 @@ int pmix2x_lookup(opal_list_t *data, opal_list_t *info)
} }
} }
if (NULL == job) { if (NULL == job) {
job = OBJ_NEW(opal_pmix2x_jobid_trkr_t); job = OBJ_NEW(opal_pmix2x_jobid_trkr_t);
(void)strncpy(job->nspace, pdata[n].proc.nspace, PMIX_MAX_NSLEN); (void)strncpy(job->nspace, pdata[n].proc.nspace, PMIX_MAX_NSLEN);
job->jobid = d->proc.jobid; job->jobid = d->proc.jobid;
opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super); opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super);
@ -713,11 +713,11 @@ static void lk_cbfunc(pmix_status_t status,
size_t n; size_t n;
opal_pmix2x_jobid_trkr_t *job, *jptr; opal_pmix2x_jobid_trkr_t *job, *jptr;
/* this is in the PMIx local thread - need to threadshift to /* this is in the PMIx local thread - need to threadshift to
* our own thread as we will be accessing framework-global * our own thread as we will be accessing framework-global
* lists and objects */ * lists and objects */
if (NULL == op->lkcbfunc) { if (NULL == op->lkcbfunc) {
OBJ_RELEASE(op); OBJ_RELEASE(op);
return; return;
} }
@ -762,7 +762,7 @@ static void lk_cbfunc(pmix_status_t status,
} }
r = &results; r = &results;
} }
release: release:
/* execute the callback */ /* execute the callback */
op->lkcbfunc(rc, r, op->cbdata); op->lkcbfunc(rc, r, op->cbdata);
@ -930,7 +930,7 @@ int pmix2x_spawn(opal_list_t *job_info, opal_list_t *apps, opal_jobid_t *jobid)
} }
static void spcbfunc(pmix_status_t status, static void spcbfunc(pmix_status_t status,
char *nspace, void *cbdata) char *nspace, void *cbdata)
{ {
pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata; pmix2x_opcaddy_t *op = (pmix2x_opcaddy_t*)cbdata;
int rc; int rc;
@ -943,20 +943,20 @@ static void spcbfunc(pmix_status_t status,
rc = pmix2x_convert_rc(status); rc = pmix2x_convert_rc(status);
if (PMIX_SUCCESS == status) { if (PMIX_SUCCESS == status) {
if (mca_pmix_pmix2x_component.native_launch) { if (mca_pmix_pmix2x_component.native_launch) {
/* if we were launched by the OMPI RTE, then /* if we were launched by the OMPI RTE, then
* the jobid is in a special format - so get it */ * the jobid is in a special format - so get it */
opal_convert_string_to_jobid(&jobid, nspace); opal_convert_string_to_jobid(&jobid, nspace);
} else { } else {
/* we were launched by someone else, so make the /* we were launched by someone else, so make the
* jobid just be the hash of the nspace */ * jobid just be the hash of the nspace */
OPAL_HASH_STR(nspace, jobid); OPAL_HASH_STR(nspace, jobid);
} }
/* add this to our jobid tracker */ /* add this to our jobid tracker */
job = OBJ_NEW(opal_pmix2x_jobid_trkr_t); job = OBJ_NEW(opal_pmix2x_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN); (void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid; job->jobid = jobid;
opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super); opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super);
} }
op->spcbfunc(rc, jobid, op->cbdata); op->spcbfunc(rc, jobid, op->cbdata);
@ -964,7 +964,7 @@ static void spcbfunc(pmix_status_t status,
} }
int pmix2x_spawnnb(opal_list_t *job_info, opal_list_t *apps, int pmix2x_spawnnb(opal_list_t *job_info, opal_list_t *apps,
opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata) opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
pmix2x_opcaddy_t *op; pmix2x_opcaddy_t *op;
@ -978,34 +978,34 @@ int pmix2x_spawnnb(opal_list_t *job_info, opal_list_t *apps,
op->cbdata = cbdata; op->cbdata = cbdata;
if (NULL != job_info && 0 < (op->ninfo = opal_list_get_size(job_info))) { if (NULL != job_info && 0 < (op->ninfo = opal_list_get_size(job_info))) {
PMIX_INFO_CREATE(op->info, op->ninfo); PMIX_INFO_CREATE(op->info, op->ninfo);
n=0; n=0;
OPAL_LIST_FOREACH(info, job_info, opal_value_t) { OPAL_LIST_FOREACH(info, job_info, opal_value_t) {
(void)strncpy(op->info[n].key, info->key, PMIX_MAX_KEYLEN); (void)strncpy(op->info[n].key, info->key, PMIX_MAX_KEYLEN);
pmix2x_value_load(&op->info[n].value, info); pmix2x_value_load(&op->info[n].value, info);
++n; ++n;
} }
} }
op->sz = opal_list_get_size(apps); op->sz = opal_list_get_size(apps);
PMIX_APP_CREATE(op->apps, op->sz); PMIX_APP_CREATE(op->apps, op->sz);
n=0; n=0;
OPAL_LIST_FOREACH(app, apps, opal_pmix_app_t) { OPAL_LIST_FOREACH(app, apps, opal_pmix_app_t) {
op->apps[n].cmd = strdup(app->cmd); op->apps[n].cmd = strdup(app->cmd);
op->apps[n].argc = app->argc; op->apps[n].argc = app->argc;
op->apps[n].argv = opal_argv_copy(app->argv); op->apps[n].argv = opal_argv_copy(app->argv);
op->apps[n].env = opal_argv_copy(app->env); op->apps[n].env = opal_argv_copy(app->env);
op->apps[n].maxprocs = app->maxprocs; op->apps[n].maxprocs = app->maxprocs;
if (0 < (op->apps[n].ninfo = opal_list_get_size(&app->info))) { if (0 < (op->apps[n].ninfo = opal_list_get_size(&app->info))) {
PMIX_INFO_CREATE(op->apps[n].info, op->apps[n].ninfo); PMIX_INFO_CREATE(op->apps[n].info, op->apps[n].ninfo);
m=0; m=0;
OPAL_LIST_FOREACH(info, &app->info, opal_value_t) { OPAL_LIST_FOREACH(info, &app->info, opal_value_t) {
(void)strncpy(op->apps[n].info[m].key, info->key, PMIX_MAX_KEYLEN); (void)strncpy(op->apps[n].info[m].key, info->key, PMIX_MAX_KEYLEN);
pmix2x_value_load(&op->apps[n].info[m].value, info); pmix2x_value_load(&op->apps[n].info[m].value, info);
++m; ++m;
} }
} }
++n; ++n;
} }
ret = PMIx_Spawn_nb(op->info, op->ninfo, op->apps, op->sz, spcbfunc, op); ret = PMIx_Spawn_nb(op->info, op->ninfo, op->apps, op->sz, spcbfunc, op);
@ -1023,7 +1023,7 @@ int pmix2x_connect(opal_list_t *procs)
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* convert the list of procs to an array /* convert the list of procs to an array
@ -1031,23 +1031,23 @@ int pmix2x_connect(opal_list_t *procs)
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == ptr->name.jobid) { if (jptr->jobid == ptr->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND); OPAL_ERROR_LOG(OPAL_ERR_NOT_FOUND);
PMIX_PROC_FREE(parray, cnt); PMIX_PROC_FREE(parray, cnt);
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Connect(parray, cnt, NULL, 0); ret = PMIx_Connect(parray, cnt, NULL, 0);
@ -1057,8 +1057,8 @@ int pmix2x_connect(opal_list_t *procs)
} }
int pmix2x_connectnb(opal_list_t *procs, int pmix2x_connectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc, opal_pmix_op_cbfunc_t cbfunc,
void *cbdata) void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
size_t n, cnt=0; size_t n, cnt=0;
@ -1071,7 +1071,7 @@ int pmix2x_connectnb(opal_list_t *procs,
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* create the caddy */ /* create the caddy */
@ -1085,16 +1085,16 @@ int pmix2x_connectnb(opal_list_t *procs,
PMIX_PROC_CREATE(op->procs, op->nprocs); PMIX_PROC_CREATE(op->procs, op->nprocs);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(job, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) { if (job->jobid == ptr->name.jobid) {
(void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break; break;
} }
} }
op->procs[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); op->procs[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Connect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op); ret = PMIx_Connect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op);
@ -1112,7 +1112,7 @@ int pmix2x_disconnect(opal_list_t *procs)
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* convert the list of procs to an array /* convert the list of procs to an array
@ -1120,16 +1120,16 @@ int pmix2x_disconnect(opal_list_t *procs)
PMIX_PROC_CREATE(parray, cnt); PMIX_PROC_CREATE(parray, cnt);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(job, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) { if (job->jobid == ptr->name.jobid) {
(void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(parray[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break; break;
} }
} }
parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); parray[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Disconnect(parray, cnt, NULL, 0); ret = PMIx_Disconnect(parray, cnt, NULL, 0);
@ -1139,8 +1139,8 @@ int pmix2x_disconnect(opal_list_t *procs)
} }
int pmix2x_disconnectnb(opal_list_t *procs, int pmix2x_disconnectnb(opal_list_t *procs,
opal_pmix_op_cbfunc_t cbfunc, opal_pmix_op_cbfunc_t cbfunc,
void *cbdata) void *cbdata)
{ {
pmix_status_t ret; pmix_status_t ret;
size_t n, cnt=0; size_t n, cnt=0;
@ -1153,7 +1153,7 @@ int pmix2x_disconnectnb(opal_list_t *procs,
/* protect against bozo error */ /* protect against bozo error */
if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) { if (NULL == procs || 0 == (cnt = opal_list_get_size(procs))) {
return OPAL_ERR_BAD_PARAM; return OPAL_ERR_BAD_PARAM;
} }
/* create the caddy */ /* create the caddy */
@ -1167,16 +1167,16 @@ int pmix2x_disconnectnb(opal_list_t *procs,
PMIX_PROC_CREATE(op->procs, op->nprocs); PMIX_PROC_CREATE(op->procs, op->nprocs);
n=0; n=0;
OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) { OPAL_LIST_FOREACH(ptr, procs, opal_namelist_t) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
OPAL_LIST_FOREACH(job, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(job, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (job->jobid == ptr->name.jobid) { if (job->jobid == ptr->name.jobid) {
(void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN); (void)strncpy(op->procs[n].nspace, job->nspace, PMIX_MAX_NSLEN);
break; break;
} }
} }
op->procs[n].rank = pmix2x_convert_opalrank(ptr->name.vpid); op->procs[n].rank = pmix2x_convert_opalrank(ptr->name.vpid);
++n; ++n;
} }
ret = PMIx_Disconnect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op); ret = PMIx_Disconnect_nb(op->procs, op->nprocs, NULL, 0, opcbfunc, op);
@ -1186,7 +1186,7 @@ int pmix2x_disconnectnb(opal_list_t *procs,
int pmix2x_resolve_peers(const char *nodename, opal_jobid_t jobid, int pmix2x_resolve_peers(const char *nodename, opal_jobid_t jobid,
opal_list_t *procs) opal_list_t *procs)
{ {
char *nspace; char *nspace;
pmix_proc_t *array=NULL; pmix_proc_t *array=NULL;
@ -1200,53 +1200,53 @@ int pmix2x_resolve_peers(const char *nodename, opal_jobid_t jobid,
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
if (OPAL_JOBID_WILDCARD == jobid) { if (OPAL_JOBID_WILDCARD == jobid) {
nspace = NULL; nspace = NULL;
} else { } else {
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == jobid) { if (jptr->jobid == jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
nspace = job->nspace; nspace = job->nspace;
} }
ret = PMIx_Resolve_peers(nodename, nspace, &array, &nprocs); ret = PMIx_Resolve_peers(nodename, nspace, &array, &nprocs);
rc = pmix2x_convert_rc(ret); rc = pmix2x_convert_rc(ret);
if (NULL != array && 0 < nprocs) { if (NULL != array && 0 < nprocs) {
for (n=0; n < nprocs; n++) { for (n=0; n < nprocs; n++) {
nm = OBJ_NEW(opal_namelist_t); nm = OBJ_NEW(opal_namelist_t);
opal_list_append(procs, &nm->super); opal_list_append(procs, &nm->super);
if (mca_pmix_pmix2x_component.native_launch) { if (mca_pmix_pmix2x_component.native_launch) {
/* if we were launched by the OMPI RTE, then /* if we were launched by the OMPI RTE, then
* the jobid is in a special format - so get it */ * the jobid is in a special format - so get it */
opal_convert_string_to_jobid(&nm->name.jobid, array[n].nspace); opal_convert_string_to_jobid(&nm->name.jobid, array[n].nspace);
} else { } else {
/* we were launched by someone else, so make the /* we were launched by someone else, so make the
* jobid just be the hash of the nspace */ * jobid just be the hash of the nspace */
OPAL_HASH_STR(array[n].nspace, nm->name.jobid); OPAL_HASH_STR(array[n].nspace, nm->name.jobid);
} }
/* if we don't already have it, add this to our jobid tracker */ /* if we don't already have it, add this to our jobid tracker */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == nm->name.jobid) { if (jptr->jobid == nm->name.jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
job = OBJ_NEW(opal_pmix2x_jobid_trkr_t); job = OBJ_NEW(opal_pmix2x_jobid_trkr_t);
(void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN); (void)strncpy(job->nspace, nspace, PMIX_MAX_NSLEN);
job->jobid = jobid; job->jobid = jobid;
opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super); opal_list_append(&mca_pmix_pmix2x_component.jobids, &job->super);
} }
nm->name.vpid = pmix2x_convert_rank(array[n].rank); nm->name.vpid = pmix2x_convert_rank(array[n].rank);
} }
} }
PMIX_PROC_FREE(array, nprocs); PMIX_PROC_FREE(array, nprocs);
@ -1263,19 +1263,19 @@ int pmix2x_resolve_nodes(opal_jobid_t jobid, char **nodelist)
* and we are going to access framework-global lists/objects */ * and we are going to access framework-global lists/objects */
if (OPAL_JOBID_WILDCARD != jobid) { if (OPAL_JOBID_WILDCARD != jobid) {
/* look thru our list of jobids and find the /* look thru our list of jobids and find the
* corresponding nspace */ * corresponding nspace */
job = NULL; job = NULL;
OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) { OPAL_LIST_FOREACH(jptr, &mca_pmix_pmix2x_component.jobids, opal_pmix2x_jobid_trkr_t) {
if (jptr->jobid == jobid) { if (jptr->jobid == jobid) {
job = jptr; job = jptr;
break; break;
} }
} }
if (NULL == job) { if (NULL == job) {
return OPAL_ERR_NOT_FOUND; return OPAL_ERR_NOT_FOUND;
} }
nspace = job->nspace; nspace = job->nspace;
} }
ret = PMIx_Resolve_nodes(nspace, nodelist); ret = PMIx_Resolve_nodes(nspace, nodelist);