本文整理汇总了C++中MPIU_Free函数的典型用法代码示例。如果您正苦于以下问题:C++ MPIU_Free函数的具体用法?C++ MPIU_Free怎么用?C++ MPIU_Free使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MPIU_Free函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RemoveLevel
void RemoveLevel(int rank)
{
RecursionStruct *pLevel = g_pLevel, *pTrailer = g_pLevel;
while (pLevel)
{
if (pLevel->rank == rank)
{
if (pLevel == pTrailer)
{
if (g_pLevel == pLevel)
g_pLevel = g_pLevel->next;
pLevel = pLevel->next;
fclose(pTrailer->fout);
unlink(pTrailer->filename);
MPIU_Free(pTrailer);
pTrailer = pLevel;
}
else
{
pTrailer->next = pLevel->next;
fclose(pLevel->fout);
unlink(pLevel->filename);
MPIU_Free(pLevel);
pLevel = pTrailer->next;
}
}
else
{
if (pTrailer != pLevel)
pTrailer = pTrailer->next;
pLevel = pLevel->next;
}
}
}
示例2: MPIU_Thread_cond_signal
void MPIU_Thread_cond_signal(MPIU_Thread_cond_t * cond, int * err)
{
MPIU_Thread_cond_fifo_t *fifo;
MPIU_Thread_mutex_lock(&cond->fifo_mutex, err);
if (err != NULL && *err != MPIU_THREAD_SUCCESS)
{
return;
}
fifo = cond->fifo_head;
if (fifo)
{
cond->fifo_head = cond->fifo_head->next;
if (cond->fifo_head == NULL)
cond->fifo_tail = NULL;
}
MPIU_Thread_mutex_unlock(&cond->fifo_mutex, err);
if (err != NULL && *err != MPIU_THREAD_SUCCESS)
{
return;
}
if (fifo)
{
if (!SetEvent(fifo->event) && err != NULL)
{
*err = GetLastError();
MPIU_Free(fifo);
return;
}
MPIU_Free(fifo);
}
if (err != NULL)
{
*err = MPIU_THREAD_SUCCESS;
}
}
示例3: MPIR_T_enum_env_finalize
static void MPIR_T_enum_env_finalize(void)
{
int i, j;
MPIR_T_enum_t *e;
enum_item_t *item;
if (enum_table) {
/* Free all entries */
for (i = 0; i < utarray_len(enum_table); i++) {
e = (MPIR_T_enum_t *)utarray_eltptr(enum_table, i);
MPIU_Free((void *)e->name);
/* Free items in this enum */
for (j = 0; j < utarray_len(e->items); j++) {
item = (enum_item_t *)utarray_eltptr(e->items, j);
MPIU_Free((void *)item->name);
}
utarray_free(e->items);
}
/* Free enum_table itself */
utarray_free(enum_table);
enum_table = NULL;
}
}
示例4: MPIDI_SHM_Win_free
int MPIDI_SHM_Win_free(MPID_Win **win_ptr)
{
static char FCNAME[] = "MPID_SHM_Win_free";
int rc;
int mpi_errno = MPI_SUCCESS;
/* Free shared memory region */
/* free shm_base_addrs that's only used for shared memory windows */
if ((*win_ptr)->mpid.shm->allocated) {
OPA_fetch_and_add_int((OPA_int_t *) &((*win_ptr)->mpid.shm->ctrl->shm_count),-1);
while((*win_ptr)->mpid.shm->ctrl->shm_count !=0) MPIDI_QUICKSLEEP;
if ((*win_ptr)->comm_ptr->rank == 0) {
MPIDI_SHM_MUTEX_DESTROY(*win_ptr);
}
#ifdef USE_SYSV_SHM
mpi_errno = shmdt((*win_ptr)->mpid.shm->base_addr);
if ((*win_ptr)->comm_ptr->rank == 0) {
rc=shmctl((*win_ptr)->mpid.shm->shm_id,IPC_RMID,NULL);
MPIU_ERR_CHKANDJUMP((rc == -1), errno,MPI_ERR_RMA_SHARED, "**shmctl");
}
#elif USE_MMAP_SHM
munmap ((*win_ptr)->mpid.shm->base_addr, (*win_ptr)->mpid.shm->segment_len);
if (0 == (*win_ptr)->comm_ptr->rank) shm_unlink ((*win_ptr)->mpid.shm->shm_key);
#else
MPID_Abort(NULL, MPI_ERR_RMA_SHARED, -1, "MPI_Win_free error");
#endif
} else {/* one task on a node */
MPIU_Free((*win_ptr)->mpid.shm->base_addr);
}
MPIU_Free((*win_ptr)->mpid.shm);
(*win_ptr)->mpid.shm = NULL;
fn_fail:
return mpi_errno;
}
示例5: MPID_nem_ptl_rptl_ptfini
int MPID_nem_ptl_rptl_ptfini(ptl_pt_index_t pt_index)
{
int i;
int ret = PTL_OK;
struct rptl *rptl;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_PTL_RPTL_PTFINI);
MPIDI_FUNC_ENTER(MPID_STATE_MPID_NEM_PTL_RPTL_PTFINI);
/* find the right rptl */
for (rptl = rptl_info.rptl_list; rptl && rptl->data.pt != pt_index; rptl = rptl->next);
assert(rptl);
/* free control portals that were created */
if (rptl->control.pt != PTL_PT_ANY) {
for (i = 0; i < rptl_info.world_size * 2; i++) {
ret = PtlMEUnlink(rptl->control.me[i]);
RPTLU_ERR_POP(ret, "Error unlinking control buffers\n");
}
MPIU_Free(rptl->control.me);
}
MPL_DL_DELETE(rptl_info.rptl_list, rptl);
MPIU_Free(rptl);
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPID_NEM_PTL_RPTL_PTFINI);
return ret;
fn_fail:
goto fn_exit;
}
示例6: smpd_spn_list_finalize
int smpd_spn_list_finalize(smpd_spn_list_hnd_t *spn_list_hnd_p)
{
smpd_host_spn_node_t *spn_list_head, *cur_node;
smpd_enter_fn(FCNAME);
if(spn_list_hnd_p == NULL){
smpd_err_printf("Invalid pointer to spn list handle\n");
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
if(!SMPD_SPN_LIST_HND_IS_INIT(*spn_list_hnd_p)){
smpd_dbg_printf("Trying to finalize an uninitialized handle\n");
smpd_exit_fn(FCNAME);
return SMPD_FAIL;
}
spn_list_head = **spn_list_hnd_p;
while(spn_list_head != NULL){
cur_node = spn_list_head;
spn_list_head = cur_node->next;
MPIU_Free(cur_node);
}
/* Free contents of the spn handle */
MPIU_Free(*spn_list_hnd_p);
*spn_list_hnd_p = NULL;
smpd_exit_fn(FCNAME);
return SMPD_SUCCESS;
}
示例7: MPID_nem_ib_finalize_hash_table
void MPID_nem_ib_finalize_hash_table(
MPID_nem_ib_hash_table_ptr_t table)
{
int i;
MPID_nem_ib_hash_elem_ptr_t start_elem;
MPID_nem_ib_hash_elem_ptr_t elem, next_elem;
pthread_mutex_lock(&table->hash_table_lock);
MPIU_Assert(table->entries != NULL);
for(i = 0; i < table->num_entries; i++) {
start_elem = &table->entries[i];
/* Walk through the list freeing
* elements as we go */
elem = start_elem->next;
while(elem != NULL) {
next_elem = elem->next;
MPIU_Free(elem);
elem = next_elem;
}
}
pthread_mutex_unlock(&table->hash_table_lock);
MPIU_Free(table->entries);
}
示例8: MPIR_T_cat_env_finalize
static void MPIR_T_cat_env_finalize(void)
{
int i;
cat_table_entry_t *cat;
if (cat_table) {
/* Free all entries */
for (i = 0; i < utarray_len(cat_table); i++) {
cat = (cat_table_entry_t *)utarray_eltptr(cat_table, i);
MPIU_Free((void *)cat->name);
MPIU_Free((void *)cat->desc);
utarray_free(cat->cvar_indices);
utarray_free(cat->pvar_indices);
utarray_free(cat->subcat_indices);
}
/* Free cat_table itself */
utarray_free(cat_table);
cat_table = NULL;
}
if (cat_hash) {
name2index_hash_t *current, *tmp;
/* Free all entries */
HASH_ITER(hh, cat_hash, current, tmp) {
HASH_DEL(cat_hash, current);
MPIU_Free(current);
}
/* Free cat_hash itself */
HASH_CLEAR(hh, cat_hash);
cat_hash = NULL;
}
示例9: _mxm_handle_sreq
int _mxm_handle_sreq(MPID_Request * req)
{
int complete = FALSE;
MPID_nem_mxm_vc_area *vc_area = NULL;
MPID_nem_mxm_req_area *req_area = NULL;
vc_area = VC_BASE(req->ch.vc);
req_area = REQ_BASE(req);
_dbg_mxm_out_buf(req_area->iov_buf[0].ptr,
(req_area->iov_buf[0].length > 16 ? 16 : req_area->iov_buf[0].length));
vc_area->pending_sends -= 1;
if (req->dev.tmpbuf) {
if (req->dev.datatype_ptr || req->ch.noncontig) {
MPIU_Free(req->dev.tmpbuf);
}
}
if (req_area->iov_count > MXM_MPICH_MAX_IOV) {
MPIU_Free(req_area->iov_buf);
req_area->iov_buf = req_area->tmp_buf;
req_area->iov_count = 0;
}
MPIDI_CH3U_Handle_send_req(req->ch.vc, req, &complete);
MPIU_Assert(complete == TRUE);
return complete;
}
示例10: MPIDI_Win_GetAccSendAckDoneCB
static void
MPIDI_Win_GetAccSendAckDoneCB(pami_context_t context,
void * _info,
pami_result_t result)
{
MPIDI_Win_GetAccMsgInfo *msginfo = (MPIDI_Win_GetAccMsgInfo *) _info;
MPIU_Free(msginfo->tptr);
MPIU_Free(msginfo);
}
示例11: MPIR_FreeProctable
/* This routine is the finalize callback used to free the procable */
static int MPIR_FreeProctable( void *ptable )
{
int i;
MPIR_PROCDESC *proctable = (MPIR_PROCDESC *)ptable;
for (i=0; i<MPIR_proctable_size; i++) {
if (proctable[i].host_name) { MPIU_Free( proctable[i].host_name ); }
}
MPIU_Free( proctable );
return 0;
}
示例12: MPID_NS_Free
int MPID_NS_Free( MPID_NS_Handle *handle_ptr )
{
static const char FCNAME[] = "MPID_NS_Free";
int err;
MPIU_Free( (*handle_ptr)->kvsname );
MPIU_Free( *handle_ptr );
*handle_ptr = 0;
return 0;
}
示例13: reinit_pmi
static int reinit_pmi(void)
{
int ret;
int has_parent = 0;
int pg_rank, pg_size;
int kvs_name_sz, pg_id_sz;
MPIDI_STATE_DECL(MPID_STATE_REINIT_PMI);
MPIDI_FUNC_ENTER(MPID_STATE_REINIT_PMI);
/* Init pmi and do some sanity checks */
ret = PMI_Init(&has_parent);
CHECK_ERR(ret, "pmi_init");
ret = PMI_Get_rank(&pg_rank);
CHECK_ERR(ret, "pmi_get_rank");
ret = PMI_Get_size(&pg_size);
CHECK_ERR(ret, "pmi_get_size");
CHECK_ERR(pg_size != MPIDI_Process.my_pg->size, "pg size differs after restart");
CHECK_ERR(pg_rank != MPIDI_Process.my_pg_rank, "pg rank differs after restart");
/* get new pg_id */
ret = PMI_KVS_Get_name_length_max(&pg_id_sz);
CHECK_ERR(ret, "pmi_get_id_length_max");
MPIU_Free(MPIDI_Process.my_pg->id);
MPIDI_Process.my_pg->id = MPIU_Malloc(pg_id_sz + 1);
CHECK_ERR(MPIDI_Process.my_pg->id == NULL, "malloc failed");
ret = PMI_KVS_Get_my_name(MPIDI_Process.my_pg->id, pg_id_sz);
CHECK_ERR(ret, "pmi_kvs_get_my_name");
/* get new kvsname */
ret = PMI_KVS_Get_name_length_max(&kvs_name_sz);
CHECK_ERR(ret, "PMI_KVS_Get_name_length_max");
MPIU_Free(MPIDI_Process.my_pg->connData);
MPIDI_Process.my_pg->connData = MPIU_Malloc(kvs_name_sz + 1);
CHECK_ERR(MPIDI_Process.my_pg->connData == NULL, "malloc failed");
ret = PMI_KVS_Get_my_name(MPIDI_Process.my_pg->connData, kvs_name_sz);
CHECK_ERR(ret, "PMI_Get_my_name");
MPIDI_FUNC_EXIT(MPID_STATE_REINIT_PMI);
return 0;
}
示例14: MPIDI_close_pe_extension
void MPIDI_close_pe_extension() {
extern MPIDI_printenv_t *mpich_env;
extern MPIX_stats_t *mpid_statp;
int rc;
/* PAMI_Extension_open in pami_init */
rc = PAMI_Extension_close (pe_extension);
if (rc != PAMI_SUCCESS) {
TRACE_ERR("ERROR close PAMI_Extension failed rc %d", rc);
}
if (mpich_env)
MPIU_Free(mpich_env);
if (mpid_statp)
MPIU_Free(mpid_statp);
}
示例15: MPIU_Handle_free
/* This routine is called by finalize when MPI exits */
static int MPIU_Handle_free( void *((*indirect)[]), int indirect_size )
{
int i;
/* Remove any allocated storage */
for (i=0; i<indirect_size; i++) {
MPIU_Free( (*indirect)[i] );
}
if (indirect) {
MPIU_Free( indirect );
}
/* This does *not* remove any objects that the user created
and then did not destroy */
return 0;
}