Example #1
0
int PMIx_Disconnect(const pmix_proc_t procs[], size_t nprocs)
{
    int rc;
    pmix_cb_t *cb;
     
    if (pmix_client_globals.init_cntr <= 0) {
        return PMIX_ERR_INIT;
    }

    /* if we aren't connected, don't attempt to send */
    if (!pmix_globals.connected) {
        return PMIX_ERR_UNREACH;
    }

    /* create a callback object as we need to pass it to the
     * recv routine so we know which callback to use when
     * the return message is recvd */
    cb = PMIX_NEW(pmix_cb_t);
    cb->active = true;

    if (PMIX_SUCCESS != (rc = PMIx_Disconnect_nb(procs, nprocs, op_cbfunc, cb))) {
        PMIX_RELEASE(cb);
        return rc;
    }

    /* wait for the connect to complete */
    PMIX_WAIT_FOR_COMPLETION(cb->active);
    rc = cb->status;
    PMIX_RELEASE(cb);

    pmix_output_verbose(2, pmix_globals.debug_output,
                        "pmix: disconnect completed");

    return rc;
}
Example #2
0
int test_cd_common(pmix_proc_t *procs, size_t nprocs, int blocking, int disconnect)
{
    int rc;
    if (blocking) {
        if (!disconnect) {
            rc = PMIx_Connect(procs, nprocs, NULL, 0);
        } else {
            rc = PMIx_Disconnect(procs, nprocs, NULL, 0);
        }
    } else {
        cd_cbdata cbdata;
        cbdata.in_progress = 1;
        if (!disconnect) {
            rc = PMIx_Connect_nb(procs, nprocs, NULL, 0, cd_cb, (void*)&cbdata);
        } else {
            rc = PMIx_Disconnect_nb(procs, nprocs, NULL, 0, cd_cb, (void*)&cbdata);
        }
        if (PMIX_SUCCESS == rc) {
            PMIX_WAIT_FOR_COMPLETION(cbdata.in_progress);
            rc = cbdata.status;
        }
    }
    /* the host server callback currently returns PMIX_EXISTS status for checking purposes */
    if (PMIX_EXISTS == rc) {
        rc = PMIX_SUCCESS;
    }
    return rc;
}
Example #3
0
int test_connect_disconnect(char *my_nspace, int my_rank)
{
    int rc;
    pmix_proc_t proc;
    char nspace[PMIX_MAX_NSLEN+1];
    pmix_rank_t newrank;
    cd_cbdata cbdata;

    (void)strncpy(proc.nspace, my_nspace, PMIX_MAX_NSLEN);
    proc.rank = PMIX_RANK_WILDCARD;

    rc = PMIx_Connect(&proc, 1, NULL, 0, nspace, &newrank);
    if (PMIX_SUCCESS != rc) {
        TEST_ERROR(("%s:%d: Connect blocking test failed.", my_nspace, my_rank));
        return PMIX_ERROR;
    }
    TEST_VERBOSE(("%s:%d: Connect blocking test succeded to nspace %s.", my_nspace, my_rank, nspace));

    rc = PMIx_Disconnect(nspace, NULL, 0);
    if (PMIX_SUCCESS != rc) {
        TEST_ERROR(("%s:%d: Disconnect blocking test failed.", my_nspace, my_rank));
        return PMIX_ERROR;
    }
    TEST_VERBOSE(("%s:%d: Disconnect blocking test succeded.", my_nspace, my_rank));

    cbdata.in_progress = 1;
    rc = PMIx_Connect_nb(&proc, 1, NULL, 0, cnct_cb, &cbdata);
    if (PMIX_SUCCESS == rc) {
        PMIX_WAIT_FOR_COMPLETION(cbdata.in_progress);
        rc = cbdata.status;
    }
    if (PMIX_SUCCESS != rc) {
        TEST_ERROR(("%s:%d: Connect non-blocking test failed.", my_nspace, my_rank));
        return PMIX_ERROR;
    }
    TEST_VERBOSE(("%s:%d: Connect non-blocking test succeded.", my_nspace, my_rank));

    cbdata.in_progress = 1;
    rc = PMIx_Disconnect_nb(nspace, NULL, 0, cd_cb, &cbdata);
    if (PMIX_SUCCESS == rc) {
        PMIX_WAIT_FOR_COMPLETION(cbdata.in_progress);
        rc = cbdata.status;
    }
    if (PMIX_SUCCESS != rc) {
        TEST_ERROR(("%s:%d: Disconnect non-blocking test failed.", my_nspace, my_rank));
        return PMIX_ERROR;
    }
    TEST_VERBOSE(("%s:%d: Disconnect non-blocking test succeded.", my_nspace, my_rank));
    return PMIX_SUCCESS;
}