You can always try to set the environment variable CUDA_HOME. By the way, one easy way to check if torch is pointing to the right path is
from torch.utils.cpp_extension import CUDA_HOME
print(CUDA_HOME) # by default it is set to /usr/local/cuda/