char* orte_get_proc_hostname(orte_process_name_t *proc) { orte_proc_t *proct; char *hostname = NULL; int rc; /* if we are a tool, then we have no way of obtaining * this info */ if (ORTE_PROC_IS_TOOL) { return NULL; } /* don't bother error logging any not-found situations * as the layer above us will have something to say * about it */ if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { return NULL; } if (NULL == proct->node || NULL == proct->node->name) { return NULL; } return proct->node->name; } /* if we are an app, get the data from the modex db */ OPAL_MODEX_RECV_VALUE(rc, OPAL_PMIX_HOSTNAME, (opal_process_name_t*)proc, &hostname, OPAL_STRING); /* user is responsible for releasing the data */ return hostname; }
orte_node_rank_t orte_get_proc_node_rank(orte_process_name_t *proc) { orte_proc_t *proct; orte_node_rank_t noderank; int rc; opal_list_t myvals; opal_value_t *kv; if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_NODE_RANK_INVALID; } return proct->node_rank; } /* if we are an app, get the value from the modex db */ OBJ_CONSTRUCT(&myvals, opal_list_t); if (ORTE_SUCCESS != (rc = opal_dstore.fetch(opal_dstore_internal, (opal_identifier_t*)proc, OPAL_DSTORE_NODERANK, &myvals))) { ORTE_ERROR_LOG(rc); OPAL_LIST_DESTRUCT(&myvals); return ORTE_NODE_RANK_INVALID; } kv = (opal_value_t*)opal_list_get_first(&myvals); noderank = kv->data.uint16; OPAL_LIST_DESTRUCT(&myvals); return noderank; }
orte_node_rank_t orte_get_proc_node_rank(orte_process_name_t *proc) { orte_proc_t *proct; orte_node_rank_t *noderank, nd; int rc; if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_NODE_RANK_INVALID; } return proct->node_rank; } /* if we are an app, get the value from the modex db */ noderank = &nd; OPAL_MODEX_RECV_VALUE(rc, OPAL_PMIX_NODE_RANK, (opal_process_name_t*)proc, &noderank, ORTE_NODE_RANK); if (OPAL_SUCCESS != rc) { nd = ORTE_NODE_RANK_INVALID; } return nd; }
char* orte_get_proc_hostname(orte_process_name_t *proc) { orte_proc_t *proct; char *hostname; int rc; if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return NULL; } if (NULL == proct->node || NULL == proct->node->name) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return NULL; } return proct->node->name; } /* if we are an app, get the pointer from the modex db */ if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((opal_identifier_t*)proc, ORTE_DB_HOSTNAME, (void**)&hostname, OPAL_STRING))) { ORTE_ERROR_LOG(rc); return NULL; } return hostname; }
orte_node_rank_t orte_get_proc_node_rank(orte_process_name_t *proc) { orte_proc_t *proct; orte_node_rank_t noderank, *nr; int rc; if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return ORTE_NODE_RANK_INVALID; } return proct->node_rank; } /* if we are an app, get the value from the modex db */ nr = &noderank; if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((opal_identifier_t*)proc, ORTE_DB_NODERANK, (void**)&nr, ORTE_NODE_RANK))) { ORTE_ERROR_LOG(rc); return ORTE_NODE_RANK_INVALID; } return noderank; }
char* orte_get_proc_hostname(orte_process_name_t *proc) { orte_proc_t *proct; char *hostname; int rc; /* don't bother error logging any not-found situations * as the layer above us will have something to say * about it */ if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { return NULL; } if (NULL == proct->node || NULL == proct->node->name) { return NULL; } return proct->node->name; } /* if we are an app, get the pointer from the modex db */ if (ORTE_SUCCESS != (rc = opal_db.fetch_pointer((opal_identifier_t*)proc, ORTE_DB_HOSTNAME, (void**)&hostname, OPAL_STRING))) { return NULL; } return hostname; }
static bool component_is_reachable(orte_process_name_t *peer) { orte_proc_t *proc; /* if I am an application, then everything is reachable * by me via my daemon */ if (ORTE_PROC_IS_APP) { return true; } /* if I am a daemon or HNP, I can only reach my * own local procs via this component */ if (ORTE_PROC_MY_NAME->jobid == peer->jobid) { /* another daemon */ return false; } if (NULL == (proc = orte_get_proc_object(peer)) || !proc->local_proc) { return false; } /* indicate that this peer is reachable by this component */ return true; }
static int component_send(orte_rml_send_t *msg) { orte_proc_t *proc; opal_output_verbose(5, orte_oob_base_framework.framework_output, "%s oob:usock:send_nb to peer %s:%d", ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), ORTE_NAME_PRINT(&msg->dst), msg->tag); if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* daemons can only reach local procs */ if (NULL == (proc = orte_get_proc_object(&msg->dst))) { return ORTE_ERR_TAKE_NEXT_OPTION; } if (!proc->local_proc) { return ORTE_ERR_TAKE_NEXT_OPTION; } } /* apps can reach anyone via this module as the daemon * will route the message to the final destination */ mca_oob_usock_module.api.send_nb(msg); return ORTE_SUCCESS; }
static int component_set_addr(orte_process_name_t *peer, char **uris) { orte_proc_t *proc; mca_oob_usock_peer_t *pr; uint64_t *ui64; /* if I am an application, then everything is addressable * by me via my daemon */ if (ORTE_PROC_IS_APP) { ui64 = (uint64_t*)peer; if (OPAL_SUCCESS != opal_hash_table_get_value_uint64(&mca_oob_usock_module.peers, (*ui64), (void**)&pr) || NULL == pr) { pr = OBJ_NEW(mca_oob_usock_peer_t); pr->name = *peer; opal_hash_table_set_value_uint64(&mca_oob_usock_module.peers, (*ui64), pr); return ORTE_SUCCESS; } } /* if I am a daemon or HNP, I can only reach my * own local procs via this component */ if (ORTE_PROC_MY_NAME->jobid == peer->jobid) { /* another daemon */ return ORTE_ERR_TAKE_NEXT_OPTION; } if (NULL == (proc = orte_get_proc_object(peer)) || !proc->local_proc) { return ORTE_ERR_TAKE_NEXT_OPTION; } /* indicate that this peer is addressable by this component */ ui64 = (uint64_t*)peer; if (OPAL_SUCCESS != opal_hash_table_get_value_uint64(&mca_oob_usock_module.peers, (*ui64), (void**)&pr) || NULL == pr) { pr = OBJ_NEW(mca_oob_usock_peer_t); pr->name = *peer; opal_hash_table_set_value_uint64(&mca_oob_usock_module.peers, (*ui64), pr); } return ORTE_SUCCESS; }
char* orte_get_proc_hostname(orte_process_name_t *proc) { orte_proc_t *proct; char *hostname; int rc; opal_list_t myvals; opal_value_t *kv; /* don't bother error logging any not-found situations * as the layer above us will have something to say * about it */ if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { return NULL; } if (NULL == proct->node || NULL == proct->node->name) { return NULL; } return proct->node->name; } /* if we are an app, get the data from the modex db */ OBJ_CONSTRUCT(&myvals, opal_list_t); if (ORTE_SUCCESS != (rc = opal_dstore.fetch(opal_dstore_internal, (opal_identifier_t*)proc, OPAL_DSTORE_HOSTNAME, &myvals))) { OPAL_LIST_DESTRUCT(&myvals); return NULL; } kv = (opal_value_t*)opal_list_get_first(&myvals); hostname = kv->data.string; /* protect the data */ kv->data.string = NULL; OPAL_LIST_DESTRUCT(&myvals); /* user is responsible for releasing the data */ return hostname; }
char* orte_get_proc_hostname(orte_process_name_t *proc) { orte_proc_t *proct; char *hostname; int rc; opal_list_t myvals; opal_value_t *kv; if (ORTE_PROC_IS_DAEMON || ORTE_PROC_IS_HNP) { /* look it up on our arrays */ if (NULL == (proct = orte_get_proc_object(proc))) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return NULL; } if (NULL == proct->node || NULL == proct->node->name) { ORTE_ERROR_LOG(ORTE_ERR_NOT_FOUND); return NULL; } return proct->node->name; } /* if we are an app, get the data from the modex db */ OBJ_CONSTRUCT(&myvals, opal_list_t); if (ORTE_SUCCESS != (rc = opal_dstore.fetch(opal_dstore_internal, (opal_identifier_t*)proc, OPAL_DSTORE_HOSTNAME, &myvals))) { ORTE_ERROR_LOG(rc); OPAL_LIST_DESTRUCT(&myvals); return NULL; } kv = (opal_value_t*)opal_list_get_first(&myvals); hostname = kv->data.string; /* protect the data */ kv->data.string = NULL; OPAL_LIST_DESTRUCT(&myvals); /* user is responsible for releasing the data */ return hostname; }