I know that I can install Cuda with the following:
wget http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run chmod +x cuda_7.0.28_linux.run ./cuda_7.0.28_linux.run -extract=`pwd`/nvidia_installers cd nvidia_installers sudo ./NVIDIA-Linux-x86_64-346.46.run sudo modprobe nvidia sudo ./cuda-linux64-rel-7.0.28-19326674.run
Just wondering if I can install Cuda without root?
Thanks,
You can install using conda with the following command.
But you need to have prior accesss to the device(GPU)
You can install CUDA and compile programs, but you won't be able to run them for a lack of device access.
Thank you very much for the hints in the question! I just want to complete it with an approach that worked for me, also inspired in this gist and that hopefully helps in situations where a valid driver is installed, and installing a more recent CUDA on Linux without root permissions is still needed.
TL;DR: Here are the steps to install CUDA9+CUDNN7 on Debian, and installing a pre-compiled version of TensorFlow1.4 on Python2.7 to test that everything works. Everything without root privileges and via terminal. Should also work for other CUDA, CUDNN, TensorFlow and Python versions on other Linux systems too.
INSTALLATION
Go to NVIDIA's official release web for CUDA (as for Nov. 2017, CUDA9 is out): https://developer.nvidia.com/cuda-downloads.
Under your Linux distro, select the
runfile (local)
option. Note that thesudo
indication present in the installation instructions is deceiving, since it is possible to run this installer without root permissions. On a server, one easy way is to copy the<LINK>
of theDownload
button and, in any location of your home directory, runwget <LINK>
. It will download the<INSTALLER>
file.Run
chmod +x <INSTALLER>
to make it executable, and execute it./<INSTALLER>
.accept
the EULA,say no to dr
iver installation, and enter a<CUDA>
location under your home directory to install the toolkit and a<CUDASAMPLES>
for the samples.Not asked here but recommended: Download a compatible CUDNN file from the official web (you need to sign in). In my case, I downloaded the
cudnn-9.0-linux-x64-v7.tgz
, compatible with CUDA9 into the<CUDNN>
folder. Uncompress it:tar -xzvf ...
.Optional: compile the samples.
cd <CUDASAMPLES> && make
. There are some very nice examples there and a very good starting point to write some CUDA scripts of yourself.(If you did 5.): Copy the CUDNN required files into CUDA, and grant reading permission to user (not sure if needed):
cp -P <CUDNN>/cuda/include/cudnn.h <CUDA>/include/ cp -P cudnn9/cuda/lib64/libcudnn* cuda9/lib64 chmod a+r cuda9/include/cudnn.h cuda9/lib64/libcudnn*
Add the library to your environment. This is typically done adding this following two lines to your
~/.bashrc
file (in this example, the<CUDA>
directory was~/cuda9/
:export PATH=$HOME/cuda9/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/cuda9/lib64/
FOR QUICK TESTING OR TENSORFLOW USERS
The quickest way to get a TensorFlow compatible with CUDA9 and CUDNN7 (and a very quick way to test this) is to download a precompiled
wheel
file and install it withpip install <WHEEL>
. Most of the versions you need, can be found in mind's repo (thanks a lot guys). A minimal test that confirms that CUDNN is also working involves the use oftf.nn.conv2d
:In my case, the wheel I installed required Intel's MKL library, as explained here. Again, from terminal and without root users, this are the steps I followed to install the library and make TensorFlow find it (reference):
git clone https://github.com/01org/mkl-dnn.git
cd mkl-dnn/scripts && ./prepare_mkl.sh && cd ..
mkdir -p build && cd build
cmake -D CMAKE_INSTALL_PREFIX:PATH=<TARGET_DIR_IN_HOME> ..
make
# this takes a whilemake doc
# do this optionally if you havedoxygen
make test
# also takes a whilemake install # installs into <TARGET_DIR_IN_HOME>
~/.bashrc
:export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<TARGET_DIR_IN_HOME>/lib
Hope this helps!
Andres