8 Replies Latest reply: Nov 15, 2012 5:40 PM by nathan1986 RSS

clBuildProgram error with large kernel

cymick Newbie
Currently Being Moderated

I'm working on a program with a rather large kernel, about 400 lines of code, and when I try to compile it from source it doesn't always compile. To give some more technical background I'm working on Windows 7, on a ATI HD 5870, and I'm building my program using VS Express 10. Running from a binary works just fine if I can get it to compile correctly the first time but after making any changes to the kernel it can take one to several tries to get it to build the binary. The errors I get when it doesn't compile vary as well. About half the time I get a -11 build error with no build log. Alternatively I will get a memory allocation error "Unhandled exception at ...." Any insights into this would be greatly appreciated.

  • Re: clBuildProgram error with large kernel
    binying Novice
    Currently Being Moderated

    How about trying the tool called Kernel Analyzer?

  • Re: clBuildProgram error with large kernel
    cymick Newbie
    Currently Being Moderated

    I've been trying to narrow down the problem with the KernelAnalyzer2 program and here is what I've found. My program is propagating some system through time and using a fourth order Runge-Kutta algorithm as part of the kernel. As such it has to call upon some equations multiple times to calculate velocities and whatnot, those equations here are D_Theta and D_Phi. When it calls them only the first time everything works out fine and it compiles (in the sample code below I have the other three calls commented out, this version compiles). When I try to have it call them the second, third and fourth times it won't compile the kernel and it gives no error.

     

    void RK4(Parameters mp, float* DT, float j, float* theta,  float* phi, float* time)

    {

    float th = *theta;

    float ph = *phi;

    float t = *time;

    float dt = *DT;

     

    float k11, k12, k21, k22, k31, k32, k41, k42;

    k11 = k12 = k21 = k22 = k31 = k32 = k41 = k42 = 0;

     

    float dtheta = 0;

    float dphi = 0;

     

    float tth = th;

    float tph = ph;

     

    k11 = D_Theta(mp, j, tth, tph);

    k12 = D_Phi(mp, j, tth, tph);

     

    tth = th + k11 * dt / 2;

    tph = ph + k12 * dt / 2;

    //k21 = D_Theta(mp, j, tth, tph);

    //k22 = D_Phi(mp, j, tth, tph);

     

    tth = th + k21 * dt / 2;

    tph = ph + k22 * dt / 2;

    //k31 = D_Theta(mp, j, tth, tph);

    //k32 = D_Phi(mp, j, tth, tph);

     

    tth = th + k31 * dt;

    tph = ph + k32 * dt;

    //k41 = D_Theta(mp, j, tth, tph);

    //k42 = D_Phi(mp, j, tth, tph);

     

    dtheta = (k11 + 2 * k21 + 2 * k31 + k41) * dt / 6;

    dphi = (k12 + 2 * k22 + 2 * k32 + k42) * dt / 6;

     

    th += dtheta;

    ph += dphi;

    *theta = th;

    *phi = ph;

    *time = t;

    }

More Like This

Legend

  • Correct Answers - 4 points
  • Helpful Answers - 2 points