When I try to compile PyTorch from source, I encountered this issue (CUDA 8.0, cuDNN v5 and python3.5).  Thank you!
/cm/shared/package/gcc/4.9.3/bin/ld: cannot find -lcuda
/cm/shared/package/gcc/4.9.3/bin/ld: skipping incompatible /lib/…/lib/libpthread.so when searching for -lpthread
/cm/shared/package/gcc/4.9.3/bin/ld: skipping incompatible /usr/lib/…/lib/libpthread.so when searching for -lpthread
collect2: error: ld returned 1 exit status
error: command ‘gcc’ failed with exit status 1