OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1663 Discussions

Cannot get "Jump Start Tutorial" to build

Ben_Rush
Beginner
368 Views

Totally green with openCL. I'm trying to get the source from this tutorial to build. But I cannot. 

In particular, I'm getting CL_INVALID_MEM_OBJECT when executing the following code: 

    err = clSetKernelArg(ocl->kernel, 2, sizeof(cl_mem), (void *)&width);
    if (CL_SUCCESS != err)
    {
        LogError("Error: Failed to set argument dstMem, returned %s\n", TranslateOpenCLError(err));
        return err;
    }

The tutorial is supposed to work on an image, and specifically states the arguments should be set as such: 

    err  |= clSetKernelArg(ocl->kernel, 2, sizeof(cl_mem), (void *) &width);
    err  |= clSetKernelArg(ocl->kernel, 3, sizeof(cl_mem), (void *) &height);

When I try to change the sizeof() to be sizeof(cl_uint), then it says CL_INVALID_ARG_SIZE. 

This is the full function: 

cl_uint SetKernelArguments(ocl_args_d_t *ocl, cl_uint width, cl_uint height)
{
    cl_int err = CL_SUCCESS;

    err  =  clSetKernelArg(ocl->kernel, 0, sizeof(cl_mem), (void *)&ocl->srcA);
    if (CL_SUCCESS != err)
    {
        LogError("error: Failed to set argument srcA, returned %s\n", TranslateOpenCLError(err));
        return err;
    }

    err  = clSetKernelArg(ocl->kernel, 1, sizeof(cl_mem), (void *)&ocl->dstMem);
    if (CL_SUCCESS != err)
    {
        LogError("Error: Failed to set argument dstMem, returned %s\n", TranslateOpenCLError(err));
        return err;
    }

    err = clSetKernelArg(ocl->kernel, 2, sizeof(cl_uint), (void *)&width);
    if (CL_SUCCESS != err)
    {
        LogError("Error: Failed to set argument dstMem, returned %s\n", TranslateOpenCLError(err));
        return err;
    }

    err = clSetKernelArg(ocl->kernel, 3, sizeof(cl_mem), (void *)&height);
    if (CL_SUCCESS != err)
    {
        LogError("Error: Failed to set argument dstMem, returned %s\n", TranslateOpenCLError(err));
        return err;
    }

    return err;
}

If you wish to see the full source, or even download it and try it, you may do so by looking at the it on my github repo here: https://github.com/kwende/SimpleOpenCL/blob/master/EdgeDetectionOnGPU/EdgeDetectionOnGPU.cpp

0 Kudos
1 Solution
Robert_I_Intel
Employee
368 Views

Hi Ben,

This tutorial is outdated, I probably should just delete it. For a couple of sample applications, you can try these : https://software.intel.com/en-us/articles/optimizing-simple-opencl-kernels - there are two files there, Modulate.zip and Sobel.zip, right after the videos.  You can then try to use this sample: https://software.intel.com/en-us/articles/getting-the-most-from-opencl-12-how-to-increase-performanc... and try modifying Modulate and Sobel to use zero-copy buffers.

You can use http://www.irfanview.com/ to visualize the results.

Other samples are available here: https://software.intel.com/en-us/intel-opencl-support/code-samples.

Sorry for the confusion.

View solution in original post

6 Replies
Robert_I_Intel
Employee
369 Views

Hi Ben,

This tutorial is outdated, I probably should just delete it. For a couple of sample applications, you can try these : https://software.intel.com/en-us/articles/optimizing-simple-opencl-kernels - there are two files there, Modulate.zip and Sobel.zip, right after the videos.  You can then try to use this sample: https://software.intel.com/en-us/articles/getting-the-most-from-opencl-12-how-to-increase-performanc... and try modifying Modulate and Sobel to use zero-copy buffers.

You can use http://www.irfanview.com/ to visualize the results.

Other samples are available here: https://software.intel.com/en-us/intel-opencl-support/code-samples.

Sorry for the confusion.

Ben_Rush
Beginner
368 Views

Robert Ioffe (Intel) wrote:

Sorry for the confusion.

No worries. I'll be pestering you a bit over the next couple days as I'm sure I'll have a lot of questions...so at the end we can consider ourselves even ;)

Robert_I_Intel
Employee
368 Views

Bring it on :)

Ben_Rush
Beginner
368 Views

Robert Ioffe (Intel) wrote:

Bring it on :)

I applaud your energy :) I posted something here about a performance issue I'm seeing. Sorry, but I figured it'd be better to put it into a new thread. Also, damn good tutorials you've put together. Those videos were very useful, especially for someone as new as I. 

 

Robert_I_Intel
Employee
368 Views

Ben,

Hopefully I answered some of your questions in another thread. Glad you found the tutorials useful: I had fun making them :)

Ben_Rush
Beginner
368 Views
Actually I was just thinking to myself how great your response was. Thanks for your time. Respectfully yours,
Reply