Mixed OpenCL/Cuda? Is it possible in a single application?

I have a fair amount of legacy Cuda code wrapped up in a single application (for radio signal processing, as it happens). I am interested in adding new functionality without doing a complete rewrite, especially since the cufft libraries have not, as far as I know, been ported to OpenCL yet.

I have been trying to get the application to also create an OpenCL context so I could do new development in OpenCL. When I do, I get a error code from clBuildProgram of 1, which is not documented in the API spec or anywhere I’ve found in the programming guides (the errors defined in cl.h are all negative).

My first question is, should I expect to be able to make OpenCL calls and Cuda calls from within a single application on a single-GPU system? And my second is, if sp, what does error code 1 suggest might be my problem?

I’m running Ubuntu 9.10, drivers 190.29, with a GTX 260M.

I receive the same error (1) if I try to create a context on the CPU. I assume it’s a bug.

You can try this to see your build error:


ciErrNum = clBuildProgram(hProgram, 0, NULL, NULL, NULL, NULL);

if (ciErrNum != CL_SUCCESS)


	std::cerr << "Error: Failed to build program " << ciErrNum << std::endl;

	char buildLog[10240];

        	clGetProgramBuildInfo(hProgram, aDevices[0], CL_PROGRAM_BUILD_LOG, sizeof(buildLog), buildLog, NULL);