static void opmdx_response(int status, const char *data, size_t sz, void *cbdata, opal_pmix_release_cbfunc_t relcbfunc, void *relcbdata) { pmix_status_t rc; ext4x_opalcaddy_t *opalcaddy = (ext4x_opalcaddy_t*)cbdata; opal_ext4x_dmx_trkr_t *dmdx; rc = ext4x_convert_rc(status); if (NULL != opalcaddy->mdxcbfunc) { opalcaddy->odmdxfunc = relcbfunc; opalcaddy->ocbdata = relcbdata; opalcaddy->mdxcbfunc(rc, data, sz, opalcaddy->cbdata, _data_release, opalcaddy); } else { OBJ_RELEASE(opalcaddy); } if (opal_pmix_collect_all_data) { /* if we were collecting all data, then check for any pending * dmodx requests that we cached and notify them that the * data has arrived */ OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock); while (NULL != (dmdx = (opal_ext4x_dmx_trkr_t*)opal_list_remove_first(&mca_pmix_ext4x_component.dmdx))) { OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); dmdx->cbfunc(PMIX_SUCCESS, NULL, 0, dmdx->cbdata, NULL, NULL); OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock); OBJ_RELEASE(dmdx); } OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); } }
static pmix_status_t server_dmodex_req_fn(const pmix_proc_t *p, const pmix_info_t info[], size_t ninfo, pmix_modex_cbfunc_t cbfunc, void *cbdata) { int rc; pmix2x_opalcaddy_t *opalcaddy; opal_process_name_t proc; opal_value_t *iptr; size_t n; opal_pmix2x_dmx_trkr_t *dmdx; if (NULL == host_module || NULL == host_module->direct_modex) { return PMIX_ERR_NOT_SUPPORTED; } /* convert the nspace/rank to an opal_process_name_t */ if (OPAL_SUCCESS != (rc = opal_convert_string_to_jobid(&proc.jobid, p->nspace))) { return pmix2x_convert_opalrc(rc); } proc.vpid = pmix2x_convert_rank(p->rank); opal_output_verbose(3, opal_pmix_base_framework.framework_output, "%s CLIENT %s CALLED DMODX", OPAL_NAME_PRINT(OPAL_PROC_MY_NAME), OPAL_NAME_PRINT(proc)); /* setup the caddy */ opalcaddy = OBJ_NEW(pmix2x_opalcaddy_t); opalcaddy->mdxcbfunc = cbfunc; opalcaddy->cbdata = cbdata; /* this function should only get called if we are in an async modex. * If we are also collecting data, then the fence_nb will eventually * complete and return all the required data down to the pmix * server beneath us. Thus, we only need to track the dmodex_req * and ensure that the release gets called once the data has * arrived - this will trigger the pmix server to tell the * client that the data is available */ if (opal_pmix_base_async_modex && opal_pmix_collect_all_data) { OPAL_PMIX_ACQUIRE_THREAD(&opal_pmix_base.lock); dmdx = OBJ_NEW(opal_pmix2x_dmx_trkr_t); dmdx->cbfunc = cbfunc; dmdx->cbdata = cbdata; opal_list_append(&mca_pmix_pmix2x_component.dmdx, &dmdx->super); OPAL_PMIX_RELEASE_THREAD(&opal_pmix_base.lock); return PMIX_SUCCESS; } /* convert the array of pmix_info_t to the list of info */ for (n=0; n < ninfo; n++) { iptr = OBJ_NEW(opal_value_t); opal_list_append(&opalcaddy->info, &iptr->super); iptr->key = strdup(info[n].key); if (OPAL_SUCCESS != (rc = pmix2x_value_unload(iptr, &info[n].value))) { OBJ_RELEASE(opalcaddy); return pmix2x_convert_opalrc(rc); } } /* pass it up */ rc = host_module->direct_modex(&proc, &opalcaddy->info, opmdx_response, opalcaddy); if (OPAL_SUCCESS != rc && OPAL_ERR_IN_PROCESS != rc) { OBJ_RELEASE(opalcaddy); } if (OPAL_ERR_IN_PROCESS == rc) { rc = OPAL_SUCCESS; } return pmix2x_convert_opalrc(rc); }