(mode)
| 98 | }); |
| 99 | |
| 100 | function inKernelInstanceSettings(mode) { |
| 101 | function customAdder(a, b) { |
| 102 | return a + b; |
| 103 | } |
| 104 | const gpu = new GPU({ mode }); |
| 105 | const kernel = gpu.createKernel(function (a, b) { |
| 106 | return customAdder(a[this.thread.x], b[this.thread.x]); |
| 107 | }, { |
| 108 | output: [6], |
| 109 | functions: [ |
| 110 | customAdder |
| 111 | ], |
| 112 | }); |
| 113 | |
| 114 | const a = [1, 2, 3, 5, 6, 7]; |
| 115 | const b = [4, 5, 6, 1, 2, 3]; |
| 116 | |
| 117 | const result = kernel(a, b); |
| 118 | |
| 119 | const expected = [5, 7, 9, 6, 8, 10]; |
| 120 | |
| 121 | assert.deepEqual(Array.from(result), expected); |
| 122 | gpu.destroy(); |
| 123 | } |
| 124 | |
| 125 | test('in Kernel instance settings auto', () => { |
| 126 | inKernelInstanceSettings(null); |
no test coverage detected
searching dependent graphs…