Locate CUDA installation on Linux
What's the best way? Here are my solutions:
开发者_JAVA百科echo $PATH | sed "s/:/\n/g" | grep "cuda/bin" | sed "s/\/bin//g" | head -n 1
which nvcc | sed "s/\/bin\/nvcc//"
which nvcc | head -c -10
They are all PATH-based. One could locate libraries instead. It would be more robust if there are no CUDA paths in PATH.
I'm using this in a Makefile.
How does something based onldconfig -p | grep libcuda
sound ? Considering an appropriate ldconfig setup is explicitly advised at the end of the installation of the CUDA toolkit, it should do the trick without path nicely, I think.
精彩评论