ramdisk for /tmp to speed compile? can nvcc use /dev/shm instead of /tmp

Both Ubuntu and Fedora enable /dev/shm by default as a filesystem in RAM. Is there any way to tell nvcc to use this folder for scratch space rather than /tmp in order to speed compile times?

Usually, compilers use the TMPDIR environment variable, if set, to store the temporary files. What about trying it?

$ nvcc -c conflicts.cu

$ TMPDIR=/foo nvcc -c conflicts.cu

nvopencc ERROR: $TMPDIR does not exist: /foo