Invalid OpenCL Address Space

I'm new to OpenCL, and I'm trying to get the next kernel to work. When I run the program, I get an error message while building the kernel program. A more specific error is this:

Error: Failed to build program executable! <program source>:19:64: error: invalid address space for argument to __kernel function __kernel void accelarate_flow(__global const t_param params, ^ 

Here you can see the core. In the beginning I, although it was because I did not have the structures defined inside the kernel, but even when I added them, the problem still exists. What am I doing wrong here?

 const char *accelerate_flow_kernel_source = #pragma OPENCL EXTENSION cl_khr_fp64 : enable typedef struct { int nx; int ny; int maxIters; int reynolds_dim; double density; double accel; double omega; } t_param; typedef struct { double speeds[9]; } t_speed; __kernel void accelarate_flow(__global const t_param params, __global const int* obstacles, __global t_speed* cells, const unsigned int count) { int pos = get_global_id(0); if(pos >= count || pos % params.nx != 0) return; double w1,w2; w1 = params.density * params.accel / 9.0; w2 = params.density * params.accel / 36.0; if(!obstacles[pos] && (cells[pos].speeds[3] - w1) > 0.0 && (cells[pos].speeds[6] - w2) > 0.0 && (cells[pos].speeds[7] - w2) > 0.0 ) { cells[pos].speeds[1] += w1; cells[pos].speeds[5] += w2; cells[pos].speeds[8] += w2; cells[pos].speeds[3] -= w1; cells[pos].speeds[6] -= w2; cells[pos].speeds[7] -= w2; } } 
+6
source share
1 answer

global is a pointer identifier ( address ), so you need to go through global const t_param* params .

+4
source

Source: https://habr.com/ru/post/912433/


All Articles