[PYTHON] How to handle multiple versions of CUDA in the same environment

I was doing machine learning in university research, and I was wondering how to handle multiple versions of CUDA in the same environment, so I will write about it.

Premise

Run PyTorch on GPU in Windows 10 environment. The required CUDA version differs depending on the PyTorch version. Along with this, I installed multiple versions of CUDA.

Target person

Those who have run PyTorch on GPU and know how to install cuDNN and CUDA and how to pass the path, but do not know how to handle multiple versions.

Method

The bottom line is that users don't have to do anything. As long as you pass the path, it will automatically recognize the required CUDA depending on which version of PyTorch you run.

When you type where nvcc at the command prompt

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc.exe
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\nvcc.exe
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc.exe

So, if you have the path of the version of CUDA to use, there is no problem. If not, you can add the following path to the system environment variable Path (which is unlikely, but if you know what you are doing and delete it?) .. (For version 10.2)

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\libnvvp

By the way, the folder where CUDA is installed looks like this. CUDAFolder.png

Recommended Posts

How to handle multiple versions of CUDA in the same environment
[Java] How to switch between multiple versions of Java
How to compare if the contents of the objects in scipy.sparse.csr_matrix are the same
When you want to use multiple versions of the same Python library (virtual environment using venv)
How to get the number of digits in Python
How to build an environment for using multiple versions of Python on Mac
How to display multiple images of galaxies in tiles
How to get a list of files in the same directory with python
How to install the deep learning framework Tensorflow 1.0 in the Anaconda environment of Windows
How to find the optimal number of clusters in k-means
How to develop in a virtual environment of Python [Memo]
How to handle session in SQLAlchemy
How to handle Japanese in Python
How to check if the contents of the dictionary are the same in Python by hash value
Solve the problem of missing libcudart in Ubuntu 16.04 + CUDA 8.0 + Tensorflow environment
How to determine the existence of a selenium element in Python
How to implement Java code in the background of RedHat (LinuxONE)
How to know the internal structure of an object in Python
How to change the color of just the button pressed in Tkinter
How to check the memory size of a variable in Python
How to check the memory size of a dictionary in Python
[TensorFlow 2] How to check the contents of Tensor in graph mode
How to get the vertex coordinates of a feature in ArcPy
How to set up the development environment of ev3dev [Windows version]
How to display bytes in the same way in Java and Python
Handle multiple python versions in one jupyter
How to access environment variables in Python
How to check the version of Django
How to handle consecutive values in MySQL
How to switch python versions in cloud9
How to change multiple columns of csv in Pandas (Unixtime-> Japan Time)
How to check local GAE from iPhone browser in the same LAN
How to assign multiple values to the Matplotlib colorbar
How to calculate the volatility of a brand
How to use the C library in Python
How to find the area of the Voronoi diagram
How to keep track of work in Powershell
Summary of how to import files in Python 3
Use multiple versions of python environment with pyenv
Summary of how to use MNIST in Python
How to get the files in the [Python] folder
[TF] How to build Tensorflow in Proxy environment
How to handle datetime type in python sqlite3
How to pass the execution result of a shell command in a list in Python
How to make VS Code aware of the venv environment and its benefits
How to mention a user group in slack notification, how to check the id of the user group
How to uniquely identify the source of access in the Django Generic Class View
I want to use Python in the environment of pyenv + pipenv on Windows 10
Script to use multiple github accounts properly in the same repository on the same machine
How to count the number of elements in Django and output to a template
A memorandum of how to execute the! Sudo magic command in Jupyter Notebook
How to find the coefficient of the trendline that passes through the vertices in Python
How to change the appearance of unselected Foreign Key fields in Django's ModelForm
How to make the font width of jupyter notebook put in pyenv equal width
How to retrieve the nth largest value in Python
How to know the port number of the xinetd service
How to get the variable name itself in python
How to run the Ansible module added in Ansible Tower
Used from the introduction of Node.js in WSL environment
How to display the modification date of a file in C language up to nanoseconds
How to get multiple model objects randomly in Django