This is the 7th day of my participation in the August Text Challenge.More challenges in August

Hardware and software Environment

  • Ubuntu 18.04 64 – bit
  • NVidia GTX 1070
  • CUDA 10.1
  • Cudnn 7.6.3

Install the Nvidia driver

When you enter the Ubuntu system without a driver installed, the screen display is abnormal and the resolution is low. Download RUN files from the official website, such as nvidia-Linux-x86_64-435.21.run, where the version selection needs to match the later CUDA

Chmod a+x nvidia-linux-x86_64-435.21. run sudoCopy the code

The installation process is basically a matter of selecting yes or no, and then restarting the system after the installation, you’ll see that the screen displays normally and has a higher resolution.

The cudA installation file already contains the corresponding driver, so you don’t have to do this first

Install the CUDA

Then start the installation cuda, official download address: developer.nvidia.com/cuda-downlo…

Chmod +x cuda_10.1.243_418.87.00_linux.run sudo./cuda_10.1.243_418.87.00_linux.runCopy the code

During the installation process, there will be some options to choose according to your actual situation, such as whether to use the built-in CUDA drivers, installation path, whether to install samples, etc. (each version is different).

By default, CUDA is installed in /usr/local and a soft link CUDA is created

Then configure the environment variables and edit the ~/.bashrc file

export PATH=/usr/local/cuda/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
Copy the code

Finally, execute source

source ~/.bashrc
Copy the code

Several important environment variables take effect immediately. Or, reopening Terminal works as well.

Install cudnn

Website developer.nvidia.com/cudnn to download, need to register here, a little bit of a problem. It is important to note that cudNN versions are meant to match CUDA

Tar XVF cudnn-10.1-linux-x64-v7.6.3.36. TGZ sudo cp cuda/include/cudnn*. H /usr/local/cuda-10.1/include sudo cp -a Sudo chmod a+r /usr/local/cuda-10.1/lib64/libcudnn* /usr/local/cuda-10.1/lib64/libcudnn*Copy the code

test

After installation, let’s test whether the environment is ok?

Enter sample and run down deviceQuery

Sudo apt install build-essential CD nvidia_cuda-10.1_samples /1_Utilities/deviceQuery makeCopy the code

Finally, execute nvidia-SMI to see

I happen to have examples here, so you can see that the GPU is basically working at full capacity

Multiple CUDA versions coexist and switch

As you can see from cudA installations, it is possible to have multiple versions of CUDas coexist, and switching is easy.

The installation process is the same as mentioned above, there are several versions installed, for example, I said that there are two installed, one 10.0, one 10.1, and the current active version is 10.1

Now let’s do a switch

Sudo ln -s /usr/local/cuda-10.1 /usr/local/cudaCopy the code

The resources

  • www.nvidia.com/Download/in…
  • Developer.nvidia.com/cuda-toolki…