Open ysh329 opened 4 years ago
__kernel void elementwise_add_buffer(__global const float* x_data, __global const float* y_data, __global float* out_data,
const int batch, const int channels, const int num) {
const int c = get_global_id(0); // c: [0, channels)
const int b = get_global_id(1); // b: [0, batch)
if ((c >= channels) || (b >= batch)) {
return;
}
const int offset = (b * channels + c) * num;
const float* din_ptr = x_data + offset;
const float diny_data = y_data[c];
float* dout_ptr = out_data + offset;
for (int n = 0; n < num; ++n) { // n: [0, h*w)
*dout_ptr = *din_ptr + diny_data;
++dout_ptr;
++din_ptr;
}
}
[==========] Running 8 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 8 tests from cl_test
[ RUN ] cl_test.runtime_test
[F 7/18 9:42:47.716 ...opencl/cl_wrapper.cc InitFunctions:164] Check failed: clCreateCommandQueueWithProperties_ != nullptr: Cannot load clCreateCommandQueueWithProperties!