PyTorch Official VSCode DevContainer

Introduction

In my previous blog post “Build and Develop PyTorch”, I described how to build and develop PyTorch using a custom Docker container. Recently, I realized that PyTorch actually provides an official VSCode DevContainer.

Even though the VSCode DevContainer is more of a black box compared to the custom Docker container I described in my previous blog post, it actually works well on my local machine.

In this blog post, I will describe how to build and develop PyTorch using the official PyTorch VSCode DevContainer.

PyTorch Official VSCode DevContainer

Building the official PyTorch VSCode DevContainer can be as simple as following the instructions in the PyTorch GitHub repository. The only caveat that is not mentioned in the instructions is that the correct CUDA version should be specified in the devcontainer.json file before building the VSCode DevContainer. The CUDA version can be queried using nvidia-smi from the terminal of the local machine.

Building PyTorch using the official PyTorch VSCode DevContainer, however, does not avoid the segmentation fault or system frozen issue that I encountered when building PyTorch using the custom Docker container. The root cause of the problem seems to be in the compiler that is shipped with the Docker container.

Conclusions

If we don’t care about developing in a less transparent environment, the official PyTorch VSCode DevContainer is a convenient choice for building and developing PyTorch.

References

Author

Lei Mao

Posted on

03-04-2024

Updated on

03-04-2024

Licensed under


Comments