Question

Below is my kernel, but when i wanna multiply or do other operations with two values which are defined by #define keyword and assign it to an argument of the kernel i get an error with error status -48.(Invalid kernel.)Is it not possible to multiply these or am i doing something else wrong?

#define cl_sizeX 1024;
#define pi 3.1415926535897;
#define N 1024;
#define M 1024;
#define lambda 632e-9;//632e-9;
#define X 12.1e-6;

__kernel void helloworld(__global char* in, __global char* out)
{
    int num = get_global_id(0);
    out[num] = in[num] + 1;
}

__kernel void multiply_arrays(__global int* first, __global int* second, __global int* out_array)
{
    int num = get_global_id(0);
    out_array[num] = first[num] * second[num];
}
__kernel void create_library(__global float* z0){

    //Variable definitions

    int a = get_global_id(0);
    int i1 = get_global_id(1);
    int i2 = get_global_id(2);

    //z0[a] = ((N*pow(X, 2)) / lambda) + (a - 1)*((N*pow(X, 2)) / (100 * lambda));
    z0[a] = N*X; // This is where i get error 

When i assign z0[a] = N; i don't get an error and couldn't figure it out. I use Windows 8.1 and Visual Studio 13 for coding.

Was it helpful?

Solution

If you remove the ; after all the #define statements the kernel will compile.

OTHER TIPS

You are assigning a double to a float which could be raising an error in the compiler.

Use clGetProgramBuildInfo with CL_PROGRAM_BUILD_LOG to get the actual clBuildProgram output from the compiler which will give you a better idea of the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top