static void mapping_dst_free( void *v_mapping ) { struct ldapmapping *mapping = v_mapping; if ( BER_BVISEMPTY( &mapping->dst ) ) { mapping_free( &mapping[ -1 ] ); } }
void evt_free(spdid_t spdid, long extern_evt) { struct evt *e; lock_take(&evt_lock); e = mapping_find(extern_evt); if (NULL == e) goto done; __evt_free(e); mapping_free(extern_evt); done: lock_release(&evt_lock); return; }
/** Maps waveform to the platform. The platform is obtained using the man_platform_get_context() * function. * The mapping result is saved to each module in the module_t.processor_idx and module_t.exec_position * fields. module_t.node is pointed to the platform node object of the allocated processor. * The number of nodes allocated to each node is saved in the mapping_t.modules_x_node array. * \returns 0 if the mapping was feasible, -1 otherwise. The error description is saved in the * oesr_man_error class. */ int mapping_map(mapping_t *m, waveform_t *waveform) { /**@TODO: Use the oesr_man_error class for error messages */ mdebug("waveform_name=%s, nof_modules=%d\n",waveform->name, waveform->nof_modules); int i; int ret=-1; float total_mopts; man_platform_t *platform = man_platform_get_context(); man_node_t *node; if (!platform) { aerror("oesr_man not initialized\n"); return -1; } printf("Computing mapping for %d modules...\n",waveform->nof_modules); if (mapping_alloc(m,waveform->nof_modules,platform->nof_processors)) { return -1; } if (setup_algorithm(m)) { goto free; } if (generate_model(m, waveform, platform)) { goto free; } if (call_algorithm(m, waveform, platform)) { goto free; } total_mopts=0; memset(m->modules_x_node,0,sizeof(int)*MAX(nodes)); for (i=0;i<waveform->nof_modules;i++) { if (m->p_res[joined_function_inv[i]] >= platform->nof_processors) { aerror_msg("Module %d mapped to processor %d, but platform has %d processors only\n", joined_function_inv[i],m->p_res[joined_function_inv[i]]+1,platform->nof_processors); goto free; } man_processor_t *p = (man_processor_t*) platform->processors[m->p_res[joined_function_inv[i]]]; waveform->modules[i].node = p->node; waveform->modules[i].processor_idx = p->idx_in_node; waveform->modules[i].exec_position = i;/*waveform->nof_modules-i-1;*/ node = p->node; m->modules_x_node[node->id]++; total_mopts+=waveform->modules[i].c_mopts[0]; } printf("Done. %g GOPTS\n",total_mopts/1000); ret = 0; free: mapping_free(m,waveform->nof_modules,platform->nof_processors); return ret; }
~MappingWrapper() { mapping_free(c_mapping); }