opencl

How to write/read a single float value(buffer) from OpenCL device

此生再无相见时 提交于 2019-12-13 03:49:33
问题 There are lots of questions about how to read an array from the device, but I only wanna read a single float value from the device. Or it only can read an array from the device? I create a buffer for (float) sum like below. ocl.sum = clCreateBuffer(context, CL_MEM_READ_WRITE, 1, NULL, &err); Set the arg like this. clSetKernelArg(kernel, 0, sizeof(cl_men), &ocl.arr); clSetKernelArg(kernel, 1, sizeof(cl_float), &ocl.sum); In the kernel, I calculate the sum. kernel calculate(global arr, float

Develop OpenCL application without GPU support on Laptop?

房东的猫 提交于 2019-12-13 03:37:22
问题 I am new to OpenCL and want to develop a portable hardware independent OpenCL application. I have ATI Radeon 7670m on my laptop which has OpenCL 1.1 support as per official website. However this GPU is not listed on the APP SDK system requirements site. I am interested in using OpenCL for developing only for GPU and not for CPU. So is there a way I can do this? 回答1: I guess, information on site is outdated. 7670 is OpenCL-compatible for sure. In fact, almost all cards of 5xxx series & newer

Nested loops in OpenCl Kernel

牧云@^-^@ 提交于 2019-12-13 03:07:14
问题 I have recently started trying to study OpenCl and am trying to convert the following code into an efficient OpenCl kernel: for(int i = 0; i < VECTOR_SIZE; i++) { for(int j = 0; j < 100; j++) { C[i] = sqrt(A[i] + sqrt(A[i] * B[i])) * sqrt(A[i] + sqrt(A[i] * B[i])); } } This is what I have come up with so far using different tutorials. My question is, can I somehow get rid of the outer loop in my kernel. Would you say that this is an okey implementation of the above C++ code and no further

openCV 3.0, openCL and meanShiftFiltering

╄→尐↘猪︶ㄣ 提交于 2019-12-13 02:26:16
问题 Based on the changes in openCV 3.0 and openCL, I can not seem to get pyrMeanShiftFiltering to work using openCL. I know that ocl::meanShiftFiltering was supported in openCV 2.4.10. The two functions below take the same amount of time to execute. How can I even check which functions in openCV 3.0 are supported under openCL? Any suggestions? #include <opencv2/core/ocl.hpp> //attempting to use openCL using namespace cv; using namespace ocl; void meanShiftOCL() { setUseOpenCL(true) UMat in, out;

OpenCL Shared Memory Among Tasks

牧云@^-^@ 提交于 2019-12-13 02:25:33
问题 I've been working to create a GPU based conway's game of life program. If you're not familiar with it, here is the Wikipedia Page. I created one version that works by keeping an array of values where 0 represents a dead cell, and 1 a live one. The kernel then simply writes to an image buffer data array to draw an image based on the cell data and then checks each cell's neighbors to update the cell array for the next execution to render. However, a faster method instead represents the value of

clGetProgramBuildInfo does not print build log

荒凉一梦 提交于 2019-12-13 02:17:36
问题 I have written a code in OpenCL. There is an error while building the kernel program. The error code is -11. I tried printing the BUILD LOG but it does not print a proper log but instead it generates some random variables. Here is that part //these are variable declarations cl_device_id* devices; cl_program kernelprgrm; size_t size; //these varaibles have already been assigned properly //main code clGetProgramBuildInfo(kernelprgrm,devices[i], CL_PROGRAM_BUILD_LOG ,0,NULL,&size); char

Changing image format of a Directx acquired surface in opencl

感情迁移 提交于 2019-12-13 02:15:00
问题 I am working in opencl gets a Media surface from Directx /* Working on NV12 surfaces, associate the shared buffer with the kernel object*/ p->memobj[0] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D_surf_hdl, 0, &error); p->memobj[1] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D_surf_hdl, 1, &error); p->memobj[2] = clCreateFromDX9MediaSurfaceINTEL(p->context, CL_MEM_READ_ONLY, input_D3D_surf, input_D3D

How to create OpenCL context based on the openGL context on mac os x

倖福魔咒の 提交于 2019-12-13 02:13:25
问题 I am creating a project about particle system on mac os x. I found similar questions on Internet, and my question is the same as How can I create an shared context between OpenGL and OpenCL with glfw3 on OSX? ,but I still haven't solved my problem yet. Please help me, thank you. This is a part of my code: CGLContextObj glContext = CGLGetCurrentContext(); CGLShareGroupObj shareGroup = CGLGetShareGroup(glContext); cl_context_properties props[] = { CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE,

Euclidean distance using OpenCL

99封情书 提交于 2019-12-13 01:57:09
问题 I am trying to compute the euclidean distance of a set of 5D points (pixels) to a 5D single point (center) and store in another result vector, I want to use vector indexing to store all info in a single vector so for the ith pixel, the 5 dimensions are (5i) , (5i+1) , ... I am new to OpenCL and I just edited a sample code on the internet for my own intentions. The theory is right but the code doesn't show the right answers ! Here is the kernel : //d_kernel.cl __kernel void distance_kernel(_

Wavelet transform written in opencl: seeing artifacts in image

风流意气都作罢 提交于 2019-12-13 01:30:08
问题 I have written a forward wavelet transform in opencl. Basic algorithm is to divide the image into tiles of 128x8; the two left columns and two right columns are treated as boundary columns. Tile data is moved into local memory, transformed, and non-boundary columns are stored in destination. I am seeing image artifacts at the horizontal boundary of the tiles, and I can't figure out what is causing them. They occur on the fourth and 124th column, i.e. the first and last even column not on the