diff options
author | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2018-06-19 11:17:27 +0200 |
---|---|---|
committer | Matthias Vogelgesang <matthias.vogelgesang@kit.edu> | 2018-06-19 11:17:27 +0200 |
commit | 6ee4a030433d7f747ffd6420a1edf3df71ab85fa (patch) | |
tree | 1616d2e73e6d6784860ea374c6a0f0e23b9b06a8 | |
parent | fc94d4384b1627845812772e9061ea7b6562ffb9 (diff) | |
download | ufo-filters-6ee4a030433d7f747ffd6420a1edf3df71ab85fa.tar.gz ufo-filters-6ee4a030433d7f747ffd6420a1edf3df71ab85fa.tar.bz2 ufo-filters-6ee4a030433d7f747ffd6420a1edf3df71ab85fa.tar.xz ufo-filters-6ee4a030433d7f747ffd6420a1edf3df71ab85fa.zip |
Use new _get_kernel API
48 files changed, 93 insertions, 104 deletions
diff --git a/contrib/ufo-med-mad-reject-task.c b/contrib/ufo-med-mad-reject-task.c index 5a1a09c..2c19c38 100644 --- a/contrib/ufo-med-mad-reject-task.c +++ b/contrib/ufo-med-mad-reject-task.c @@ -85,7 +85,7 @@ ufo_med_mad_reject_task_setup (UfoTask *task, return; } - priv->kernel = ufo_resources_get_kernel (resources, "med-mad-reject.cl", "outliersRej_MedMad_3x3x3_f32", error); + priv->kernel = ufo_resources_get_kernel (resources, "med-mad-reject.cl", "outliersRej_MedMad_3x3x3_f32", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/contrib/ufo-ocl-1liner-task.c b/contrib/ufo-ocl-1liner-task.c index d47e9d2..aa28a4c 100644 --- a/contrib/ufo-ocl-1liner-task.c +++ b/contrib/ufo-ocl-1liner-task.c @@ -116,10 +116,7 @@ ufo_ocl_1liner_task_setup (UfoTask *task, } /* Copiling the kernel now : */ - priv->kernel = ufo_resources_get_kernel_from_source(resources, - kernel_src, - "ocl_1liner", - error); + priv->kernel = ufo_resources_get_kernel_from_source (resources, kernel_src, "ocl_1liner", NULL, error); /* Done compiling sources into a kernel, if existing retain it */ if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/contrib/ufo-stat-monitor-task.c b/contrib/ufo-stat-monitor-task.c index ddcaffe..5c04fe9 100644 --- a/contrib/ufo-stat-monitor-task.c +++ b/contrib/ufo-stat-monitor-task.c @@ -96,12 +96,12 @@ ufo_stat_monitor_task_setup (UfoTask *task, /* Error : kernel compilation is buggy is one device has fp64 and another has not ! */ if (priv->node_has_fp64) { - priv->kernel = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f64", error); - priv->kernel_final = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f64_fin", error); + priv->kernel = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f64", NULL, error); + priv->kernel_final = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f64_fin", NULL, error); } else { - priv->kernel = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f32", error); - priv->kernel_final = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f32_fin", error); + priv->kernel = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f32", NULL, error); + priv->kernel_final = ufo_resources_get_kernel (resources, "stat-monitor.cl", "stat_monitor_f32_fin", NULL, error); } if (priv->kernel == NULL || priv->kernel_final == NULL) diff --git a/src/ufo-backproject-task.c b/src/ufo-backproject-task.c index dd733eb..35d3c4e 100644 --- a/src/ufo-backproject-task.c +++ b/src/ufo-backproject-task.c @@ -158,8 +158,8 @@ ufo_backproject_task_setup (UfoTask *task, priv = UFO_BACKPROJECT_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->nearest_kernel = ufo_resources_get_kernel (resources, "backproject.cl", "backproject_nearest", error); - priv->texture_kernel = ufo_resources_get_kernel (resources, "backproject.cl", "backproject_tex", error); + priv->nearest_kernel = ufo_resources_get_kernel (resources, "backproject.cl", "backproject_nearest", NULL, error); + priv->texture_kernel = ufo_resources_get_kernel (resources, "backproject.cl", "backproject_tex", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); diff --git a/src/ufo-bin-task.c b/src/ufo-bin-task.c index 38f3d04..9713b51 100644 --- a/src/ufo-bin-task.c +++ b/src/ufo-bin-task.c @@ -63,12 +63,12 @@ ufo_bin_task_setup (UfoTask *task, priv = UFO_BIN_TASK_GET_PRIVATE (task); - priv->kernel_2d = ufo_resources_get_kernel (resources, "bin.cl", "binning_2d", error); + priv->kernel_2d = ufo_resources_get_kernel (resources, "bin.cl", "binning_2d", NULL, error); if (priv->kernel_2d != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel_2d)); - priv->kernel_3d = ufo_resources_get_kernel (resources, "bin.cl", "binning_3d", error); + priv->kernel_3d = ufo_resources_get_kernel (resources, "bin.cl", "binning_3d", NULL, error); if (priv->kernel_3d != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel_3d)); diff --git a/src/ufo-binarize-task.c b/src/ufo-binarize-task.c index 082ff28..913300c 100644 --- a/src/ufo-binarize-task.c +++ b/src/ufo-binarize-task.c @@ -61,7 +61,7 @@ ufo_binarize_task_setup (UfoTask *task, UfoBinarizeTaskPrivate *priv; priv = UFO_BINARIZE_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "binarize.cl", "binarize", error); + priv->kernel = ufo_resources_get_kernel (resources, "binarize.cl", "binarize", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-blur-task.c b/src/ufo-blur-task.c index 7d71339..e3a0220 100644 --- a/src/ufo-blur-task.c +++ b/src/ufo-blur-task.c @@ -68,12 +68,12 @@ ufo_blur_task_setup (UfoTask *task, priv = UFO_BLUR_TASK_GET_PRIVATE (task); - priv->h_kernel = ufo_resources_get_kernel (resources, "gaussian.cl", "h_gaussian", error); + priv->h_kernel = ufo_resources_get_kernel (resources, "gaussian.cl", "h_gaussian", NULL, error); if (error && *error) return; - priv->v_kernel = ufo_resources_get_kernel (resources, "gaussian.cl", "v_gaussian", error); + priv->v_kernel = ufo_resources_get_kernel (resources, "gaussian.cl", "v_gaussian", NULL, error); if (error && *error) return; diff --git a/src/ufo-calculate-task.c b/src/ufo-calculate-task.c index bbf2742..6f93445 100644 --- a/src/ufo-calculate-task.c +++ b/src/ufo-calculate-task.c @@ -78,7 +78,7 @@ make_kernel (UfoCalculateTaskPrivate *priv, UfoResources *resources, GError **er g_warning ("Error writing kernel source"); } - priv->kernel = ufo_resources_get_kernel_from_source(resources, source, "calculate", error); + priv->kernel = ufo_resources_get_kernel_from_source(resources, source, "calculate", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); g_free (source); } diff --git a/src/ufo-clip-task.c b/src/ufo-clip-task.c index ac67431..78eb5a9 100644 --- a/src/ufo-clip-task.c +++ b/src/ufo-clip-task.c @@ -71,7 +71,7 @@ ufo_clip_task_setup (UfoTask *task, return; } - priv->kernel = ufo_resources_get_kernel (resources, "clip.cl", "clip", error); + priv->kernel = ufo_resources_get_kernel (resources, "clip.cl", "clip", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-cut-sinogram-task.c b/src/ufo-cut-sinogram-task.c index c64bbf6..2e586af 100644 --- a/src/ufo-cut-sinogram-task.c +++ b/src/ufo-cut-sinogram-task.c @@ -63,7 +63,7 @@ ufo_cut_sinogram_task_setup (UfoTask *task, { UfoCutSinogramTaskPrivate *priv = UFO_CUT_SINOGRAM_TASK_GET_PRIVATE (task); priv->resources = resources; - priv->cut_sinogram_kernel = ufo_resources_get_kernel(resources, "cut-sinogram.cl", "cut_sinogram", error); + priv->cut_sinogram_kernel = ufo_resources_get_kernel(resources, "cut-sinogram.cl", "cut_sinogram", NULL, error); } static void diff --git a/src/ufo-cut-task.c b/src/ufo-cut-task.c index 4af4fca..5ba43d7 100644 --- a/src/ufo-cut-task.c +++ b/src/ufo-cut-task.c @@ -61,7 +61,7 @@ ufo_cut_task_setup (UfoTask *task, UfoCutTaskPrivate *priv; priv = UFO_CUT_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "cut.cl", "cut", error); + priv->kernel = ufo_resources_get_kernel (resources, "cut.cl", "cut", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-denoise-task.c b/src/ufo-denoise-task.c index 32b0e89..4d8293c 100644 --- a/src/ufo-denoise-task.c +++ b/src/ufo-denoise-task.c @@ -72,17 +72,17 @@ ufo_denoise_task_setup (UfoTask *task, priv->context = ufo_resources_get_context (resources); priv->resources = resources; - priv->k_sort_and_set = ufo_resources_get_kernel (resources, "denoise.cl", "sort_and_set", error); + priv->k_sort_and_set = ufo_resources_get_kernel (resources, "denoise.cl", "sort_and_set", NULL, error); if (priv->k_sort_and_set != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_sort_and_set)); - priv->k_load_elements = ufo_resources_get_kernel (resources, "denoise.cl", "load_elements", error); + priv->k_load_elements = ufo_resources_get_kernel (resources, "denoise.cl", "load_elements", NULL, error); if (priv->k_load_elements != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_load_elements)); - priv->k_remove_background = ufo_resources_get_kernel (resources, "denoise.cl", "remove_background", error); + priv->k_remove_background = ufo_resources_get_kernel (resources, "denoise.cl", "remove_background", NULL, error); if (priv->k_remove_background != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_remove_background)); diff --git a/src/ufo-detect-edge-task.c b/src/ufo-detect-edge-task.c index 9b60764..4009d31 100644 --- a/src/ufo-detect-edge-task.c +++ b/src/ufo-detect-edge-task.c @@ -90,7 +90,7 @@ ufo_detect_edge_task_setup (UfoTask *task, priv = UFO_DETECT_EDGE_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "edge.cl", "filter", error); + priv->kernel = ufo_resources_get_kernel (resources, "edge.cl", "filter", NULL, error); if (priv->mask_mem) UFO_RESOURCES_CHECK_CLERR (clReleaseMemObject (priv->mask_mem)); diff --git a/src/ufo-dfi-sinc-task.c b/src/ufo-dfi-sinc-task.c index 6426b45..d01bba0 100644 --- a/src/ufo-dfi-sinc-task.c +++ b/src/ufo-dfi-sinc-task.c @@ -150,14 +150,11 @@ ufo_dfi_sinc_task_setup (UfoTask *task, context = ufo_resources_get_context(resources); cmd_queue = g_list_nth_data(ufo_resources_get_cmd_queues(resources), 0); - //obtain resources priv->resources = g_object_ref(resources); - //create kernel - priv->dfi_sinc_kernel = ufo_resources_get_kernel (resources, "dfi.cl", "dfi_sinc_kernel", error); - priv->clear_kernel = ufo_resources_get_kernel (resources, "dfi.cl", "clear_kernel", error); + priv->dfi_sinc_kernel = ufo_resources_get_kernel (resources, "dfi.cl", "dfi_sinc_kernel", NULL, error); + priv->clear_kernel = ufo_resources_get_kernel (resources, "dfi.cl", "clear_kernel", NULL, error); - //calculate and setup kernel lookup table to buffer gfloat *tmp_ktbl = ufo_dfi_sinc_task_get_ktbl (priv->number_presampled_values); UfoRequisition ktbl_requisition; ktbl_requisition.n_dims = 2; diff --git a/src/ufo-fft-task.c b/src/ufo-fft-task.c index e027728..73154f7 100644 --- a/src/ufo-fft-task.c +++ b/src/ufo-fft-task.c @@ -87,7 +87,7 @@ ufo_fft_task_setup (UfoTask *task, priv = UFO_FFT_TASK_GET_PRIVATE (task); if (priv->zeropad) { - priv->kernel = ufo_resources_get_kernel (resources, "fft.cl", "fft_spread", error); + priv->kernel = ufo_resources_get_kernel (resources, "fft.cl", "fft_spread", NULL, error); } priv->context = ufo_resources_get_context (resources); diff --git a/src/ufo-fftmult-task.c b/src/ufo-fftmult-task.c index ff088ce..09db154 100644 --- a/src/ufo-fftmult-task.c +++ b/src/ufo-fftmult-task.c @@ -58,7 +58,7 @@ ufo_fftmult_task_setup (UfoTask *task, priv = UFO_FFTMULT_TASK_GET_PRIVATE (task); priv->resources = resources; - priv->k_fftmult = ufo_resources_get_kernel (resources, "fftmult.cl", "mult", error); + priv->k_fftmult = ufo_resources_get_kernel (resources, "fftmult.cl", "mult", NULL, error); if (priv->k_fftmult != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_fftmult)); diff --git a/src/ufo-filter-stripes-task.c b/src/ufo-filter-stripes-task.c index 56918ae..48c707c 100644 --- a/src/ufo-filter-stripes-task.c +++ b/src/ufo-filter-stripes-task.c @@ -87,7 +87,7 @@ ufo_filter_stripes_task_setup (UfoTask *task, priv = UFO_FILTER_STRIPES_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "filter.cl", "stripe_filter", error); + priv->kernel = ufo_resources_get_kernel (resources, "filter.cl", "stripe_filter", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-filter-stripes1d-task.c b/src/ufo-filter-stripes1d-task.c index 3f2c010..fa36707 100644 --- a/src/ufo-filter-stripes1d-task.c +++ b/src/ufo-filter-stripes1d-task.c @@ -113,12 +113,13 @@ ufo_filter_stripes1d_task_setup (UfoTask *task, priv = UFO_FILTER_STRIPES1D_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "complex.cl", "c_mul_real_sym", error); + priv->kernel = ufo_resources_get_kernel (resources, "complex.cl", "c_mul_real_sym", NULL, error); priv->filter_mem = NULL; + UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); - if (priv->kernel) { + + if (priv->kernel) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - } } static void @@ -131,9 +132,8 @@ ufo_filter_stripes1d_task_get_requisition (UfoTask *task, priv = UFO_FILTER_STRIPES1D_TASK_GET_PRIVATE (task); ufo_buffer_get_requisition (inputs[0], requisition); - if (!priv->filter_mem || requisition->dims[0] / 2 != priv->last_width) { + if (!priv->filter_mem || requisition->dims[0] / 2 != priv->last_width) create_coefficients (priv, requisition->dims[0] / 2); - } } static guint diff --git a/src/ufo-filter-task.c b/src/ufo-filter-task.c index dda9f96..73697fe 100644 --- a/src/ufo-filter-task.c +++ b/src/ufo-filter-task.c @@ -152,7 +152,7 @@ ufo_filter_task_setup (UfoTask *task, priv = UFO_FILTER_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "filter.cl", "filter", error); + priv->kernel = ufo_resources_get_kernel (resources, "filter.cl", "filter", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-flat-field-correct-task.c b/src/ufo-flat-field-correct-task.c index c3b1f02..8fb615b 100644 --- a/src/ufo-flat-field-correct-task.c +++ b/src/ufo-flat-field-correct-task.c @@ -67,7 +67,7 @@ ufo_flat_field_correct_task_setup (UfoTask *task, UfoFlatFieldCorrectTaskPrivate *priv; priv = UFO_FLAT_FIELD_CORRECT_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "ffc.cl", "flat_correct", error); + priv->kernel = ufo_resources_get_kernel (resources, "ffc.cl", "flat_correct", NULL, error); if (priv->kernel) { UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-flip-task.c b/src/ufo-flip-task.c index f52f08d..6799e0e 100644 --- a/src/ufo-flip-task.c +++ b/src/ufo-flip-task.c @@ -71,8 +71,8 @@ ufo_flip_task_setup (UfoTask *task, UfoFlipTaskPrivate *priv; priv = UFO_FLIP_TASK_GET_PRIVATE (task); - priv->kernels[DIRECTION_HORIZONTAL] = ufo_resources_get_kernel (resources, "flip.cl", "flip_horizontal", error); - priv->kernels[DIRECTION_VERTICAL] = ufo_resources_get_kernel (resources, "flip.cl", "flip_vertical", error); + priv->kernels[DIRECTION_HORIZONTAL] = ufo_resources_get_kernel (resources, "flip.cl", "flip_horizontal", NULL, error); + priv->kernels[DIRECTION_VERTICAL] = ufo_resources_get_kernel (resources, "flip.cl", "flip_vertical", NULL, error); } static void diff --git a/src/ufo-forwardproject-task.c b/src/ufo-forwardproject-task.c index 06c91bd..3b729cd 100644 --- a/src/ufo-forwardproject-task.c +++ b/src/ufo-forwardproject-task.c @@ -65,7 +65,7 @@ ufo_forwardproject_task_setup (UfoTask *task, priv = UFO_FORWARDPROJECT_TASK (task)->priv; - priv->kernel = ufo_resources_get_kernel (resources, "forwardproject.cl", "forwardproject", error); + priv->kernel = ufo_resources_get_kernel (resources, "forwardproject.cl", "forwardproject", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-gradient-task.c b/src/ufo-gradient-task.c index f94f492..b3e4824 100644 --- a/src/ufo-gradient-task.c +++ b/src/ufo-gradient-task.c @@ -76,7 +76,7 @@ ufo_gradient_task_setup (UfoTask *task, UfoGradientTaskPrivate *priv = UFO_GRADIENT_TASK_GET_PRIVATE (task); priv->kernel = ufo_resources_get_kernel (resources, "gradient.cl", direction_values[priv->direction].value_nick, - error); + NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); } diff --git a/src/ufo-ifft-task.c b/src/ufo-ifft-task.c index 2e74150..9d665ad 100644 --- a/src/ufo-ifft-task.c +++ b/src/ufo-ifft-task.c @@ -70,7 +70,7 @@ ufo_ifft_task_setup (UfoTask *task, UfoIfftTaskPrivate *priv; priv = UFO_IFFT_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "fft.cl", "fft_pack", error); + priv->kernel = ufo_resources_get_kernel (resources, "fft.cl", "fft_pack", NULL, error); priv->context = ufo_resources_get_context (resources); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); diff --git a/src/ufo-interpolate-stream-task.c b/src/ufo-interpolate-stream-task.c index 508b572..f659972 100644 --- a/src/ufo-interpolate-stream-task.c +++ b/src/ufo-interpolate-stream-task.c @@ -66,7 +66,7 @@ ufo_interpolate_stream_task_setup (UfoTask *task, priv = UFO_INTERPOLATE_STREAM_TASK_GET_PRIVATE (task); priv->num_inputs = 0; - priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate", error); + priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-interpolate-task.c b/src/ufo-interpolate-task.c index d162c99..d8f5dbc 100644 --- a/src/ufo-interpolate-task.c +++ b/src/ufo-interpolate-task.c @@ -67,7 +67,7 @@ ufo_interpolate_task_setup (UfoTask *task, priv = UFO_INTERPOLATE_TASK_GET_PRIVATE (task); priv->current = 0; priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate", error); + priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-lamino-backproject-task.c b/src/ufo-lamino-backproject-task.c index f99c941..4184595 100644 --- a/src/ufo-lamino-backproject-task.c +++ b/src/ufo-lamino-backproject-task.c @@ -211,24 +211,21 @@ ufo_lamino_backproject_task_setup (UfoTask *task, return; } - priv->vector_kernel = ufo_resources_get_kernel (resources, kernel_filename, vector_kernel_name, error); - priv->scalar_kernel = ufo_resources_get_kernel (resources, kernel_filename, "backproject_burst_1", error); + priv->vector_kernel = ufo_resources_get_kernel (resources, kernel_filename, vector_kernel_name, NULL, error); + priv->scalar_kernel = ufo_resources_get_kernel (resources, kernel_filename, "backproject_burst_1", NULL, error); priv->sampler = clCreateSampler (priv->context, (cl_bool) FALSE, priv->addressing_mode, CL_FILTER_LINEAR, &cl_error); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); UFO_RESOURCES_CHECK_CLERR (cl_error); - if (priv->vector_kernel) { + if (priv->vector_kernel) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->vector_kernel)); - } - if (priv->scalar_kernel) { + if (priv->scalar_kernel) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->scalar_kernel)); - } - for (i = 0; i < BURST; i++) { + for (i = 0; i < BURST; i++) priv->images[i] = NULL; - } switch (BURST) { case 1: priv->table_size = sizeof (cl_float); break; diff --git a/src/ufo-mask-task.c b/src/ufo-mask-task.c index ddad05e..2905eeb 100644 --- a/src/ufo-mask-task.c +++ b/src/ufo-mask-task.c @@ -52,7 +52,7 @@ ufo_mask_task_setup (UfoTask *task, UfoMaskTaskPrivate *priv; priv = UFO_MASK_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "mask.cl", "circular", error); + priv->kernel = ufo_resources_get_kernel (resources, "mask.cl", "circular", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-measure-task.c b/src/ufo-measure-task.c index 60b3e84..6ff975e 100644 --- a/src/ufo-measure-task.c +++ b/src/ufo-measure-task.c @@ -141,7 +141,8 @@ ufo_measure_task_setup (UfoTask *task, priv->local_shape[0] = local_size; priv->local_shape[1] = 1; axis = g_strdup(""); - } else { + } + else { if (priv->axis == 0) { priv->local_shape[0] = 128; priv->local_shape[1] = 1; @@ -151,22 +152,24 @@ ufo_measure_task_setup (UfoTask *task, } axis = g_strdup_printf ("%d", priv->axis); } + while (priv->local_shape[0] * priv->local_shape[1] > local_size) { priv->local_shape[0] /= 2; } + g_debug ("Measure local work group size: %lu %lu", priv->local_shape[0], priv->local_shape[1]); for (i = 0; i < M_LAST; i++) { /* Reduction kernels */ kernel_name = g_strconcat ("reduce_", axis, metric_values[i].value_name, NULL), - priv->kernels[i] = ufo_resources_get_kernel (resources, "reductor.cl", kernel_name, error); + priv->kernels[i] = ufo_resources_get_kernel (resources, "reductor.cl", kernel_name, NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernels[i])); /* Postprocessing (normalization) kernels */ priv->postproc_kernels[i] = NULL; if (postproc_codes[i]) { postproc_source = create_postprocessing_kernel (postproc_codes[i]); - priv->postproc_kernels[i] = ufo_resources_get_kernel_from_source(resources, postproc_source, "calculate", error); + priv->postproc_kernels[i] = ufo_resources_get_kernel_from_source (resources, postproc_source, "calculate", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->postproc_kernels[i])); g_free (postproc_source); } diff --git a/src/ufo-metaballs-task.c b/src/ufo-metaballs-task.c index 9579d0e..656f3d7 100644 --- a/src/ufo-metaballs-task.c +++ b/src/ufo-metaballs-task.c @@ -85,7 +85,7 @@ ufo_metaballs_task_setup (UfoTask *task, priv = UFO_METABALLS_TASK_GET_PRIVATE (task); context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "metaballs.cl", "draw_metaballs", error); + priv->kernel = ufo_resources_get_kernel (resources, "metaballs.cl", "draw_metaballs", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-opencl-reduce-task.c b/src/ufo-opencl-reduce-task.c index be0a6ff..be40233 100644 --- a/src/ufo-opencl-reduce-task.c +++ b/src/ufo-opencl-reduce-task.c @@ -91,19 +91,19 @@ ufo_opencl_reduce_task_setup (UfoTask *task, } if (priv->source != NULL) { - priv->kernel = ufo_resources_get_kernel_from_source (resources, priv->source, priv->kernel_name, error); + priv->kernel = ufo_resources_get_kernel_from_source (resources, priv->source, priv->kernel_name, NULL, error); if (priv->finish_name) - priv->finish = ufo_resources_get_kernel_from_source (resources, priv->source, priv->finish_name, error); + priv->finish = ufo_resources_get_kernel_from_source (resources, priv->source, priv->finish_name, NULL, error); } else { const gchar *filename; filename = priv->filename != NULL ? priv->filename : "opencl-reduce.cl"; - priv->kernel = ufo_resources_get_kernel (resources, filename, priv->kernel_name, error); + priv->kernel = ufo_resources_get_kernel (resources, filename, priv->kernel_name, NULL, error); if (priv->finish_name) - priv->finish = ufo_resources_get_kernel (resources, filename, priv->finish_name, error); + priv->finish = ufo_resources_get_kernel (resources, filename, priv->finish_name, NULL, error); } if (priv->kernel != NULL) { diff --git a/src/ufo-opencl-task.c b/src/ufo-opencl-task.c index 1b2d153..84e7b36 100644 --- a/src/ufo-opencl-task.c +++ b/src/ufo-opencl-task.c @@ -129,13 +129,13 @@ ufo_opencl_task_setup (UfoTask *task, } if (priv->source != NULL) { - priv->kernel = ufo_resources_get_kernel_from_source_with_opts (resources, priv->source, priv->funcname, priv->opts, error); + priv->kernel = ufo_resources_get_kernel_from_source (resources, priv->source, priv->funcname, priv->opts, error); } else { const gchar *filename; filename = priv->filename != NULL ? priv->filename : "opencl.cl"; - priv->kernel = ufo_resources_get_kernel_with_opts (resources, filename, priv->funcname, priv->opts, error); + priv->kernel = ufo_resources_get_kernel (resources, filename, priv->funcname, priv->opts, error); } if (priv->kernel != NULL) { diff --git a/src/ufo-ordfilt-task.c b/src/ufo-ordfilt-task.c index 2d2e69a..3efd689 100644 --- a/src/ufo-ordfilt-task.c +++ b/src/ufo-ordfilt-task.c @@ -80,12 +80,12 @@ ufo_ordfilt_task_setup (UfoTask *task, priv->context = ufo_resources_get_context (resources); get_max_alloc_size (resources, priv); - priv->k_bitonic_ordfilt = ufo_resources_get_kernel (resources, "ordfilt.cl", "bitonic_ordfilt", error); + priv->k_bitonic_ordfilt = ufo_resources_get_kernel (resources, "ordfilt.cl", "bitonic_ordfilt", NULL, error); if (priv->k_bitonic_ordfilt != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_bitonic_ordfilt)); - priv->k_load_elements_from_patern = ufo_resources_get_kernel (resources, "ordfilt.cl", "load_elements_from_pattern", error); + priv->k_load_elements_from_patern = ufo_resources_get_kernel (resources, "ordfilt.cl", "load_elements_from_pattern", NULL, error); if (priv->k_load_elements_from_patern != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->k_load_elements_from_patern)); diff --git a/src/ufo-pad-task.c b/src/ufo-pad-task.c index 39d6712..027f3fd 100644 --- a/src/ufo-pad-task.c +++ b/src/ufo-pad-task.c @@ -90,7 +90,7 @@ ufo_pad_task_setup (UfoTask *task, priv = UFO_PAD_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "pad.cl", "pad", error); + priv->kernel = ufo_resources_get_kernel (resources, "pad.cl", "pad", NULL, error); change_sampler (priv); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); diff --git a/src/ufo-polar-coordinates-task.c b/src/ufo-polar-coordinates-task.c index ba37c3f..7d1ea5e 100644 --- a/src/ufo-polar-coordinates-task.c +++ b/src/ufo-polar-coordinates-task.c @@ -85,16 +85,18 @@ ufo_polar_coordinates_task_setup (UfoTask *task, priv = UFO_POLAR_COORDINATES_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->populate_polar_kernel = ufo_resources_get_kernel (resources, "polar.cl", "populate_polar_space", error); - priv->populate_cartesian_kernel = ufo_resources_get_kernel (resources, "polar.cl", "populate_cartesian_space", error); + priv->populate_polar_kernel = ufo_resources_get_kernel (resources, "polar.cl", "populate_polar_space", NULL, error); + priv->populate_cartesian_kernel = ufo_resources_get_kernel (resources, "polar.cl", "populate_cartesian_space", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); + if (priv->populate_polar_kernel) { UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->populate_polar_kernel)); } if (priv->populate_cartesian_kernel) { UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->populate_cartesian_kernel)); } + priv->sampler = clCreateSampler (priv->context, (cl_bool) FALSE, CL_ADDRESS_CLAMP_TO_EDGE, diff --git a/src/ufo-remove-outliers-task.c b/src/ufo-remove-outliers-task.c index bb30e21..604f077 100644 --- a/src/ufo-remove-outliers-task.c +++ b/src/ufo-remove-outliers-task.c @@ -68,7 +68,7 @@ ufo_remove_outliers_task_setup (UfoTask *task, priv = UFO_REMOVE_OUTLIERS_TASK_GET_PRIVATE (task); option = g_strdup_printf (" -DBOX_SIZE=%i ", priv->size); - priv->kernel = ufo_resources_get_kernel_with_opts (resources, "rm-outliers.cl", "filter", option, error); + priv->kernel = ufo_resources_get_kernel (resources, "rm-outliers.cl", "filter", option, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-rescale-task.c b/src/ufo-rescale-task.c index e40a118..6025c5d 100644 --- a/src/ufo-rescale-task.c +++ b/src/ufo-rescale-task.c @@ -85,7 +85,7 @@ ufo_rescale_task_setup (UfoTask *task, priv = UFO_RESCALE_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "rescale.cl", "rescale", error); + priv->kernel = ufo_resources_get_kernel (resources, "rescale.cl", "rescale", NULL, error); /* We can afford CL_ADDRESS_NONE if the final shape is rounded down */ priv->sampler = clCreateSampler (priv->context, diff --git a/src/ufo-retrieve-phase-task.c b/src/ufo-retrieve-phase-task.c index 2af7109..89a4429 100644 --- a/src/ufo-retrieve-phase-task.c +++ b/src/ufo-retrieve-phase-task.c @@ -104,14 +104,14 @@ ufo_retrieve_phase_task_setup (UfoTask *task, lambda = 6.62606896e-34 * 299792458 / (priv->energy * 1.60217733e-16); priv->prefac = 2 * G_PI * lambda * priv->distance / (priv->pixel_size * priv->pixel_size); - priv->kernels[METHOD_TIE] = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "tie_method", error); - priv->kernels[METHOD_CTF] = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "ctf_method", error); - priv->kernels[METHOD_CTFHALFSINE] = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "ctfhalfsine_method", error); - priv->kernels[METHOD_QP] = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "qp_method", error); - priv->kernels[METHOD_QPHALFSINE] = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "qphalfsine_method", error); - priv->kernels[METHOD_QP2] = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "qp2_method", error); - - priv->mult_by_value_kernel = ufo_resources_get_kernel(resources, "phase-retrieval.cl", "mult_by_value", error); + priv->kernels[METHOD_TIE] = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "tie_method", NULL, error); + priv->kernels[METHOD_CTF] = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "ctf_method", NULL, error); + priv->kernels[METHOD_CTFHALFSINE] = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "ctfhalfsine_method", NULL, error); + priv->kernels[METHOD_QP] = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "qp_method", NULL, error); + priv->kernels[METHOD_QPHALFSINE] = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "qphalfsine_method", NULL, error); + priv->kernels[METHOD_QP2] = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "qp2_method", NULL, error); + + priv->mult_by_value_kernel = ufo_resources_get_kernel (resources, "phase-retrieval.cl", "mult_by_value", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainContext(priv->context)); diff --git a/src/ufo-rotate-task.c b/src/ufo-rotate-task.c index 81c8aac..76cbe6f 100644 --- a/src/ufo-rotate-task.c +++ b/src/ufo-rotate-task.c @@ -129,7 +129,7 @@ ufo_rotate_task_setup (UfoTask *task, priv = UFO_ROTATE_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "rotate.cl", "rotate_image", error); + priv->kernel = ufo_resources_get_kernel (resources, "rotate.cl", "rotate_image", NULL, error); /* Normalized coordinates are necessary for repeat addressing mode */ priv->sampler = clCreateSampler (priv->context, (cl_bool) TRUE, priv->addressing_mode, priv->interpolation, &cl_error); diff --git a/src/ufo-segment-task.c b/src/ufo-segment-task.c index a113cfd..234fb94 100644 --- a/src/ufo-segment-task.c +++ b/src/ufo-segment-task.c @@ -105,9 +105,9 @@ ufo_segment_task_setup (UfoTask *task, priv = UFO_SEGMENT_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->walk = ufo_resources_get_kernel (resources, "segment.cl", "walk", error); - priv->render = ufo_resources_get_kernel (resources, "segment.cl", "render", error); - priv->threshold = ufo_resources_get_kernel (resources, "segment.cl", "threshold", error); + priv->walk = ufo_resources_get_kernel (resources, "segment.cl", "walk", NULL, error); + priv->render = ufo_resources_get_kernel (resources, "segment.cl", "render", NULL, error); + priv->threshold = ufo_resources_get_kernel (resources, "segment.cl", "threshold", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); diff --git a/src/ufo-stitch-task.c b/src/ufo-stitch-task.c index 9547b26..9491f54 100644 --- a/src/ufo-stitch-task.c +++ b/src/ufo-stitch-task.c @@ -73,9 +73,9 @@ ufo_stitch_task_setup (UfoTask *task, priv = UFO_STITCH_TASK_GET_PRIVATE (task); priv->context = ufo_resources_get_context (resources); - priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate_horizontally", error); - priv->sum_kernel = ufo_resources_get_kernel (resources, "reductor.cl", "parallel_sum_2D", error); - priv->pad_kernel = ufo_resources_get_kernel (resources, "pad.cl", "pad_with_image", error); + priv->kernel = ufo_resources_get_kernel (resources, "interpolator.cl", "interpolate_horizontally", NULL, error); + priv->sum_kernel = ufo_resources_get_kernel (resources, "reductor.cl", "parallel_sum_2D", NULL, error); + priv->pad_kernel = ufo_resources_get_kernel (resources, "pad.cl", "pad_with_image", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); diff --git a/src/ufo-subtract-task.c b/src/ufo-subtract-task.c index 2ae6605..0f10797 100644 --- a/src/ufo-subtract-task.c +++ b/src/ufo-subtract-task.c @@ -63,10 +63,7 @@ ufo_subtract_task_setup (UfoTask *task, UfoSubtractTaskPrivate *priv; priv = UFO_SUBTRACT_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, - "arithmetics.cl", - "subtract", - error); + priv->kernel = ufo_resources_get_kernel (resources, "arithmetics.cl", "subtract", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-swap-quadrants-task.c b/src/ufo-swap-quadrants-task.c index 5a40cc6..5112831 100644 --- a/src/ufo-swap-quadrants-task.c +++ b/src/ufo-swap-quadrants-task.c @@ -54,8 +54,8 @@ ufo_swap_quadrants_task_setup (UfoTask *task, { UfoSwapQuadrantsTaskPrivate *priv = UFO_SWAP_QUADRANTS_TASK_GET_PRIVATE (task); - priv->swap_quadrants_kernel_real = ufo_resources_get_kernel (resources, "swap-quadrants.cl", "swap_quadrants_kernel_real", error); - priv->swap_quadrants_kernel_complex = ufo_resources_get_kernel (resources, "swap-quadrants.cl", "swap_quadrants_kernel_complex", error); + priv->swap_quadrants_kernel_real = ufo_resources_get_kernel (resources, "swap-quadrants.cl", "swap_quadrants_kernel_real", NULL, error); + priv->swap_quadrants_kernel_complex = ufo_resources_get_kernel (resources, "swap-quadrants.cl", "swap_quadrants_kernel_complex", NULL, error); if (priv->swap_quadrants_kernel_complex) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->swap_quadrants_kernel_complex)); diff --git a/src/ufo-transpose-task.c b/src/ufo-transpose-task.c index 16eed23..d28a576 100644 --- a/src/ufo-transpose-task.c +++ b/src/ufo-transpose-task.c @@ -49,10 +49,10 @@ ufo_transpose_task_setup (UfoTask *task, GError **error) { UfoTransposeTaskPrivate *priv = UFO_TRANSPOSE_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "transpose.cl", "transpose_shared", error); - if (priv->kernel) { + priv->kernel = ufo_resources_get_kernel (resources, "transpose.cl", "transpose_shared", NULL, error); + + if (priv->kernel) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - } } static void diff --git a/src/ufo-unsplit-task.c b/src/ufo-unsplit-task.c index 05cd9c4..cc2dbf9 100644 --- a/src/ufo-unsplit-task.c +++ b/src/ufo-unsplit-task.c @@ -52,7 +52,7 @@ ufo_unsplit_task_setup (UfoTask *task, UfoUnsplitTaskPrivate *priv; priv = UFO_UNSPLIT_TASK_GET_PRIVATE (task); - priv->kernel = ufo_resources_get_kernel (resources, "split.cl", "unsplit", error); + priv->kernel = ufo_resources_get_kernel (resources, "split.cl", "unsplit", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-volume-render-task.c b/src/ufo-volume-render-task.c index f3c8a54..21bcfe5 100644 --- a/src/ufo-volume-render-task.c +++ b/src/ufo-volume-render-task.c @@ -95,13 +95,9 @@ ufo_volume_render_task_setup (UfoTask *task, priv->context = ufo_resources_get_context (resources); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); - priv->kernel = ufo_resources_get_kernel (resources, - "volume.cl", - "rayCastVolume", - error); + priv->kernel = ufo_resources_get_kernel (resources, "volume.cl", "rayCastVolume", NULL, error); UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); - priv->view_matrix = g_malloc0 (4 * 4 * sizeof(gfloat)); priv->view_matrix[0] = 1.0f; priv->view_matrix[5] = 1.0f; diff --git a/src/ufo-write-task.c b/src/ufo-write-task.c index b2223a4..d3c5027 100644 --- a/src/ufo-write-task.c +++ b/src/ufo-write-task.c @@ -253,7 +253,7 @@ ufo_write_task_setup (UfoTask *task, priv->context = ufo_resources_get_context (resources); UFO_RESOURCES_CHECK_CLERR (clRetainContext (priv->context)); - priv->kernel = ufo_resources_get_kernel (resources, "split.cl", "unsplit", error); + priv->kernel = ufo_resources_get_kernel (resources, "split.cl", "unsplit", NULL, error); if (priv->kernel != NULL) UFO_RESOURCES_CHECK_CLERR (clRetainKernel (priv->kernel)); diff --git a/src/ufo-zeropad-task.c b/src/ufo-zeropad-task.c index 443c804..32b2ad1 100644 --- a/src/ufo-zeropad-task.c +++ b/src/ufo-zeropad-task.c @@ -74,7 +74,7 @@ ufo_zeropad_task_setup (UfoTask *task, { UfoZeropadTaskPrivate *priv = UFO_ZEROPAD_TASK_GET_PRIVATE (task); priv->resources = resources; - priv->zeropad_kernel = ufo_resources_get_kernel(resources, "zeropad.cl", "zeropadding_kernel", error); + priv->zeropad_kernel = ufo_resources_get_kernel (resources, "zeropad.cl", "zeropadding_kernel", NULL, error); } static void |