| 249 | } |
| 250 | |
| 251 | void prefixScanTest() |
| 252 | { |
| 253 | TEST_INIT; |
| 254 | |
| 255 | int maxSize = 1024 * 256; |
| 256 | |
| 257 | b3AlignedObjectArray<unsigned int> buf0Host; |
| 258 | b3AlignedObjectArray<unsigned int> buf1Host; |
| 259 | |
| 260 | b3OpenCLArray<unsigned int> buf2CL(g_context, g_queue, maxSize); |
| 261 | b3OpenCLArray<unsigned int> buf3CL(g_context, g_queue, maxSize); |
| 262 | |
| 263 | b3PrefixScanCL* scan = new b3PrefixScanCL(g_context, g_device, g_queue, maxSize); |
| 264 | |
| 265 | int dx = maxSize / NUM_TESTS; |
| 266 | for (int iter = 0; iter < NUM_TESTS; iter++) |
| 267 | { |
| 268 | int size = b3Min(128 + dx * iter, maxSize); |
| 269 | buf0Host.resize(size); |
| 270 | buf1Host.resize(size); |
| 271 | |
| 272 | for (int i = 0; i < size; i++) |
| 273 | buf0Host[i] = 1; |
| 274 | |
| 275 | buf2CL.copyFromHost(buf0Host); |
| 276 | |
| 277 | unsigned int sumHost, sumGPU; |
| 278 | |
| 279 | scan->executeHost(buf0Host, buf1Host, size, &sumHost); |
| 280 | scan->execute(buf2CL, buf3CL, size, &sumGPU); |
| 281 | |
| 282 | buf3CL.copyToHost(buf0Host); |
| 283 | |
| 284 | TEST_ASSERT(sumHost == sumGPU); |
| 285 | for (int i = 0; i < size; i++) |
| 286 | TEST_ASSERT(buf1Host[i] == buf0Host[i]); |
| 287 | } |
| 288 | |
| 289 | delete scan; |
| 290 | |
| 291 | TEST_REPORT("scanTest"); |
| 292 | } |
| 293 | |
| 294 | bool radixSortTest() |
| 295 | { |
no test coverage detected