static int modex(opal_list_t *procs) { int rc; OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base.output, "%s grpcomm:hier: modex entered", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* if we were given a list of procs to modex with, then this is happening * as part of a connect/accept operation */ if (NULL != procs) { if (ORTE_SUCCESS != (rc = orte_grpcomm_base_full_modex(procs))) { ORTE_ERROR_LOG(rc); } } else { /* otherwise, we are doing this across our peers */ if (ORTE_SUCCESS != (rc = orte_grpcomm_base_peer_modex())) { ORTE_ERROR_LOG(rc); } } OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base.output, "%s grpcomm:hier: modex completed", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); return rc; }
static int modex(opal_list_t *procs) { int rc; OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base_output, "%s grpcomm:bad: modex entered", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); if (NULL == procs) { /* The modex will be realized in the background by the daemons. The processes will * only be informed when all data has been collected from all processes. The get_attr * will realize the blocking, it will not return until the data has been rteceived. */ opal_buffer_t *buf, *rbuf; orte_grpcomm_coll_t coll_type = ORTE_GRPCOMM_ALLGATHER; bool modex_reqd = true; OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base_output, "%s grpcomm:bad:peer:modex: performing modex", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* setup the buffer that will actually be sent */ buf = OBJ_NEW(opal_buffer_t); rbuf = OBJ_NEW(opal_buffer_t); /* tell the daemon we are doing an allgather */ if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, &coll_type, 1, ORTE_GRPCOMM_COLL_T))) { ORTE_ERROR_LOG(rc); return rc; } /* put our process name in the buffer so it can be unpacked later */ if (ORTE_SUCCESS != (rc = opal_dss.pack(buf, ORTE_PROC_MY_NAME, 1, ORTE_NAME))) { ORTE_ERROR_LOG(rc); goto cleanup; } /* pack the entries we have received */ if (ORTE_SUCCESS != (rc = orte_grpcomm_base_pack_modex_entries(buf, &modex_reqd))) { ORTE_ERROR_LOG(rc); goto cleanup; } OPAL_OUTPUT_VERBOSE((2, orte_grpcomm_base_output, "%s grpcomm:bad:peer:modex: executing non-blocking allgather", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* send to local daemon */ if (0 > (rc = orte_rml.send_buffer(ORTE_PROC_MY_DAEMON, buf, ORTE_RML_TAG_DAEMON_COLLECTIVE, 0))) { ORTE_ERROR_LOG(rc); return rc; } OPAL_OUTPUT_VERBOSE((2, orte_grpcomm_base_output, "%s grpcomm:bad allgather buffer sent", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); /* now receive the final result. Be sure to do this in * a manner that allows us to return without being in a recv! */ allgather_complete = false; rc = orte_rml.recv_buffer_nb(ORTE_NAME_WILDCARD, ORTE_RML_TAG_ALLGATHER, ORTE_RML_NON_PERSISTENT, allgather_recv_modex, (void*)rbuf); if (rc != ORTE_SUCCESS) { ORTE_ERROR_LOG(rc); return rc; } rbuf = NULL; /* make sure we don't release it yet */ OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base_output, "%s grpcomm:bad: modex posted", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); cleanup: if( NULL != buf ) { OBJ_RELEASE(buf); } if( NULL != rbuf ) { OBJ_RELEASE(rbuf); } return rc; } else { if (ORTE_SUCCESS != (rc = orte_grpcomm_base_full_modex(procs, true))) { ORTE_ERROR_LOG(rc); } } OPAL_OUTPUT_VERBOSE((1, orte_grpcomm_base_output, "%s grpcomm:bad: modex completed", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME))); return rc; }