Cuda 6.5 on Ubuntu 14.04, code 46 cudaErrorDevicesUnavailable for K40

Hi,

I installed using .deb packages both driver 340.24 and Cuda Toolkit 6.5 on Ubuntu 14.04 x86_64.

When I run nvidia-smi I can correctly see the only GPU installed - Tesla K40c - active and no process running.

In the CUDA toolkit samples the deviceQuery correctly reports the information on the K40.
Any other sample or code return the following error:

CUDA error at main.cpp code=46(cudaErrorDevicesUnavailable) …

Any Idea?

Many thanks,
D