CUDAPATH is set to /usr/local/cuda by default unless given as environment variable
Make sure static variables are initialised before use.

http://www.parashift.com/c++-faq-lite/static-init-order-on-first-use.html