nvcc fatal: failed to open output file '/tmp/tmpxft_0000*****'

My NVCC compiler didn’t work from yesterday. Every time I compile a cuda code file, it returns this information as in the title. But I found that with the root account, it work successfuly, only with a ordinary user, it cannot work. I have reinstalled the cuda toolkit, but the problem is still there. And My OS is centos 6.2.
Is anyone knows what the problem is?

nvcc is a compiler driver and does a lot of steps “under the hood”. During this process it creates a variety of temporary files which by default get stored in the /tmp directory on linux.

Apparently whatever user account you are working from does not have the necessary privilege to access files in /tmp You can easily verify this with:

touch /tmp/test_file

and see if it succeeds or gives you an error message (from the non-root account). If you get an error message, you will need to sort out your user privileges.

as a possible work-around, you could specify

nvcc --keep ...

which will make a mess of your current directory, but will not use the default temporary directory.

http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#keeping-intermediate-phase-files

Problem solved, it is the privilege issues of directory ‘/tmp’, the writting privilege is not open for ordinary users. Thank you txbob for your important information.