opencl

How to read UMat from a file in opencv 3.0 Beta?

♀尐吖头ヾ 提交于 2019-12-23 07:07:06
问题 I want to use UMat so my code can be run on both GPU and CPU using OpenCL (OpenCV 3.0.0 Beta). but I can not find a way to read an image file into a UMat or convert a Mat to UMat . How can I read an image into a UMat ? 回答1: Sample for Mat to UMat conversion is below. Coudlnt' find documentation for this. So only option was to read the source. UMat img = imread( "lena.jpg", IMREAD_COLOR ).getUMat( ACCESS_READ ); Different access flags as in source are ACCESS_READ, ACCESS_WRITE, ACCESS_RW,

OpenCV multi-threading frames on Android

荒凉一梦 提交于 2019-12-23 03:32:41
问题 I am doing some work with OpenCV on Android. My code was all on the Java interface and its performance was very bad, so I implemented almost all the image processing with JNI. So on Java I have: @Override public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) { _imgBgrTemp = inputFrame.rgba(); jniFrame(_imgBgrTemp.nativeObj); return _imgBgrTemp; } So jniFrame() function takes care of all the image processing in C++, and with this there was a good improvement in

Proper way of compiling OpenCL applications and using available compiler options

早过忘川 提交于 2019-12-22 12:30:45
问题 I am a newbie in OpenCL stuffs. Whats is the best way to compiler an OpenCL project ? Using a supported compiler ( GCC or Clang ): When we use a compiler like gcc or clang , how do we control these options? Are they have to be set inside the source code, or, likewise the normal compilation flow we can pass them on the command line. Looking at the Khornos-Manual-1.2, there are a few options provided for cl_int clBuildProgram for optimizations. : gcc|clang -O3 -I<INCLUDES> OpenCL_app.c

Proper way of compiling OpenCL applications and using available compiler options

一曲冷凌霜 提交于 2019-12-22 12:30:37
问题 I am a newbie in OpenCL stuffs. Whats is the best way to compiler an OpenCL project ? Using a supported compiler ( GCC or Clang ): When we use a compiler like gcc or clang , how do we control these options? Are they have to be set inside the source code, or, likewise the normal compilation flow we can pass them on the command line. Looking at the Khornos-Manual-1.2, there are a few options provided for cl_int clBuildProgram for optimizations. : gcc|clang -O3 -I<INCLUDES> OpenCL_app.c

Affect of local_work_size on performance and why it is

与世无争的帅哥 提交于 2019-12-22 12:22:21
问题 Hello Everyone.... i am new to opencl and trying to explore more @ it. What is the work of local_work_size in openCL program and how it matters in performance. I am working on some image processing algo and for my openCL kernel i gave as size_t local_item_size = 1; size_t global_item_size = (int) (ceil((float)(D_can_width*D_can_height)/local_item_size))*local_item_size; // Process the entire lists ret = clEnqueueNDRangeKernel(command_queue, kernel, 1, NULL,&global_item_size, &local_item_size,

OpenCL global memory vs. image memory performance differences on Nvidia and AMD

China☆狼群 提交于 2019-12-22 11:26:57
问题 The OpenCL benchmarking site http://www.clbenchmark.com/ has benchmarks for Image Filter: Separable Gaussian Blur - Global Memory Usage and Image Filter: Separable Gaussian Blur - Image Memory Usage Nvidia complete dominates on the Global Memory Usage. For example the GTX 580 is nearlly twice as fast as the HD 7970. It's one of the few benchmarks where Nvidia still leads. Can someone explain why this is? The reason I ask is that I have written a ray tracer on my GTX 590 which runs very fast.

Selecting number of CPU cores in OpenCL

十年热恋 提交于 2019-12-22 10:37:39
问题 I am comparing performance of OpenMP with that of OpenCL on CPUs and my system has 8 cores. But I need comparisons for 2, 4, 6 and 8 cores respectively. I can activiate number of cores in OpenMP through "set_num_threads(n)" function or an environment variable; But I dont know how could I do same in OpenCL, is there alternative of OpenMP set_num_threads API in OpenCL ? 回答1: There is no standard way to do this. OpenCL will try to use all of the resources available on an OpenCL device. One

Killing OpenCL Kernels

天涯浪子 提交于 2019-12-22 10:13:25
问题 Is there any way to kill a running OpenCL kernel through the OpenCL API? I haven't found anything in the spec. The only solutions I could come up with are 1) periodically checking a flag in the kernel that the host writes to when it wants the kernel to stop, or 2) running the kernel in a separate process and killing the entire process. I don't think either of those are very elegant solutions, and I'm not sure #1 would even work reliably. 回答1: No, the OpenCL API doesn't allow to interrupt a

OpenCL computation freezes the screen

拟墨画扇 提交于 2019-12-22 09:46:59
问题 As the title says, when I run my OpenCL kernel the entire screen stops redrawing (the image displayed on monitor remains the same until my program is done with calculations. This is true even in case I unplug it from my notebook and plug it back - allways the same image is displayed) and the computer does not seem to react to mouse moves either - the cursor stays in the same position. I am not sure why this happens. Could it be a bug in my program, or is this a standard behaviour ? While

How to create variable sized __local memory in pyopencl?

血红的双手。 提交于 2019-12-22 08:08:48
问题 in my C OpenCL code I use clSetKernelArg to create 'variable size' __local memory for use in my kernels, which is not available in OpenCL per se. See my example: clSetKernelArg(clKernel, ArgCounter++, sizeof(cl_mem), (void *)&d_B); ... clSetKernelArg(clKernel, ArgCounter++, sizeof(float)*block_size*block_size, NULL); ... kernel=" matrixMul(__global float* C, ... __local float* A_temp, ... )" {... My question is now, how to do the same in pyopencl? I looked through the examples that come with