diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 2936ab0de6..27e38f0e37 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,16 +1,38 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/cpp/.devcontainer/base.Dockerfile +#FROM mcr.microsoft.com/devcontainers/base:ubuntu-24.04 +ARG VARIANT="noble" +FROM nvidia/cuda:13.2.1-devel-ubuntu24.04 +#FROM buildpack-deps:${VARIANT}-curl -# [Choice] Debian / Ubuntu version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04 -ARG VARIANT="buster" -FROM ghcr.io/psc-code/psc-spack-cuda-ubuntu-20.04:latest +LABEL dev.containers.features="common" -# [Optional] Uncomment this section to install additional packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends +ARG VARIANT +RUN if [ "$VARIANT" = "noble" ] || [ "$VARIANT" = "resolute" ]; then \ + if id "ubuntu" &>/dev/null; then \ + echo "Deleting user 'ubuntu' for $VARIANT" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user for $VARIANT"; \ + else \ + echo "User 'ubuntu' does not exist for $VARIANT"; \ + fi; \ + fi +# [Optional] Uncomment this section to install additional OS packages. RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get -y install --no-install-recommends \ - clang-format-9 + git \ + libopenmpi-dev \ + cmake \ + libhdf5-dev \ + hdf5-tools \ + less \ + python3-pip \ + libpython3-dev \ + clang-format \ + ninja-build + +# Local fix for issue with timezone data at 'buildpack-deps'. Ref# https://github.com/devcontainers/images/issues/1709 +RUN apt-get update \ + && export DEBIAN_FRONTEND=noninteractive \ + && apt-get -y reinstall --no-install-recommends tzdata \ + && echo "Etc/UTC" > /etc/timezone \ + && rm -rf /var/lib/apt/lists/* -RUN echo export CMAKE_PREFIX_PATH=/root/psc-env/.spack-env/view >> ~/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 69a31ecbe5..83cf7fa352 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,36 +1,52 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.177.0/containers/cpp +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu { - "name": "C++", + "name": "psc-ubuntu", + // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile "build": { "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick an Debian / Ubuntu OS version: debian-10, debian-9, ubuntu-20.04, ubuntu-18.04 - "args": { - "VARIANT": "ubuntu-20.04" - } - }, - "runArgs": [ - "--cap-add=SYS_PTRACE", - "--security-opt", - "seccomp=unconfined" - ], - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" + "context": "." }, - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "ms-vscode.cpptools", - "ms-vscode.cmake-tools", - "xaver.clang-format", - ], - "containerEnv": { - "CMAKE_PREFIX_PATH": "/root/psc-env/.spack-env/view", - }, - // Use 'forwardPorts' to make a list of ports inside the container available locally. + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "true", + "username": "vscode", + "userUid": "1000", + "userGid": "1000", + "upgradePackages": "true" + }, + "ghcr.io/unh-hpc/features/adios2:0.0.2": {} + + // "ghcr.io/rocker-org/devcontainer-features/apt-packages:1": { + // "packages": [ + // ] + // }, + + // "ghcr.io/devcontainers/features/git:1": { + // "version": "latest", + // "ppa": "false" + // } + }, + // Feat``ures to add to the dev container. More info: https://containers.dev/features. +` // Use 'forwardPorts' to make a list of ports inside the container available locally. // "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "gcc -v", - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - // "remoteUser": "vscode" + // "postCreateCommand": "curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -fsSL https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list > /dev/null && sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit nvidia-cuda-toolkit && echo 'shopt -u progcomp' >> /home/vscode/.bashrc && echo 'alias ll=\"ls -lrt\"' >> /home/vscode/.bashrc", + "postCreateCommand": "echo export CMAKE_PREFIX_PATH=/usr/local/cuda/lib64/cmake >> ~/.bashrc", + // "echo export OPENGGCMDIR=/workspaces/openggcm >> ~/.zshrc; echo PATH=$HOME/bin:$PATH >> ~/.zshrc", + "customizations": { + "vscode": { + "extensions": [ + "ms-vscode.cmake-tools", + "ms-vscode.cpptools-extension-pack", + "ms-toolsai.jupyter", + "ms-python.python" + ] + } + } + + // Configure tool-specific properties. + // "customizations": {}, + // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "root" } \ No newline at end of file