| 532 | } |
| 533 | |
| 534 | void runAutoTest(int argc, char **argv, const char *dump_filename, eFilterMode filter_mode) |
| 535 | { |
| 536 | cudaDeviceProp deviceProps; |
| 537 | |
| 538 | int devID = findCudaDevice(argc, (const char **)argv); |
| 539 | |
| 540 | checkCudaErrors(cudaGetDeviceProperties(&deviceProps, devID)); |
| 541 | |
| 542 | printf("[%s] (automated testing w/ readback)\n", sSDKsample); |
| 543 | printf("CUDA device [%s] has %d Multi-Processors\n", deviceProps.name, deviceProps.multiProcessorCount); |
| 544 | |
| 545 | loadImageData(argc, argv); |
| 546 | |
| 547 | uchar4 *d_output; |
| 548 | checkCudaErrors(cudaMalloc((void **)&d_output, imageWidth * imageHeight * 4)); |
| 549 | unsigned int *h_result = (unsigned int *)malloc(width * height * sizeof(unsigned int)); |
| 550 | |
| 551 | printf("AutoTest: %s Filter Mode: <%s>\n", sSDKsample, sFilterMode[g_FilterMode]); |
| 552 | |
| 553 | render(imageWidth, imageHeight, tx, ty, scale, cx, cy, blockSize, gridSize, filter_mode, d_output); |
| 554 | |
| 555 | // check if kernel execution generated an error |
| 556 | getLastCudaError("Error: render (bicubicTexture) Kernel execution FAILED"); |
| 557 | checkCudaErrors(cudaDeviceSynchronize()); |
| 558 | |
| 559 | cudaMemcpy(h_result, d_output, imageWidth * imageHeight * 4, cudaMemcpyDeviceToHost); |
| 560 | |
| 561 | sdkSavePPM4ub(dump_filename, (unsigned char *)h_result, imageWidth, imageHeight); |
| 562 | |
| 563 | checkCudaErrors(cudaFree(d_output)); |
| 564 | free(h_result); |
| 565 | } |
| 566 | |
| 567 | #if USE_BUFFER_TEX |
| 568 | // fragment program for reading from buffer texture |
no test coverage detected