forked from ProjectPhysX/OpenCL-Wrapper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkernel.cpp
More file actions
13 lines (7 loc) · 691 Bytes
/
kernel.cpp
File metadata and controls
13 lines (7 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "kernel.hpp" // note: unbalanced round brackets () are not allowed and string literals can't be arbitrarily long, so periodically interrupt with )+R(
string opencl_c_container() { return R( // ########################## begin of OpenCL C code ####################################################################
kernel void add_kernel(global float* A, global float* B, global float* C) { // equivalent to "for(uint n=0u; n<N; n++) {", but executed in parallel
const uint n = get_global_id(0);
C[n] = A[n]+B[n];
}
);} // ############################################################### end of OpenCL C code #####################################################################