@@ -37,11 +37,8 @@ See [TypeScript declarations](/index.d.ts) for more details.
3737 ```
38382 . Fetch the CL control objects:
3939 ```ts
40- const platform = cl.getPlatformIDs()[0];
41- const devices = cl.getDeviceIDs(platform, cl.DEVICE_TYPE_ALL);
42- const context = cl.createContext([cl.CONTEXT_PLATFORM, platform], devices);
43- const device = cl.getContextInfo(context, cl.CONTEXT_DEVICES)[0];
44- const queue = cl.createCommandQueue(context, device, null);
40+ const { context, device } = cl.quickStart(); // see /index.js
41+ const queue = cl.createCommandQueue(context, device);
4542 ```
46433 . Prepare the data input/output buffers:
4744 ```ts
@@ -67,7 +64,8 @@ See [TypeScript declarations](/index.d.ts) for more details.
67644 . Create a valid CL program, e.g. from source:
6865 ```ts
6966 const program = cl.createProgramWithSource(context, `
70- __kernel void vadd(__global int *a, __global int *b, __global int *c, uint num) {
67+ __kernel
68+ void vadd(__global int *a, __global int *b, __global int *c, uint num) {
7169 size_t i = get_global_id(0);
7270 if (i < num) {
7371 c[i] = a[i] + b[i];
@@ -92,7 +90,7 @@ See [TypeScript declarations](/index.d.ts) for more details.
9290 // Do the work
9391 cl.enqueueWriteBuffer(queue, bufferA, true, 0, BYTE_SIZE, arrayA);
9492 cl.enqueueWriteBuffer(queue, bufferB, true, 0, BYTE_SIZE, arrayB);
95- cl.enqueueNDRangeKernel(queue, kernel, 1, null, [BUFFER_SIZE], null );
93+ cl.enqueueNDRangeKernel(queue, kernel, 1, null, [BUFFER_SIZE]);
9694 cl.enqueueReadBuffer(queue, bufferC, true, 0, BYTE_SIZE, arrayC);
9795 ```
98967 . See if it worked:
0 commit comments