int SimpleImage::run() { if(!byteRWSupport) return SDK_SUCCESS; /* create and initialize timers */ int timer = sampleCommon->createTimer(); sampleCommon->resetTimer(timer); sampleCommon->startTimer(timer); std::cout << "Executing kernel for " << iterations << " iterations" <<std::endl; std::cout << "-------------------------------------------" << std::endl; for(int i = 0; i < iterations; i++) { /* Set kernel arguments and run kernel */ if(runCLKernels() != SDK_SUCCESS) return SDK_FAILURE; } sampleCommon->stopTimer(timer); /* Compute kernel time */ kernelTime = (double)(sampleCommon->readTimer(timer)) / iterations; /* write the output image to bitmap file */ if(writeOutputImage(OUTPUT_IMAGE) != SDK_SUCCESS) { return SDK_FAILURE; } return SDK_SUCCESS; }
int BoxFilterSeparable::run() { if(!byteRWSupport) { return SDK_SUCCESS; } for(int i = 0; i < 2 && iterations != 1; i++) { // Set kernel arguments and run kernel if(runCLKernels() != SDK_SUCCESS) { return SDK_FAILURE; } } std::cout << "Executing kernel for " << iterations << " iterations" <<std::endl; std::cout << "-------------------------------------------" << std::endl; // create and initialize timers int timer =sampleTimer->createTimer(); sampleTimer->resetTimer(timer); sampleTimer->startTimer(timer); for(int i = 0; i < iterations; i++) { // Set kernel arguments and run kernel if(runCLKernels() != SDK_SUCCESS) { return SDK_FAILURE; } } sampleTimer->stopTimer(timer); // Compute kernel time kernelTime = (double)(sampleTimer->readTimer(timer)) / iterations; // write the output image to bitmap file if(writeOutputImage(OUTPUT_IMAGE) != SDK_SUCCESS) { return SDK_FAILURE; } return SDK_SUCCESS; }
int URNG::run() { cl_int status = 0; if(!byteRWSupport) { return SDK_SUCCESS; } // Warm up for(int i = 0; i < 2 && iterations != 1; i++) { // Set kernel arguments and run kernel if(runCLKernels() != SDK_SUCCESS) { return SDK_FAILURE; } } std::cout << "Executing kernel for " << iterations << " iterations" <<std::endl; std::cout << "-------------------------------------------" << std::endl; // create and initialize timers int timer = sampleTimer->createTimer(); sampleTimer->resetTimer(timer); sampleTimer->startTimer(timer); for(int i = 0; i < iterations; i++) { // Set kernel arguments and run kernel if(runCLKernels() != SDK_SUCCESS) { return SDK_FAILURE; } } sampleTimer->stopTimer(timer); // Compute kernel time kernelTime = (double)(sampleTimer->readTimer(timer)) / iterations; // write the output image to bitmap file status = writeOutputImage(OUTPUT_IMAGE); CHECK_ERROR(status , SDK_SUCCESS, "Write Output Image"); return SDK_SUCCESS; }
int BoxFilterGLSeparable::run() { if(!byteRWSupport) return SDK_SUCCESS; /* create and initialize timers */ int timer = sampleCommon->createTimer(); sampleCommon->resetTimer(timer); sampleCommon->startTimer(timer); if(!quiet) { std::cout << "Executing kernel for " << iterations << " iterations" <<std::endl; std::cout << "-------------------------------------------" << std::endl; } for(int i = 0; i < iterations; i++) { /* Set kernel arguments and run kernel */ if(runCLKernels() != SDK_SUCCESS) return SDK_FAILURE; } sampleCommon->stopTimer(timer); /* Compute kernel time */ kernelTime = (double)(sampleCommon->readTimer(timer)) / iterations; if(!verify && !quiet) { std::cout << "\nPress key w to increase the filter size \n"; std::cout << "Press key s to decrease the filter size \n"; std::cout << "Press ESC key to quit \n"; glutMainLoop(); } /* write the output image to bitmap file */ if(writeOutputImage(OUTPUT_SEPARABLE_IMAGE) != SDK_SUCCESS) { return SDK_FAILURE; } return SDK_SUCCESS; }