MCPcopy Index your code
hub / github.com/Syncleus/aparapi / test

Method test

src/test/java/com/aparapi/runtime/IntArray2DTest.java:48–85  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

46
47
48 @Test
49 public void test() {
50 int size = 128;
51 final int count = 3;
52 final int[][] V = new int[count][size];
53 final int[][] totals = new int[count][size];
54
55 //lets fill in V randomly...
56 for (int j = 0; j < count; j++) {
57 for (int i = 0; i < size; i++) {
58 //test number either 0, 1, or 2
59 totals[j][i] = V[j][i] = (i + j) % 3;
60 }
61 }
62
63 final Kernel kernel = new Kernel() {
64 @Override
65 public void run() {
66 int gid = getGlobalId();
67 for(int index = 0; index < count; index++) {
68 totals[index][gid] += gid + 3;
69 }
70 }
71 };
72
73 final Range range = openCLDevice.createRange(size);
74 try {
75 kernel.execute(range);
76
77 for (int index = 0; index < count; index++) {
78 for (int gid = 0; gid < size; gid++) {
79 assertEquals("Testing for index: " + index + " and gid: " + gid, V[index][gid] + gid + 3, totals[index][gid]);
80 }
81 }
82 } finally {
83 kernel.dispose();
84 }
85 }
86}

Callers

nothing calls this directly

Calls 3

executeMethod · 0.95
disposeMethod · 0.95
createRangeMethod · 0.45

Tested by

no test coverage detected