Start cleaning up to prepare for the reduce stage.

This commit is contained in:
Paul Irofti 2025-03-27 20:24:32 +02:00
parent 95ca0c519b
commit f4ad81c8cc
4 changed files with 16 additions and 3 deletions

View file

@ -45,7 +45,7 @@ SEXP CCubes(SEXP tt) {
double elapsed_time;
config_set_int("log", LOG_LEVEL_WARN);
config_set_int("log:clccubes", LOG_LEVEL_WARN);
config_set_int("log:clccubes", LOG_LEVEL_DEBUG);
config_set_int("log:ccubes", LOG_LEVEL_DEBUG);
config_set_int("log:cl", LOG_LEVEL_DEBUG);
@ -203,7 +203,7 @@ SEXP CCubes(SEXP tt) {
int current_batch = n_tasks < n_tasks_batch ? n_tasks : n_tasks_batch;
log_debug("ccubes", "Tasks %d - %d out of %d",
task, task + current_batch, current_batch);
task, task + current_batch - 1, n_tasks);
bool *coverage;
unsigned int *fixed_bits;
@ -267,7 +267,9 @@ SEXP CCubes(SEXP tt) {
}
log_debug_raw("ccubes", "\n");
}
break;
/* change to something less aggresive for reuse */
ccubes_clean_up(ctx);
}
#ifdef _OPENMP

View file

@ -225,6 +225,7 @@ cl_init(struct cl_uctx *puctx)
/*
* CPU
*/
puctx->cpu_queue = NULL;
#if 0
puctx->cpu_queue = clCreateCommandQueue(ctx, devices[1], 0,
&result);

View file

@ -484,8 +484,10 @@ void
ccubes_clean_up(struct ccubes_context *ctx)
{
clReleaseProgram(ctx->ccubes_program);
log_debug("clccubes", "clReleaseProgram ccubes_program");
ccubes_unmap(ctx);
log_debug("clccubes", "ccubes_unmap");
/* INPUTS */
clReleaseMemObject(ctx->nofvalues);
@ -496,14 +498,19 @@ ccubes_clean_up(struct ccubes_context *ctx)
clReleaseMemObject(ctx->last_index);
clReleaseMemObject(ctx->p_covered);
clReleaseMemObject(ctx->p_pichart_pos);
log_debug("clccubes", "clReleaseMemObject INPUTS");
/* OUTPUTS */
clReleaseMemObject(ctx->coverage);
clReleaseMemObject(ctx->fixed_bits);
clReleaseMemObject(ctx->value_bits);
clReleaseMemObject(ctx->pichart_values);
log_debug("clccubes", "clReleaseMemObject OUTPUTS");
cl_clean_up(*ctx->clctx);
log_debug("clccubes", "cl_clean_up");
free(ctx);
return;
}

View file

@ -98,4 +98,7 @@ ccubes_do_tasks(int n_tasks,
unsigned int *pichart_values /* OUT: RW */
);
void
ccubes_clean_up(struct ccubes_context *ctx);
#endif