diff --git a/notebooks/.devcontainer/Dockerfile b/notebooks/.devcontainer/Dockerfile index dc75b70..ebf2302 100644 --- a/notebooks/.devcontainer/Dockerfile +++ b/notebooks/.devcontainer/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.11.11 # create non-root user and set the default user ARG USERNAME=devuser -ARG USER_UID=1010 +ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ diff --git a/pyproject.toml b/pyproject.toml index bb2677f..e3bfcf0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.ruff] -target-version = "py39" +target-version = "py311" extend-exclude = ["notebooks"] [tool.ruff.lint] diff --git a/src/sample_cpu_project/.devcontainer/Dockerfile b/src/sample_cpu_project/.devcontainer/Dockerfile index 50f32bc..22af4f0 100644 --- a/src/sample_cpu_project/.devcontainer/Dockerfile +++ b/src/sample_cpu_project/.devcontainer/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.11.11 # create non-root user and set the default user ARG USERNAME=devuser -ARG USER_UID=1010 +ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ diff --git a/src/sample_pytorch_gpu_project/.devcontainer/Dockerfile b/src/sample_pytorch_gpu_project/.devcontainer/Dockerfile index b3d6446..10a02a1 100644 --- a/src/sample_pytorch_gpu_project/.devcontainer/Dockerfile +++ b/src/sample_pytorch_gpu_project/.devcontainer/Dockerfile @@ -1,29 +1,21 @@ -# leverage multi-stage build and copy python binaries to cuda container -FROM python:3.11.11 as python -FROM nvidia/cuda:12.6.3-cudnn-runtime-ubuntu24.04 -COPY --from=python /usr/local/ /usr/local/ - -RUN apt-get update \ - && apt-get install -y \ - wget \ - git \ - sudo \ - && rm -rf /var/lib/apt/lists/* - +FROM python:3.11.11 # install Azure CLI RUN wget -qO- https://aka.ms/InstallAzureCLIDeb | bash - # create non-root user and set the default user ARG USERNAME=devuser -# uid=1000 is already used for ubuntu so use 1010 instead -ARG USER_UID=1010 +ARG USER_UID=1000 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ + # Add sudo support + && apt-get update \ + && apt-get install -y sudo \ && echo $USERNAME ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$USERNAME \ - && chmod 0440 /etc/sudoers.d/$USERNAME + && chmod 0440 /etc/sudoers.d/$USERNAME \ + && rm -rf /var/lib/apt/lists/* USER $USERNAME + # make all python tools installed by pip accesible ENV PATH=$PATH:/home/$USERNAME/.local/bin diff --git a/src/sample_pytorch_gpu_project/sample_main.py b/src/sample_pytorch_gpu_project/sample_main.py index 9877eb8..bdaded4 100644 --- a/src/sample_pytorch_gpu_project/sample_main.py +++ b/src/sample_pytorch_gpu_project/sample_main.py @@ -12,6 +12,8 @@ def main(): print("torch.backends.cudnn.is_available():", torch.backends.cudnn.is_available()) print("torch.backends.cuda.is_built():", torch.backends.cuda.is_built()) print("torch.backends.mkldnn.is_available():", torch.backends.mkldnn.is_available()) + print("torch.version.cuda:", torch.version.cuda) + print("torch.backends.cudnn.version():", torch.backends.cudnn.version()) if __name__ == "__main__":