Skip to content

Instantly share code, notes, and snippets.

@luisgizirian
Last active August 18, 2023 22:42
Show Gist options
  • Save luisgizirian/24a6018e5709812ea0b3eccb51992140 to your computer and use it in GitHub Desktop.
Save luisgizirian/24a6018e5709812ea0b3eccb51992140 to your computer and use it in GitHub Desktop.
CUDA devcontainer for C/C++ development (with X11 Forwarding)
CUDA devcontainer for C/C++ development (with X11 Forwarding)
Check https://github.com/luisgizirian/cuda-image-builders
**Not a bulletproof implementation**. Errors might appear given your environment.
Make sure 'xauth' is installed in the host to ensure a correct X11 flow.
To install (for debian based systems) run: `sudo apt-get install -y xauth`
If it doesn't work, run this command, `xauth generate :0 . trusted`, and rebuild the container
{
"name": "Jetson Orin Nano CUDA ready for C/C++ (with X11 Forwarding)",
"dockerFile": "Dockerfile.cuda",
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"NVIDIA.nsight-vscode-edition"
]
}
},
"runArgs": [
"--net=host",
"--privileged",
"--runtime",
"nvidia"
]
}
FROM nvcr.io/nvidia/l4t-base:35.4.1
VOLUME /tmp/.X11-unix:/tmp/.X11-unix:rw
VOLUME $HOME/.Xauthority:/root/.Xauthority
#
# `sudo` for sudo (util needed for execution)
# `nvidia-cuda-dev` for CUDA developer packages (optionally `nvidia-cuda` for CUDA runtime only)
# `xauth` for X11 forwarding
# `libsfml-dev` for SFML
# `git` for git
# `htop` for htop (optional)
#
RUN apt-get update && apt-get install -y --no-install-recommends \
sudo nvidia-cuda-dev xauth libsfml-dev git htop \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#Update libraries
RUN ldconfig
#
# Setup environment variables
#
ENV CUDA_HOME="/usr/local/cuda"
ENV PATH="/usr/local/cuda/bin:$PATH"
ENV LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH"
ENV XAUTHORITY /root/.Xauthority
ENV DISPLAY="$DISPLAY"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment