Results 1 to 6 of 6

Thread: exponential on input value causes CL_BUILD_PROGRAM_FAILURE

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    11

    exponential on input value causes CL_BUILD_PROGRAM_FAILURE

    Hi everyone,

    I have a simple test kernel with input/output buffers declared as follows:

    Code :
    // OpenCL Kernel Function for Hodgkin Huxley integration step
    kernel void Exponential(global const double* V_in,  global double* V_out)
    {
       // get index into global data array
       int iGID = get_global_id(0);
     
       double value = (double) V_in[iGID];
       double exponential = (double) exp((double) value);
       V_out[iGID] = exponential;
    }

    My problem is that the code above raises a CL_BUILD_PROGRAM_FAILURE with no details.

    If I hardcode the value in the kernel as follows I don't get the error:

    Code :
    double value = (double) 10;
    double exponential = (double) exp((double) value);

    There is probably something very basic that I am missing, any help appreciated!

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: exponential on input value causes CL_BUILD_PROGRAM_FAILU

    A build failure with no information in the log usually means you've found a compiler bug. The only thing wrong with your code is that it's missing this line of code at the beginning:

    Code :
    #pragma OPENCL EXTENSION cl_khr_fp64 : enable

    You must always use this pragma if your kernel is using double-precision floats.

    Also, there are lots of unnecessary casts in the kernel. I don't think they are the cause of the build failure but it's worth trying this other version -- it is identical semantically to the code you've posted:

    Code :
    #pragma OPENCL EXTENSION cl_khr_fp64 : enable
     
    // OpenCL Kernel Function for Hodgkin Huxley integration step
    kernel void Exponential(global const double* V_in,  global double* V_out)
    {
       // get index into global data array
       size_t iGID = get_global_id(0);
     
       V_out[iGID] = exp(V_in[iGID]);
    }
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  3. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    11

    Re: exponential on input value causes CL_BUILD_PROGRAM_FAILU

    Thanks a lot for your prompt reply David,

    in the meantime I found out that if I replace the doubles with floats it works like a charm (without any casts, I had the casts there because - even with hardcoded values - the compiler was complaining about multiple declarations of the exp signature).

    I'll now try to add the #pragma and report back soon!

    Thanks again!

  4. #4
    Junior Member
    Join Date
    Feb 2011
    Posts
    11

    Re: exponential on input value causes CL_BUILD_PROGRAM_FAILU

    For some reason even with the #pragma I am still getting the same. I can live with the floats for now but I'd like to understand why this is happening.

    Here is the full error (I am using jocl, it's showing build logs on both CPU and GPU, both empty):
    Code :
    Exception in thread "main" com.jogamp.opencl.CLException$CLBuildProgramFailureException: 
    CLDevice [id: 16914944 name: Radeon HD 4850 type: GPU profile: FULL_PROFILE] build log:
        <empty>
    CLDevice [id: 16909312 name: Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz type: CPU profile: FULL_PROFILE] build log:
        <empty> [error: CL_BUILD_PROGRAM_FAILURE]
    	at com.jogamp.opencl.CLException.newException(CLException.java:78)
    	at com.jogamp.opencl.CLProgram.build(CLProgram.java:366)
    	at com.jogamp.opencl.CLProgram.build(CLProgram.java:205)
    	at MyOpenCLTest.main(MyOpenCLTest.java:75)

  5. #5
    Senior Member
    Join Date
    May 2010
    Location
    Toronto, Canada
    Posts
    845

    Re: exponential on input value causes CL_BUILD_PROGRAM_FAILU

    I shouldn't have taken this for granted. Does your GPU actually support doubles? Check that glGetDeviceInfo(CL_DEVICE_EXTENSIONS) to see whether cl_khr_fp64 is exposed.
    Disclaimer: Employee of Qualcomm Canada. Any opinions expressed here are personal and do not necessarily reflect the views of my employer. LinkedIn profile.

  6. #6
    Junior Member
    Join Date
    Feb 2011
    Posts
    11

    Re: exponential on input value causes CL_BUILD_PROGRAM_FAILU

    Yep - it looks like my GPU [ATI HD 4850 http://goo.gl/jb7v2] does not support double-precision. Shoot!

    Good thing I can do without for now -thanks for all the help!

Similar Threads

  1. Why only input
    By Gedolo in forum StreamInput - General
    Replies: 9
    Last Post: 05-13-2012, 09:41 AM
  2. Replies: 6
    Last Post: 02-27-2011, 02:49 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
  •