Results 1 to 2 of 2

Thread: Segmentation Fault in clCreateProgramwithSource

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2018
    Posts
    10

    Exclamation Segmentation Fault in clCreateProgramwithSource

    Hi,
    I am pretty new to OpenCL.

    I am trying to parallelize the following snippet:
    Code :
    for ( ; i < ncols - radius ; i++)  {
          ppp = ptrrow + i - radius;
          sum = 0.0;
          //for (k = kernel.width-1 ; k >= 0 ; k--)
            //sum += *ppp++ * kernel.data[k];
               sum = ppp[0] * kernel.data[kernel.width-1] + ppp[1] * kernel.data[kernel.width-2]
                        + ppp[2] * kernel.data[kernel.width-3] + ppp[3] * kernel.data[kernel.width-4]
                        + ppp[4] * kernel.data[kernel.width-5] + ppp[5] * kernel.data[kernel.width-6]
                        + ppp[6] * kernel.data[kernel.width-7];
          *ptrout++ = sum;
        }

    I have written the following kernel for the same:

    Code :
    __kernel void convolveImageHoriz(__global float *ppp, __global float *ptrrow, __global float *ptrout, __global float *Kernel, int nrows, int width, int ncols)
    {
        int i = get_global_id(0);
        int radius = width/2;
        float sum;
     
        if (i >= radius && i < nrows-radius)
        {
            ppp = ptrrow + i - radius;
            sum = 0.0;
     
            sum = ppp[0] * Kernel[width-1] + ppp[1] * Kernel[width-2]
                + ppp[2] * Kernel[kernel.width-3] + ppp[3] * Kernel[width-4]
                + ppp[4] * Kernel[width-5] + ppp[5] * Kernel[width-6]
                + ppp[6] * Kernel[width-7];
     
            ptrout[i] = sum;
        }
    }

    I know for a fact that there is some issue in the Kernel as the code runs fine when I run some other Kernel.
    Could someone help?
    Last edited by khronos; 09-14-2018 at 07:17 AM. Reason: Wrap code in code tags.

  2. #2
    Junior Member Newbie AndreyOGL_D3D's Avatar
    Join Date
    Oct 2015
    Posts
    26
    Hi mohitu,
    What GPU do you use?
    What OS do you use?
    Can you attach the minimal simple project where the issue can be reproduced ?

Similar Threads

  1. Segmentation fault
    By genericname in forum OpenGL: Windows
    Replies: 3
    Last Post: 03-11-2012, 10:01 AM
  2. Segmentation fault while using PBO
    By SagoO in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 04-03-2011, 08:03 AM
  3. Segmentation fault
    By SagoO in forum OpenGL: Basic Coding
    Replies: 28
    Last Post: 01-12-2011, 09:45 AM
  4. Segmentation fault
    By kmn2446 in forum OpenGL: Linux
    Replies: 4
    Last Post: 03-16-2004, 08:53 AM
  5. Segmentation fault
    By D1G1T4LL in forum OpenGL: Linux
    Replies: 2
    Last Post: 12-09-2003, 08:23 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean