Skip to content

Commit a0ef6b7

Browse files
committed
Update type docs
1 parent 686da9f commit a0ef6b7

File tree

9 files changed

+398
-222
lines changed

9 files changed

+398
-222
lines changed

examples/saxpy.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ const queue = cl.createCommandQueue(context, device, cl.QUEUE_PROFILING_ENABLE);
2828

2929
const saxpyKernelSource = `
3030
__kernel
31-
void saxpy_kernel(float alpha,
31+
void saxpy_kernel(
32+
float alpha,
3233
__global float *A,
3334
__global float *B,
3435
__global float *C
3536
) {
3637
int idx = get_global_id(0);
37-
C[idx] = alpha* A[idx] + B[idx];
38+
C[idx] = alpha * A[idx] + B[idx];
3839
}
3940
`;
4041

@@ -84,10 +85,12 @@ const readEvent = cl.enqueueReadBuffer(
8485

8586
cl.waitForEvents([readEvent]);
8687

88+
const valueActual = C[VECTOR_SIZE - 1];
89+
const valueExpected = 2 * (VECTOR_SIZE - 1) + 1;
8790
console.log(
8891
`C[${VECTOR_SIZE - 1}] =`,
89-
C[VECTOR_SIZE - 1],
90-
C[VECTOR_SIZE - 1] === (2 * (VECTOR_SIZE - 1) + 1) ? '(correct!)' : '(wrong!)',
92+
valueActual,
93+
valueActual === valueExpected ? '(correct!)' : `(expected ${valueExpected})`,
9194
);
9295

9396
// get all event statistics

0 commit comments

Comments
 (0)