diff -ru clFFT_orig/src/examples/fft1d.c clFFT_custom/src/examples/fft1d.c --- clFFT_orig/src/examples/fft1d.c 2017-04-27 11:55:47.722280825 +0200 +++ clFFT_custom/src/examples/fft1d.c 2017-04-27 11:46:44.134309954 +0200 @@ -20,6 +20,9 @@ /* No need to explicitely include the OpenCL headers */ #include +#include +#include + int main( void ) { cl_int err; @@ -30,9 +33,11 @@ cl_command_queue queue = 0; cl_mem bufX; float *X; + float *X_result; cl_event event = NULL; int ret = 0; - size_t N = 16; + //size_t N = 4*1024*1024; // 16 + size_t N = 8*1024; // 16 char platform_name[128]; char device_name[128]; @@ -43,35 +48,48 @@ /* Setup OpenCL environment. */ err = clGetPlatformIDs( 1, &platform, NULL ); + fprintf( stderr, "(err: %d)after clGetPlatformIDs\n", err ); size_t ret_param_size = 0; err = clGetPlatformInfo(platform, CL_PLATFORM_NAME, sizeof(platform_name), platform_name, &ret_param_size); - printf("Platform found: %s\n", platform_name); + fprintf( stderr, "(err: %d) Platform found: %s\n", err, platform_name); err = clGetDeviceIDs( platform, CL_DEVICE_TYPE_DEFAULT, 1, &device, NULL ); + fprintf( stderr, "(err: %d)after clGetDeviceIDs\n", err ); err = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(device_name), device_name, &ret_param_size); - printf("Device found on the above platform: %s\n", device_name); + fprintf( stderr, "(err: %d)Device found on the above platform: %s\n", err, device_name); + + + cl_uint c1; + err = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, + sizeof(c1), &c1, + &ret_param_size); props[1] = (cl_context_properties)platform; ctx = clCreateContext( props, 1, &device, NULL, NULL, &err ); + fprintf( stderr, "(err: %d) after clCreateContext\n", err ); queue = clCreateCommandQueue( ctx, device, 0, &err ); + fprintf( stderr, "(err: %d)after clCreateCommandQueue\n", err ); /* Setup clFFT. */ clfftSetupData fftSetup; err = clfftInitSetupData(&fftSetup); + fprintf( stderr, "(err: %d)after clfftInitSetupData\n", err ); err = clfftSetup(&fftSetup); + fprintf( stderr, "(err: %d)after clfftSetup\n", err ); /* Allocate host & initialize data. */ /* Only allocation shown for simplicity. */ X = (float *)malloc(N * 2 * sizeof(*X)); + X_result = (float *)malloc(N * 2 * sizeof(*X_result)); /* print input array */ - printf("\nPerforming fft on an one dimensional array of size N = %lu\n", (unsigned long)N); + fprintf( stderr, "\nPerforming fft on an one dimensional array of size N = %lu\n", (unsigned long)N); int print_iter = 0; while(print_iter 5 ) + fprintf( stderr, "\r\n\r\nERROR: found same numbers !!! ... FFT was not executed !!! \r\n\r\n" ); + + /* print output array */ + print_iter = 0; + while(print_iter( gWorkSize.size( ) ), NULL, &gWorkSize[ 0 ], &lWorkSize[ 0 ], numWaitEvents, waitEvents, outEvents ); OPENCL_V( call_status, _T( "clEnqueueNDRangeKernel failed" ) ); +cl_int statusxw; +assert( call_status == CL_SUCCESS ); // All the parameters are valid +call_status = clWaitForEvents( 1, outEvents ); +if( call_status == CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST ) // 1 of the events in the queue failed +{ +fprintf( stderr, "clEnqueueNDRangeKernel failed second... %d params: %d %d %d %d\r\n", call_status, static_cast< cl_uint >( gWorkSize.size( ) ), gWorkSize[ 0 ], lWorkSize[ 0 ], numWaitEvents ); + // Optional: Check if it's the kernel + call_status = clGetEventInfo( *outEvents , CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(statusxw),&statusxw, NULL); + assert( call_status == CL_SUCCESS); + + if(statusxw != CL_COMPLETE ) + fprintf(stderr, "ERROR executing the kernel %d\n", statusxw); +} + + if( fftRepo.pStatTimer ) { diff -ru clFFT_orig/src/library/private.h clFFT_custom/src/library/private.h --- clFFT_orig/src/library/private.h 2017-04-27 11:55:47.726280824 +0200 +++ clFFT_custom/src/library/private.h 2017-04-09 12:21:19.000000000 +0200 @@ -274,6 +274,8 @@ return _T( "CLFFT_VERSION_MISMATCH" ); case CLFFT_INVALID_PLAN: return _T( "CLFFT_INVALID_PLAN" ); + case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: + return _T( "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST" ); default: return _T( "Error code not defined" ); break;