void frm_thread_block_free(struct frm_thread_block_t *thread_block) { int i; for (i = 0; i < thread_block->warp_count; i++) frm_warp_free(thread_block->warps[i]); free(thread_block->warps); list_free(thread_block->running_warps); list_free(thread_block->finished_warps); for (i = 0; i < thread_block->thread_count; i++) frm_thread_free(thread_block->threads[i]); free(thread_block->threads); mem_free(thread_block->shared_mem); free(thread_block); }
void frm_grid_free(struct frm_grid_t *grid) { int i; /* Free threadblocks */ for (i = 0; i < grid->threadblock_count; i++) frm_threadblock_free(grid->threadblocks[i]); free(grid->threadblocks); /* Free warps */ for (i = 0; i < grid->warp_count; i++) frm_warp_free(grid->warps[i]); free(grid->warps); /* Free threads */ for (i = 0; i < grid->thread_count; i++) frm_thread_free(grid->threads[i]); free(grid->threads); /* Free grid */ free(grid); }