int SimpleConvolution::verifyResults() { if(verify) { verificationOutput = (cl_uint *) malloc(width * height * sizeof(cl_uint )); CHECK_ALLOCATION(verificationOutput, "Failed to allocate host memory. (verificationOutput)"); /* * reference implementation */ cl_uint2 inputDimensions = {width , height}; cl_uint2 maskDimensions = {maskWidth, maskHeight}; simpleConvolutionCPUReference(verificationOutput, input, mask, width, height, maskWidth, maskHeight); // compare the results and see if they match if(memcmp(output, verificationOutput, height*width*sizeof(cl_uint )) == 0) { std::cout<<"Passed!\n" << std::endl; return SDK_SUCCESS; } else { std::cout<<"Failed\n" << std::endl; return SDK_FAILURE; } } return SDK_SUCCESS; }
int SimpleConvolution::verifyResults(){ float* verificationOutput = (float *) malloc(width * height * sizeof( float )); CHECK_ALLOCATION(verificationOutput, "Failed to allocate host memory. (verificationOutput)"); cl_uint2 inputDimensions = {width , height}; cl_uint2 maskDimensions = {maskWidth, maskHeight}; simpleConvolutionCPUReference(verificationOutput, input, mask, width, height, maskWidth, maskHeight); if(memcmp(output, verificationOutput, height*width*sizeof( float )) == 0) { std::cout<<"Passed!\n" << std::endl; return 0; } else { std::cout<<"Failed\n" << std::endl; return 1; } }