OptiX Error: Unknown error

I updated my ubuntu version to 14.04. Previously I was running optix using optimus since I have dual graphic cards on my system. But since the update I installed nvidia-prime and have changed the default card to be the NVIDIA Graphic card and all other graphic program like games on steam are working fine but the samples for Optix are giving me run time exceptions on context::create() function and it is unable to create the context. I am getting the following error:

OptiX Error: Unknown error

on the line

RT_CHECK_ERROR( rtContextCreate( &context ) );

since it is unable to create the context so I cannot even check the number of devices detected by optix. I have set the default graphic card to NVIDIA one in the nvidia-settings but still its not working. Can anyone help me on this.

First off, are you having problems with CUDA programs generally, or just with OptiX? Can you run the precompiled samples that come with the CUDA toolkit? Also try running nvidia-smi to see if it recognizes any of your devices.

Next, can you run the precompiled samples that come with OptiX?

Finally, can you run any of the context-free OptiX commands? I usually run this method before creating my context:

static void printDeviceInfo() {
	unsigned int version, device_count, i, multiprocessor_count, threads_per_block, clock_rate, texture_count, timeout_enabled, tcc_driver, cuda_device;
	unsigned int compute_capability[2];
	char device_name[128];
	RTsize memory_size;

	rtGetVersion( &version );
	rtDeviceGetDeviceCount( &device_count );
	if ( !device_count ) {
		fprintf(stderr, "A supported NVIDIA GPU could not be found for OptiX %i.\n", version);
		exit(1);
	}
	fprintf(stderr, "Starting OptiX %i on %i devices:\n", version, device_count);

	for (i = 0; i < device_count; i++) {
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_NAME, sizeof(device_name), &device_name );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, sizeof(multiprocessor_count), &multiprocessor_count );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, sizeof(threads_per_block), &threads_per_block );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_CLOCK_RATE, sizeof(clock_rate), &clock_rate );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_TOTAL_MEMORY, sizeof(memory_size), &memory_size );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_MAX_HARDWARE_TEXTURE_COUNT, sizeof(texture_count), &texture_count );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY, sizeof(compute_capability), &compute_capability );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_EXECUTION_TIMEOUT_ENABLED, sizeof(timeout_enabled), &timeout_enabled );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_TCC_DRIVER, sizeof(tcc_driver), &tcc_driver );
		rtDeviceGetAttribute( i, RT_DEVICE_ATTRIBUTE_CUDA_DEVICE_ORDINAL, sizeof(cuda_device), &cuda_device );
		fprintf(stderr, "Device %u: %s with %u multiprocessors, %u threads per block, %u kHz, %u bytes global memory, %u hardware textures, compute capability %u.%u, timeout %sabled, Tesla compute cluster driver %sabled, cuda device %u.\n",
			i, device_name, multiprocessor_count, threads_per_block, clock_rate, memory_size, texture_count, compute_capability[0], compute_capability[1], timeout_enabled ? "en" : "dis", tcc_driver ? "en" : "dis", cuda_device);
	}
}