As of October 14, 2020, the pytorch official does not show how to install for cuda11.0. Therefore, I will explain the procedure for building a pytorch environment for cuda11.0 using Docker.
As a prerequisite, it is assumed that Docker and nvidia drivers are installed. Please refer to other articles for these installations.
$ nvidia-smi
Also check that the cuda version is 11.0 with the above command.
Please access the nvidia site, register your user information, and then open the Pytorch screen.
$ sudo docker pull nvcr.io/nvidia/pytorch:20.09-py3
Since the pull command has the above command, copy it and execute it in the terminal.
$ sudo docker images
Check if you could install with this command. nvcr.io/nvidia/pytorch 20.09-py3 If there is an image that says, it is a success.
Execute the command to list the images, check the IMAGE ID of pytorch, copy it, and execute the following command.
$ sudo docker run -it --gpus all [IMAGE ID] bash
Then in bash
$ python
>> import torch
>> print(torch.cuda.is_available())
If true is returned with this, it is successful. You can exit bash with control + d. (Linux)
Please exit bash once.
$ sudo docker ps -a
You can see the container created when you ran bash earlier with the above command. Use this CONTAINER ID.
$ sudo docker inspect [CONTAINER ID]
Find WorkingDir with control + f. In addition, use the command to check the path of the folder on the PC where you want to work.
$ pwd
Then create a container on the nvidia site earlier as described in the overview.
$ sudo docker run --gpus all -it --rm -v [The path of the folder you want to work with]:[workingDir] nvcr.io/nvidia/pytorch:20.09-py3
In my case
$ sudo docker run --gpus all -it --rm -v /home/myname/Desktop/hoge:/workspacećnvcr.io/nvidia/pytorch:20.09-py3
After that, you should be able to confirm that the container is launched.
Please be careful as there may be typographical errors. I hope it will be a connection until the official posts the installation method.
Recommended Posts