/* we need to pass three things to the client: * * (a) the list of nodes involved in this nspace * * (b) the hostname for each proc in this nspace * * (c) the list of procs on each node for reverse lookup */ void pmix_pack_proc_map(pmix_buffer_t *buf, char **nodes, char **procs) { pmix_kval_t kv; pmix_value_t val; pmix_status_t rc; pmix_buffer_t buf2; size_t i, nnodes; /* bozo check - need procs for each node */ if (pmix_argv_count(nodes) != pmix_argv_count(procs)) { PMIX_ERROR_LOG(PMIX_ERR_BAD_PARAM); return; } PMIX_CONSTRUCT(&buf2, pmix_buffer_t); PMIX_CONSTRUCT(&kv, pmix_kval_t); kv.value = &val; val.type = PMIX_STRING; /* pass the number of nodes involved in this namespace */ nnodes = pmix_argv_count(nodes); if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&buf2, &nnodes, 1, PMIX_SIZE))) { PMIX_ERROR_LOG(rc); goto cleanup; } for (i=0; i < nnodes; i++) { /* pass the complete list of procs on this node */ kv.key = nodes[i]; val.data.string = procs[i]; if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(&buf2, &kv, 1, PMIX_KVAL))) { PMIX_ERROR_LOG(rc); kv.key = NULL; val.data.string = NULL; goto cleanup; } } kv.key = NULL; val.data.string = NULL; /* pass the completed blob */ kv.key = PMIX_MAP_BLOB; val.type = PMIX_BYTE_OBJECT; val.data.bo.bytes = buf2.base_ptr; val.data.bo.size = buf2.bytes_used; if (PMIX_SUCCESS != (rc = pmix_bfrop.pack(buf, &kv, 1, PMIX_KVAL))) { PMIX_ERROR_LOG(rc); } kv.key = NULL; kv.value = NULL; val.data.bo.bytes = NULL; val.data.bo.size = 0; cleanup: PMIX_DESTRUCT(&buf2); PMIX_DESTRUCT(&kv); return; }
static void sndes(pmix_server_nspace_t *p) { PMIX_DESTRUCT(&p->job_info); PMIX_LIST_DESTRUCT(&p->ranks); PMIX_DESTRUCT(&p->mylocal); PMIX_DESTRUCT(&p->myremote); PMIX_DESTRUCT(&p->remote); }
static void nsdes(pmix_nspace_t *p) { PMIX_LIST_DESTRUCT(&p->nodes); PMIX_DESTRUCT(&p->internal); PMIX_DESTRUCT(&p->modex); if (NULL != p->server) { PMIX_RELEASE(p->server); } }
static void cbdes(pmix_cb_t *p) { PMIX_DESTRUCT(&p->data); if (NULL != p->key) { free(p->key); } }
void pmix_globals_finalize(void) { PMIX_LIST_DESTRUCT(&pmix_globals.nspaces); if (NULL != pmix_globals.cache_local) { PMIX_RELEASE(pmix_globals.cache_local); } if (NULL != pmix_globals.cache_remote) { PMIX_RELEASE(pmix_globals.cache_remote); } PMIX_DESTRUCT(&pmix_globals.errregs); }
static void cbdes(pmix_cb_t *p) { if (p->timer_running) { pmix_event_del(&p->ev); } if (NULL != p->pname.nspace) { free(p->pname.nspace); } PMIX_DESTRUCT(&p->data); PMIX_LIST_DESTRUCT(&p->kvs); }
static void pmix_mca_base_var_group_destructor (pmix_mca_base_var_group_t *group) { free (group->group_full_name); group->group_full_name = NULL; free (group->group_description); group->group_description = NULL; free (group->group_project); group->group_project = NULL; free (group->group_framework); group->group_framework = NULL; free (group->group_component); group->group_component = NULL; PMIX_DESTRUCT(&group->group_subgroups); PMIX_DESTRUCT(&group->group_vars); }
int pmix_mca_base_var_group_finalize (void) { pmix_object_t *object; int size, i; if (pmix_mca_base_var_group_initialized) { size = pmix_pointer_array_get_size(&pmix_mca_base_var_groups); for (i = 0 ; i < size ; ++i) { object = pmix_pointer_array_get_item (&pmix_mca_base_var_groups, i); if (NULL != object) { PMIX_RELEASE(object); } } PMIX_DESTRUCT(&pmix_mca_base_var_groups); PMIX_DESTRUCT(&pmix_mca_base_var_group_index_hash); pmix_mca_base_var_group_count = 0; pmix_mca_base_var_group_initialized = false; } return PMIX_SUCCESS; }
static pmix_status_t pmix_bfrop_close(void) { if (!pmix_bfrops_globals.initialized) { return PMIX_SUCCESS; } pmix_bfrops_globals.initialized = false; /* the components will cleanup when closed */ PMIX_DESTRUCT(&pmix_bfrops_globals.actives); return pmix_mca_base_framework_components_close(&pmix_bfrops_base_framework, NULL); }
/* * Shut down the output stream system */ void pmix_output_finalize(void) { if (initialized) { if (verbose_stream != -1) { pmix_output_close(verbose_stream); } free(verbose.lds_prefix); verbose_stream = -1; free (output_prefix); free (output_dir); PMIX_DESTRUCT(&verbose); } }
PMIX_EXPORT pmix_status_t PMIx_Allocation_request(pmix_alloc_directive_t directive, pmix_info_t *info, size_t ninfo) { pmix_cb_t cb; pmix_status_t rc; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_INIT; } PMIX_RELEASE_THREAD(&pmix_global_lock); pmix_output_verbose(2, pmix_globals.debug_output, "%s pmix:allocate", PMIX_NAME_PRINT(&pmix_globals.myid)); /* 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 */ PMIX_CONSTRUCT(&cb, pmix_cb_t); if (PMIX_SUCCESS != (rc = PMIx_Allocation_request_nb(directive, info, ninfo, acb, &cb))) { PMIX_DESTRUCT(&cb); return rc; } /* wait for the operation to complete */ PMIX_WAIT_THREAD(&cb.lock); rc = cb.status; PMIX_DESTRUCT(&cb); pmix_output_verbose(2, pmix_globals.debug_output, "pmix:allocate completed"); return rc; }
PMIX_EXPORT pmix_status_t PMIx_Log(const pmix_info_t data[], size_t ndata, const pmix_info_t directives[], size_t ndirs) { pmix_cb_t cb; pmix_status_t rc; PMIX_ACQUIRE_THREAD(&pmix_global_lock); if (pmix_globals.init_cntr <= 0) { PMIX_RELEASE_THREAD(&pmix_global_lock); return PMIX_ERR_INIT; } PMIX_RELEASE_THREAD(&pmix_global_lock); pmix_output_verbose(2, pmix_plog_base_framework.framework_output, "%s pmix:log", PMIX_NAME_PRINT(&pmix_globals.myid)); /* 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 */ PMIX_CONSTRUCT(&cb, pmix_cb_t); if (PMIX_SUCCESS != (rc = PMIx_Log_nb(data, ndata, directives, ndirs, opcbfunc, &cb))) { PMIX_DESTRUCT(&cb); return rc; } /* wait for the operation to complete */ PMIX_WAIT_THREAD(&cb.lock); rc = cb.status; PMIX_DESTRUCT(&cb); pmix_output_verbose(2, pmix_plog_base_framework.framework_output, "pmix:log completed"); return rc; }
static int pmix_pif_base_close(void) { pmix_list_item_t *item; if (!frameopen) { return PMIX_SUCCESS; } while (NULL != (item = pmix_list_remove_first(&pmix_if_list))) { PMIX_RELEASE(item); } PMIX_DESTRUCT(&pmix_if_list); return pmix_mca_base_framework_components_close(&pmix_pif_base_framework, NULL); }
/* * Shut down the output stream system */ void pmix_output_finalize(void) { if (initialized) { if (verbose_stream != -1) { pmix_output_close(verbose_stream); } free(verbose.lds_prefix); verbose_stream = -1; free (output_prefix); free (output_dir); if(NULL != temp_str) { free(temp_str); temp_str = NULL; temp_str_len = 0; } PMIX_DESTRUCT(&verbose); } }
pmix_status_t pmix_bfrop_close(void) { int32_t i; if (!pmix_bfrop_initialized) { return PMIX_SUCCESS; } pmix_bfrop_initialized = false; for (i = 0 ; i < pmix_pointer_array_get_size(&pmix_bfrop_types) ; ++i) { pmix_bfrop_type_info_t *info = (pmix_bfrop_type_info_t*)pmix_pointer_array_get_item(&pmix_bfrop_types, i); if (NULL != info) { pmix_pointer_array_set_item(&pmix_bfrop_types, i, NULL); PMIX_RELEASE(info); } } PMIX_DESTRUCT(&pmix_bfrop_types); return PMIX_SUCCESS; }
void pmix_rte_finalize(void) { if( --pmix_initialized != 0 ) { if( pmix_initialized < 0 ) { fprintf(stderr, "PMIx Finalize called too many times\n"); return; } return; } if (!pmix_globals.external_evbase) { /* stop the progress thread */ (void)pmix_progress_thread_finalize(NULL); } /* cleanup communications */ pmix_usock_finalize(); if (PMIX_PROC_SERVER != pmix_globals.proc_type && 0 <= pmix_client_globals.myserver.sd) { CLOSE_THE_SOCKET(pmix_client_globals.myserver.sd); } #if defined(PMIX_ENABLE_DSTORE) && (PMIX_ENABLE_DSTORE == 1) pmix_dstore_finalize(); #endif /* PMIX_ENABLE_DSTORE */ /* close the security framework */ (void)pmix_mca_base_framework_close(&pmix_psec_base_framework); /* Clear out all the registered MCA params */ pmix_deregister_params(); pmix_mca_base_var_finalize(); /* keyval lex-based parser */ pmix_util_keyval_parse_finalize(); (void)pmix_mca_base_framework_close(&pmix_pinstalldirs_base_framework); /* finalize the show_help system */ pmix_show_help_finalize(); /* finalize the output system. This has to come *after* the malloc code, as the malloc code needs to call into this, but the malloc code turning off doesn't affect pmix_output that much */ pmix_output_finalize(); #if 0 /* close the bfrops */ (void)pmix_mca_base_framework_close(&pmix_bfrops_base_framework); #endif /* clean out the globals */ PMIX_RELEASE(pmix_globals.mypeer); PMIX_LIST_DESTRUCT(&pmix_globals.nspaces); if (NULL != pmix_globals.cache_local) { PMIX_RELEASE(pmix_globals.cache_local); } if (NULL != pmix_globals.cache_remote) { PMIX_RELEASE(pmix_globals.cache_remote); } PMIX_DESTRUCT(&pmix_globals.events); #if PMIX_NO_LIB_DESTRUCTOR pmix_cleanup(); #endif }
pmix_status_t component_close(void) { PMIX_DESTRUCT(&mca_bfrops_v20_component.types); return PMIX_SUCCESS; }