Add vecadd-loop
This is the same kernel as vecadd but repeated in a for-loop many times so that the runtime overhead at the startup is amortized.
This commit is contained in:
13
tests/opencl/vecadd-loop/kernel.cl
Normal file
13
tests/opencl/vecadd-loop/kernel.cl
Normal file
@@ -0,0 +1,13 @@
|
||||
__kernel void vecadd_loop (__global volatile const float *A,
|
||||
__global volatile const float *B,
|
||||
__global volatile float *C)
|
||||
{
|
||||
int gid = get_global_id(0);
|
||||
float sum = 0.;
|
||||
for (int i = 0; i < 500; i++) {
|
||||
// int addr = gid + (i % 2);
|
||||
int addr = gid;
|
||||
C[addr] += A[addr] + B[addr];
|
||||
}
|
||||
// C[gid] = sum;
|
||||
}
|
||||
Reference in New Issue
Block a user