Results 1 to 6 of 6

Thread: Floating point exception on simple kernel

  1. #1
    Junior Member
    Join Date
    Apr 2012
    Posts
    6

    Floating point exception on simple kernel

    Hello everyone. I'm in my first steps with OpenCL and I have the following problem which I cannot understand at all why is happening.

    I have a simple kernel:
    Code :
    #pragma OPENCL EXTENSION cl_khr_fp64 : enable
    typedef struct
    {
      double speeds[9];
    } t_speed;
     
    __kernel void george(__global const t_speed* cells,
                       __global double*  result,
                         const unsigned int n)
    {
      int j, i = get_global_id(0);
      if(i >= n) return;
      result[i] = 0;
      for(j=0; j<9; j++)
        result[i] += cells[i].speeds[j];
    }

    which when I execute I get a "Floating point exception". Can anyone explain to me please why should I get such an error?

  2. #2
    Junior Member
    Join Date
    Apr 2012
    Posts
    6

    Re: Floating point exception on simple kernel

    Problem solved. It had nothing to do with the kernel after all.

  3. #3
    Junior Member
    Join Date
    Apr 2012
    Posts
    1

    Re: Floating point exception on simple kernel

    Hi gkaran,
    Can you tell what was the problem and solution with the floating point exception you had (if it was related to OpenCL)?
    Thank you.

  4. #4
    Junior Member
    Join Date
    Apr 2012
    Posts
    6

    Re: Floating point exception on simple kernel

    Yeah, the problem was with the clEnqueueNDRangeKernel call. The global work size was not divisible by the local work size.

  5. #5
    Junior Member
    Join Date
    Nov 2012
    Posts
    4

    Re: Floating point exception on simple kernel

    I'm having a similar problem,

    Code :
    __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
     
    __kernel void masking_image( __read_only image2d_t srcImg, __write_only image2d_t dstImg,__global const float *mask, int width, int height)
    {
    }

    Kernel is empty at this moment.

    size_t LWS_IMAGE[2] = {1,1};
    size_t GWS_IMAGE[2] = {16,16};

    printf("LWS : %ldx%ld, GWS : %ldx%ld\n", LWS_IMAGE[0],LWS_IMAGE[1], GWS_IMAGE[0], GWS_IMAGE[1]);
    }
    Code :
    void exec_opencl_image(int width, int height, unsigned char* input, unsigned char* output, float *mask)
    {
      cl_int ret=0;
      size_t Offset[2] = {1,1};
      clSetKernelArg(ckKernel[1], 0, sizeof(cl_mem), (void *)&cmDevImageInput); CheckFN(ret);
      clSetKernelArg(ckKernel[1], 1, sizeof(cl_mem), (void *)&cmDevImageOutput); CheckFN(ret);
      clSetKernelArg(ckKernel[1], 2, sizeof(cl_mem), (void *)&cmDevMask); CheckFN(ret);
      clSetKernelArg(ckKernel[1], 3, sizeof(int), (void *)&width); CheckFN(ret);
      clSetKernelArg(ckKernel[1], 4, sizeof(int), (void *)&height); CheckFN(ret);
     
      //Just to make sure it's divisible
      size_t LWS_IMAGE[2] = {1,1};
      size_t GWS_IMAGE[2] = {16,16};
     
      //Where I'm having "Floating-point exception"
      ret = clEnqueueNDRangeKernel(cqCommandQueueGPU, ckKernel[1], 2, Offset, GWS_IMAGE,LWS_IMAGE, 0, NULL,NULL); CheckFN(ret);
     
      const size_t image_origin[3] = {0,0,0};
      //const size_t host_origin[3] = {0,0,0};
      const size_t region[3] = {width,height,1};
      //ret = clEnqueueReadImage(cqCommandQueueGPU, cmDevImageOutput, CL_TRUE, image_origin,region,0,0,output, NULL, 0,NULL); CheckFN(ret);
    }

    Any headups? I'm stuck in here for two days, and no luck with digging forums and googling~ Original image i'm using is 1920x1080x3.

    Thanks in advance.

  6. #6
    Junior Member
    Join Date
    Nov 2012
    Posts
    4

    Re: Floating point exception on simple kernel

    my LWS_IMAGE and RWS_IMAGE were NULL.... somehow...my bad

Similar Threads

  1. Replies: 0
    Last Post: 03-31-2010, 11:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •