Use cuda11.0 with pytorch using Docker

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.

Prerequisites

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.

Download the Pytorch container

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.

Check if Pytorch can use cuda

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)

Create a container and mount the file

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.

Finally

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

Use cuda11.0 with pytorch using Docker
Use Puphpeteer with Docker
Pytorch execution environment with Docker
Use GDAL with Python with Docker
[Docker] Use whenever with Docker + Rails
Using PlantUml with Honkit [Docker]
Why use orchestration tools with Docker
I tried using Scalar DL with Docker
GPU recognition with docker using WSL2 (August 2020)
Try using Kong + Konga with Docker Compose.
Use ZStandard with .NET Core + Docker (Alpine)
[Ubuntu 18.04] Environment construction for using PyTorch with RTX3090
Use Amazon ECR Credential Helper with Docker Desktop
Make Volume faster when using Docker with vscode.
How to use docker compose with NVIDIA Jetson
How to use nginx-ingress-controller with Docker for Mac
Try using another Servlet container Jetty with Docker
Use ProGuard with Gradle
Using Pair with OpenJDK
Launch MariaDB with Docker
Rails deploy with Docker
Run Pico with docker
Explode Docker with WSL2
Why we use Docker
Use C library with Swift using Clang Modules (modulemap)
Use XVim2 with Xcode 12.0.1
Use CentOS with LXD
Operate Emby with Docker
Try WildFly with Docker
Run Payara with Docker
Use webmock with Rspec
[Docker] Connection with MySQL
Php settings with Docker
Getting Started with Docker
Use WebJars with Gradle
Use jlink with gradle
Disposable PHP with Docker
Install Composer with Docker
[PHP8] Install and use PECL YAML function (YAML parser) with Docker
Use docker's in-container shell with cygwin [docker exec -it bash]
Register your own Docker image with ECR using AWS CLI
How to use mysql with M1 mac Docker preview version
You are required to use winpty with docker exec [Windows]
Use Lambda Layers with Java
Use Thymeleaf with Azure Functions
Deploy with EC2 / Docker / Laravel
Run TAO Core with Docker
Try using GloVe with Deeplearning4j
Docker management with VS Code
Try using view_component with rails
Use pfx certificate with Okhttp3
Japaneseize using i18n with Rails
Set up GitLab with docker
Use Bulk API with RestHighLevelClient
Use SDKMAN! With Git Bash
Run Rails whenever with docker
Get started with DynamoDB with docker
Docker autostart settings with wsl2
[Docker] Rails 5.2 environment construction with docker
Use multiple databases with Rails 6.0
Using Mapper with Java (Spring)