Results 1 to 4 of 4

Thread: error when use clCompileProgram and clLinkProgram

  1. #1

    error when use clCompileProgram and clLinkProgram

    error when use clCompileProgram and clLinkProgram

    in OpenCL1.2,I try to use clCompileProgram and clLinkProgram instead of using clBuildProgram.
    but I failed.

    I write a simple kernel of Matrix Multiplication ,and divided it to three parts.

    //the original kernel
    int f(int x, int y)
    {
    return x/y ;

    }

    int g(int x, int y)
    {
    return x%y ;

    }
    __kernel void
    multiply(__global float* array_A, __global float* array_B, __global float* array_D,int M)
    {

    int global_id = get_global_id(0);
    float buffer =0;
    int line = f(global_id ,M);
    int col = g(global_id ,M);
    for(int i=0;i<M;i++)
    {
    buffer += array_A[line*M+i] *array_B[i*M+col];


    }
    array_D[global_id] =buffer;

    }
    //-------------
    it is run ok ,when i use clBuildProgram.
    status = clBuildProgram(program,1,&devices,NULL,NULL,NULL);
    printf("clBuildProgram status =%d\n",status);
    if(status != CL_SUCCESS)
    {
    printf("Error:Building program\
    (clBuildProgram)\n");
    return EXIT_FAILURE;
    }
    //--------------
    and i divided the kernel to three parts.
    multi.cl multi2.h multi3.h
    //multi.cl
    #include "multi2.h"
    #include "multi3.h"

    __kernel void
    multiply(__global float* array_A, __global float* array_B, __global float* array_D,int M)
    {

    int global_id = get_global_id(0);
    float buffer =0;
    int line = f(global_id ,M);
    int col = g(global_id ,M);
    for(int i=0;i<M;i++)
    {
    buffer += array_A[line*M+i] *array_B[i*M+col];


    }
    array_D[global_id] =buffer;

    }

    //multi2.h
    int f(int x, int y)
    {
    return x/y ;

    }



    //multi3.h
    int g(int x, int y)
    {
    return x%y ;

    }

    //--------------

    I use clCreateProgramWithSource to got three program ,
    program_multi, program_multi2, program_multi3 corresponding multi.cl ,multi2.h ,multi3.h

    cl_program input_headers[2] ={ program_multi2 ,program_multi3};
    const char * input_header_names[2] = {"multi2.h" ,"multi3.h" };

    status=clCompileProgram(program_multi,
    0,
    NULL,
    0,
    2,
    input_headers,
    input_header_names,
    NULL,NULL);
    printf("clCompileProgram status =%d\n",status);

    but it error .the return status is -11 ,means CL_BUILD_PROGRAM_FAILURE
    I am trying many times ,but still fail .
    the first parameters of clCompileProgram ,is it right .
    there are little formation about these two functions ,so I try to get help from this forum .
    Thanks !

  2. #2

    Re: error when use clCompileProgram and clLinkProgram

    I solve the problem ,it is my computer's problem. I change a computer and the program is OK.
    my computer is too old .

  3. #3

    Re: error when use clCompileProgram and clLinkProgram

    I still don't know why the program failed on my computer ,but can run OK on the other computer .

    my computer's cpu is Intel T6670 ,and gpu is GeForce GT 220M ,the Software installed correctly .

    the other computer's hardware : AMD cpu ,Radeon 9500 gpu

    Is the cause of the hardware ?

    thanks

  4. #4

    Re: error when use clCompileProgram and clLinkProgram

    There should be no problem running on the CPU, but neither of those GPU's are supported by our software stack.

Similar Threads

  1. Replies: 1
    Last Post: 09-24-2007, 03:02 AM
  2. about X Error: GLXBadDrawable 158 Error
    By Ulimit77 in forum OpenGL ES
    Replies: 0
    Last Post: 06-05-2005, 04:19 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
  •  
Proudly hosted by Digital Ocean