From 0c69c8574bdd53adfecfb8ea68058f80054ba165 Mon Sep 17 00:00:00 2001 From: hotwa Date: Thu, 22 Feb 2024 17:01:22 +0800 Subject: [PATCH 01/22] update --- README.md | 20 ++++++++++++++++++++ id_rsa | 49 ------------------------------------------------- 2 files changed, 20 insertions(+), 49 deletions(-) delete mode 100644 id_rsa diff --git a/README.md b/README.md index 0caca6f..344f72a 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,26 @@ cd docker-stacks/images/base-notebook docker buildx build -t hotwa/notebook:latest . -f Dockerfile ``` +## 修改jupyterhub启动notebook的路径映射 + +修改jupyterhub_config.py文件,修改卷的路径: + +```python +c.DockerSpawner.volumes = { + "jupyterhub-user-{username}": notebook_dir, + "/mnt/mydrive": "/home/jovyan/work/mydrive", + "/mnt/mydrive/project/docker-jupyterhub/id_rsa": "/home/jovyan/.ssh/id_rsa", +} +``` + +## 启动notebook修改 + +启动notebook修改docker-compose.yml文件,修改notebook的基础镜像: + +```yaml + DOCKER_NOTEBOOK_IMAGE: hotwa/notebook:latest +``` + ## Alternatives - [rocker/binder](https://rocker-project.org/images/versioned/binder.html) - diff --git a/id_rsa b/id_rsa deleted file mode 100644 index dc292e2..0000000 --- a/id_rsa +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAACFwAAAAdzc2gtcn -NhAAAAAwEAAQAAAgEArjozHdq/VMgEmQZn5i/3UiRxmU2EZ0J7h0bMV/dIl7dALHDQeGuh -Y8rwcCXsCwNBYGvRhBYkaMIgM+Gi/BTDufgHyJ7UKsYWACdxrj8Ycy1nS/qB2ppuLcRrzi -us/XDuU8eBdqrvjL7KXn6FcBXE3wPSas3rPnBp1o0Fc4ipu91U/LDpZ8RvAesvMFfZc4cm -QO/6zNm7zQ7vEemhXmFKnafe+EGJl9YIJuHud8EkRKwb7YMCjSdUxk/LRN4hlFel5+Hgf5 -t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zTDPc6Iff62Of7KceuQpRAgUXKIReei6JCrGl66Q1EDY8f4RiwGU1o -tSUPJ3oc9KYTsNw6pgAAAQEA06Jk8wSN9siVTazsE0aNcE+cQUAdqjCcfgNt/PR8kfqUGs -9FA33icsulTiOXyzPr5Ua96v6mAtscbkWLPPXVYm9DifarC787EfaeX2SZrmNpELV4I4oj -U/mbKKDoMwtZTuzkClswBPa5o5yoo8TzFISTAdbK26xquS4THaOUsXv0zI26HUMoCf4Idr -06xtUwljLdVdEjBkpXTRMLUbSfMoOOYTPmsMN2yCyz2AI5XCs5ChXF0q7rFdY68VG6n7Go -6Un4HKfpUxdouHexTX4PJsU225oeLtCSMfsil1jf25Z7Kj3/VuEEQ4h/DW+iE7ZBz3Czgd -iiUTZHgTrWm18wkQAAAQEA0sBQdC2Af3psNbk0vQ7MVwMQED7q0OHSpDfKxQdLgo0xASJ0 -nTX5HamlA57Owrln0HgW332Xp3vHwL9170pk260xx0R2gndX6JxZTbI6RBhggEfSDj7YOt -aAWEk1zzcqi0IBv51x8gd7xqwOezkxpM2k3Ej93/+/qzEJDwcn/QxCjqwRRQgY3KGr+H+q -R/cFkD8b+lFaLumQu1v7dMJltOD5Ls+rPglIUqWBeMILuyPbmBXxFF00yOuhkcpIwPN266 -nTtSishRCLkDL83lWVGw3PmOtifEmlvU8cb+t7d+T/kvwgTUSd6m8oVHphxvx3NBUmpzhO -H0lsz1qPDuEJTQAAABJweWx5emVuZ0BnbWFpbC5jb20BAgMEBQYH ------END OPENSSH PRIVATE KEY----- From d54020f61b9c3c9ae668980193bc1dd2065d8df2 Mon Sep 17 00:00:00 2001 From: hotwa Date: Thu, 22 Feb 2024 17:12:01 +0800 Subject: [PATCH 02/22] add mdgnn --- spawnerdockerfile/Dockerfile.base-notebook | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index 9b7eb37..6007e20 100644 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -164,6 +164,7 @@ EOT # Install Rust RUN < Date: Thu, 22 Feb 2024 17:39:29 +0800 Subject: [PATCH 03/22] update --- spawnerdockerfile/Dockerfile.base-notebook | 1 - 1 file changed, 1 deletion(-) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index 6007e20..19a55c5 100644 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -141,7 +141,6 @@ ENV AUTH_KEY=$AUTH_KEY RUN curl https://get.modular.com | sh - && \ modular auth $AUTH_KEY -RUN ARG MODULAR_HOME="/home/${CREATE_USER}/.modular" ENV MODULAR_HOME=$MODULAR_HOME From 8a318485d5430fdb957401ab2ea3b9df4c7ce527 Mon Sep 17 00:00:00 2001 From: hotwa Date: Thu, 22 Feb 2024 20:40:24 +0800 Subject: [PATCH 04/22] add authkey --- spawnerdockerfile/Dockerfile.base-notebook | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index 19a55c5..224d67d 100644 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -136,7 +136,7 @@ EOT # install mojo ENV PATH="/home/${CREATE_USER}/.local/bin:$PATH" # A random default token -ARG AUTH_KEY=5ca1ab1e +ARG AUTH_KEY="mut_efe460b898e3482bb6208bfcd4a51d7e" ENV AUTH_KEY=$AUTH_KEY RUN curl https://get.modular.com | sh - && \ @@ -173,8 +173,6 @@ EOT RUN < Date: Thu, 22 Feb 2024 22:01:13 +0800 Subject: [PATCH 05/22] update --- spawnerdockerfile/Dockerfile.base-notebook | 1 + 1 file changed, 1 insertion(+) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index 224d67d..03c50de 100644 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -162,6 +162,7 @@ micromamba run -n mixtral_env python -m ipykernel install --user --name="mixtral EOT # Install Rust +ENV PATH="/home/${CREATE_USER}/.cargo/bin:$PATH" RUN < Date: Fri, 23 Feb 2024 23:03:31 +0800 Subject: [PATCH 06/22] nginx keep port --- nginx.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index ed77086..b3200d1 100644 --- a/nginx.conf +++ b/nginx.conf @@ -6,7 +6,7 @@ http { map $http_upgrade $connection_upgrade { default upgrade; - '' close; + '' close; } server { @@ -33,6 +33,7 @@ http { proxy_set_header Host $host; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-Port $server_port; # 添加这一行,保持原有的端口号 # WebSocket support proxy_http_version 1.1; From 38389a0b909e37e5122e4080e79bbd0424acf75e Mon Sep 17 00:00:00 2001 From: lingyuzeng Date: Fri, 23 Feb 2024 23:04:03 +0800 Subject: [PATCH 07/22] add mount site --- jupyterhub_config.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jupyterhub_config.py b/jupyterhub_config.py index 0c347e9..0b4b44b 100644 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -35,7 +35,8 @@ c.DockerSpawner.notebook_dir = notebook_dir # notebook directory in the container c.DockerSpawner.volumes = { "jupyterhub-user-{username}": notebook_dir, - "/mnt/mydrive": "/home/jovyan/work/mydrive" + "/mnt/mydrive": "/home/jovyan/work/mydrive", + "/mnt/mydrive/project/docker-jupyterhub/id_rsa": "/home/jovyan/.ssh/id_rsa", } From 20fe094f6c0c3f73a57e67161eab3c45aefdef4b Mon Sep 17 00:00:00 2001 From: lingyuzeng Date: Fri, 23 Feb 2024 23:04:49 +0800 Subject: [PATCH 08/22] upate --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7b0a54d..8e2defa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/docker-stacks \ No newline at end of file +/docker-stacks +*.tar \ No newline at end of file From 2aac07b64fd09dfbe03e6b118fb045017171ffa7 Mon Sep 17 00:00:00 2001 From: lingyu zeng Date: Wed, 8 May 2024 14:45:39 +0800 Subject: [PATCH 09/22] Update Dockerfile --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 15984d8..c8e02e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,4 @@ +# syntax=docker/dockerfile:1 FROM debian:bullseye ARG CREATE_USER="jovyan" ARG CREATE_USER_PASSWD="password" From e8f862a2bc32b75d9edcaed5dcfccc3e7eb32bbe Mon Sep 17 00:00:00 2001 From: hotwa Date: Sat, 25 May 2024 18:30:00 +0800 Subject: [PATCH 10/22] update mojo --- spawnerdockerfile/Dockerfile.base-notebook | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index 9ac8703..f9cb670 100755 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -138,12 +138,17 @@ USER ${NB_UID} ARG MODULAR_HOME="/home/${CREATE_USER}/.modular" ENV MODULAR_HOME=$MODULAR_HOME ENV PATH="$MODULAR_HOME/pkg/packages.modular.com_mojo/bin:/home/${CREATE_USER}/.local/bin:$PATH" +ARG HTTP_PROXY="" +ARG HTTPS_PROXY="" +ARG NO_PROXY="localhost,127.0.0.1" +ENV HTTP_PROXY=$HTTP_PROXY +ENV HTTPS_PROXY=$HTTPS_PROXY RUN < Date: Sat, 25 May 2024 19:55:39 +0800 Subject: [PATCH 11/22] update rust install --- spawnerdockerfile/Dockerfile.base-notebook | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index f9cb670..cf74c55 100755 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -151,11 +151,24 @@ mamba activate mojo && modular install mojo mamba run -n mojo python -m ipykernel install --user --name="mojo" --display-name="mojo_env" EOT -# Install Rust +# Install Rust https://rsproxy.cn/#getStarted +ENV RUSTUP_DIST_SERVER="https://rsproxy.cn" +ENV RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" ENV PATH="/home/${CREATE_USER}/.cargo/bin:$PATH" +ENV CARGO_UNSTABLE_SPARSE_REGISTRY="true" RUN <> ~/.cargo/config.toml source $HOME/.cargo/env cargo install evcxr_jupyter evcxr_jupyter --install From 2c58a44cdea34e18bc98b5fff93a4d03bcc37903 Mon Sep 17 00:00:00 2001 From: hotwa Date: Sat, 25 May 2024 19:57:23 +0800 Subject: [PATCH 12/22] change to hotwa quay images --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index ffd8ff4..25d86ca 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -32,7 +32,7 @@ services: # All containers will join this network DOCKER_NETWORK_NAME: jupyterhub-network # JupyterHub will spawn this Notebook image for users - DOCKER_NOTEBOOK_IMAGE: hotwa/notebook:latest + DOCKER_NOTEBOOK_IMAGE: quay.io/hotwa/notebook:latest # Notebook directory inside user image DOCKER_NOTEBOOK_DIR: /home/jovyan/work From 98265022aa14f2e7b94aa541698ed61169116522 Mon Sep 17 00:00:00 2001 From: hotwa Date: Sun, 26 May 2024 14:23:25 +0800 Subject: [PATCH 13/22] add torch sciplot env --- spawnerdockerfile/Dockerfile.base-notebook | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index cf74c55..bd39340 100755 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -174,5 +174,14 @@ cargo install evcxr_jupyter evcxr_jupyter --install EOT +RUN < Date: Sun, 26 May 2024 23:52:38 +0800 Subject: [PATCH 14/22] change nodejs to 18 and all install nglview --- Dockerfile.jupyterhub | 33 ++++++++++++---------- jupyterhub_config.py | 13 +++++++++ spawnerdockerfile/Dockerfile.base-notebook | 21 ++++++++++---- 3 files changed, 46 insertions(+), 21 deletions(-) diff --git a/Dockerfile.jupyterhub b/Dockerfile.jupyterhub index 0cfd894..52baaaf 100755 --- a/Dockerfile.jupyterhub +++ b/Dockerfile.jupyterhub @@ -8,6 +8,8 @@ ARG ROOT_PASSWD="password" ARG HOME="/home/${CREATE_USER}" ARG DEBIAN_FRONTEND="noninteractive" ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND} +ARG NODEJS_VERSION='18' +ENV NODEJS_VERSION=${NODEJS_VERSION} USER root RUN < /etc/timezone dpkg-reconfigure -f noninteractive tzdata +sudo apt-get remove --purge libnode72:amd64 -y +curl -fsSL https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | sudo -E bash - # 安装所需的软件包 apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-core curl wget openssh-server vim lrzsz net-tools sudo git # 创建新用户 @@ -30,8 +34,20 @@ EOT RUN < /etc/timezone dpkg-reconfigure -f noninteractive tzdata # 安装所需的软件包 +sudo apt-get remove --purge libnode72:amd64 -y +curl -fsSL https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | sudo -E bash - apt-get install -y python3 python3-pip gcc g++ build-essential nodejs npm gdebi-core curl wget openssh-server vim lrzsz net-tools sudo git nodejs +npm install -g configurable-http-proxy yarn --registry=https://registry.npmmirror.com # 创建新用户 useradd -m -s /bin/bash ${CREATE_USER} echo "${CREATE_USER}:${CREATE_USER_PASSWD}" | chpasswd @@ -100,11 +105,7 @@ EOT # 安装 Jupyter 和相关软件 RUN <=6.25.0 jupyterlab-language-pack-zh-CN jupyterlab-git jupyterlab-system-monitor jupyter_nbextensions_configurator jupyter_contrib_nbextensions jupyterlab_widgets jupyterlab-drawio jupyterlab-spreadsheet-editor jupyterlab-cell-flash jedi-language-server jupyterlab_code_formatter jupyterlab-spellchecker jupyterlab_vim nbresuse ipydrawio jedi ipympl black isort theme-darcula ipywidgets tensorboard jupyterlab_latex jupyter_bokeh autopep8 xeus-python jupyterlab-lsp python-lsp-server dockerspawner jupyterhub-nativeauthenticator lckr_jupyterlab_variableinspector -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com EOT @@ -178,8 +179,16 @@ RUN < Date: Mon, 27 May 2024 00:04:54 +0800 Subject: [PATCH 15/22] add tensorboard --- spawnerdockerfile/Dockerfile.base-notebook | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spawnerdockerfile/Dockerfile.base-notebook b/spawnerdockerfile/Dockerfile.base-notebook index 539c955..c1f56f5 100755 --- a/spawnerdockerfile/Dockerfile.base-notebook +++ b/spawnerdockerfile/Dockerfile.base-notebook @@ -179,7 +179,7 @@ RUN < Date: Mon, 27 May 2024 00:11:39 +0800 Subject: [PATCH 16/22] change jupyterhub to jupyterlab in quay.io --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 25d86ca..1072dd7 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: args: JUPYTERHUB_VERSION: latest restart: always - image: hotwa/jupyterhub # registry.cn-hangzhou.aliyuncs.com/hotwa/jupyterhub + image: quay.io/hotwa/jupyterlab:latest container_name: jupyterhub networks: - jupyterhub-network From 4b7bdd84c50052746bac6784209b56abe39af9cf Mon Sep 17 00:00:00 2001 From: hotwa Date: Mon, 27 May 2024 08:25:52 +0800 Subject: [PATCH 17/22] change ali mirror --- Dockerfile.jupyterhub | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Dockerfile.jupyterhub b/Dockerfile.jupyterhub index 52baaaf..f5789f1 100755 --- a/Dockerfile.jupyterhub +++ b/Dockerfile.jupyterhub @@ -35,7 +35,12 @@ RUN < Date: Mon, 27 May 2024 09:05:42 +0800 Subject: [PATCH 18/22] add allow_all user to login --- jupyterhub_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/jupyterhub_config.py b/jupyterhub_config.py index 90d676c..43f1cfa 100755 --- a/jupyterhub_config.py +++ b/jupyterhub_config.py @@ -24,6 +24,7 @@ c = get_config() # noqa: F821 # return super().start() # Spawn single-user servers as Docker containers +c.Authenticator.allow_all = True c.JupyterHub.spawner_class = "dockerspawner.DockerSpawner" # Spawn containers from this image From 780ca5ec6a3fc30f6ee26368c51cc4aa4ac3ec02 Mon Sep 17 00:00:00 2001 From: hotwa Date: Mon, 27 May 2024 09:06:26 +0800 Subject: [PATCH 19/22] add 8080 port and use relavent dir --- .gitignore | 1 + docker-compose.yml | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8e2defa..c105ea7 100755 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /docker-stacks +jupyterhub-data *.tar \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 1072dd7..2b547d0 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -12,7 +12,7 @@ services: args: JUPYTERHUB_VERSION: latest restart: always - image: quay.io/hotwa/jupyterlab:latest + image: quay.io/hotwa/jupyterhub:latest container_name: jupyterhub networks: - jupyterhub-network @@ -23,9 +23,10 @@ services: # within the container - "/var/run/docker.sock:/var/run/docker.sock:rw" # Bind Docker volume on host for JupyterHub database and cookie secrets - - "jupyterhub-data:/data" + - "./jupyterhub-data:/data" ports: - "8000:8000" + - "8080:8080" environment: # This username will be a JupyterHub admin JUPYTERHUB_ADMIN: admin From 0ced7fca49b1d20dfe67a55a87e955360b5ec8c7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 17 Jul 2024 03:20:17 +0000 Subject: [PATCH 20/22] update to ngc images --- spawnerdockerfile/Dockerfile.ngc | 134 +++++++++++++++++++++++ spawnerdockerfile/README.md | 45 ++++++++ spawnerdockerfile/docker-compose_ngc.yml | 72 ++++++++++++ 3 files changed, 251 insertions(+) create mode 100644 spawnerdockerfile/Dockerfile.ngc create mode 100644 spawnerdockerfile/docker-compose_ngc.yml diff --git a/spawnerdockerfile/Dockerfile.ngc b/spawnerdockerfile/Dockerfile.ngc new file mode 100644 index 0000000..0818e32 --- /dev/null +++ b/spawnerdockerfile/Dockerfile.ngc @@ -0,0 +1,134 @@ +ARG REGISTRY=quay.io +ARG OWNER=jupyter +ARG LABEL=notebook +ARG VERSION +ARG BASE_CONTAINER=$REGISTRY/$OWNER/$LABEL:$VERSION +FROM $BASE_CONTAINER +ARG HTTP_PROXY +ARG HTTPS_PROXY +ENV http_proxy=${HTTP_PROXY} +ENV https_proxy=${HTTPS_PROXY} +ARG DEBIAN_FRONTEND="noninteractive" +ENV DEBIAN_FRONTEND=${DEBIAN_FRONTEND} +ARG ROOT_PASSWD="root" +ENV ROOT_PASSWD=${ROOT_PASSWD} +WORKDIR /root +SHELL ["/bin/bash", "-c"] + +# base tools +RUN <> ~/.bashrc +. /opt/conda/etc/profile.d/conda.sh +conda init bash +conda config --set show_channel_urls true +# 配置 .condarc 文件 +cat < ~/.condarc +channels: + - conda-forge + - bioconda + - pytorch + - pytorch-nightly + - nvidia + - defaults +show_channel_urls: true +EOF +# install pixi +curl -fsSL https://pixi.sh/install.sh | bash +EOT + +ENV STAGE_DIR=/tmp +RUN < ~/.deepspeed_env +TORCH_USE_CUDA_DSA=1 +DEEPSPEED_VERBOSE=1 +DEEPSPEED_LOG_LEVEL=DEBUG +CUTLASS_PATH=${CUTLASS_PATH} +TORCH_CUDA_ARCH_LIST=${TORCH_CUDA_ARCH_LIST} +CUDA_HOME=${CUDA_HOME} +LD_LIBRARY_PATH=${LD_LIBRARY_PATH} +EOF +EOT + +CMD ["/usr/sbin/sshd", "-D"] \ No newline at end of file diff --git a/spawnerdockerfile/README.md b/spawnerdockerfile/README.md index d8576ff..829de11 100755 --- a/spawnerdockerfile/README.md +++ b/spawnerdockerfile/README.md @@ -1,5 +1,50 @@ # Base Jupyter Notebook Stack +## ds_report + +```shell +[2024-07-17 02:25:56,956] [INFO] [real_accelerator.py:203:get_accelerator] Setting ds_accelerator to cuda (auto detect) + [WARNING] async_io requires the dev libaio .so object and headers but these were not found. + [WARNING] async_io: please install the libaio-dev package with apt + [WARNING] If libaio is already installed (perhaps from source), try setting the CFLAGS and LDFLAGS environment variables to where it can be found. + [WARNING] Please specify the CUTLASS repo directory as environment variable $CUTLASS_PATH + [WARNING] sparse_attn requires a torch version >= 1.5 and < 2.0 but detected 2.4 + [WARNING] using untested triton version (3.0.0), only 1.0.0 is known to be compatible + +(deepspeed) root@ubuntu-finetune:~/binbbt/train/pretrain# cat .deepspeed_env +CUDA_HOME=/usr/local/cuda/ +TORCH_USE_CUDA_DSA=1 +CUTLASS_PATH=/opt/cutlass +TORCH_CUDA_ARCH_LIST="80;89;90;90a" +LD_LIBRARY_PATH=/usr/local/cuda/lib64:/usr/local/lib:/usr/local/mpi/lib:/usr/local/mpi/lib64:/usr/local/nvidia/lib:/usr/local/nvidia/lib64 +NCCL_DEBUG=WARN +NCCL_SOCKET_IFNAME=bond0 +NCCL_IB_HCA=mlx5_0:1,mlx5_2:1,mlx5_4:1,mlx5_6:1 +NCCL_IB_GID_INDEX=3 +NCCL_NET_GDR_LEVEL=2 +NCCL_P2P_DISABLE=0 +NCCL_IB_DISABLE=0 +``` + +## test command + +```shell +nvidia-smi +nvcc -V +ninja --version +ds_report +python -c "import torch; print('torch:', torch.__version__, torch)" +python -c "import torch; print('CUDA available:', torch.cuda.is_available())" +python -c "import deepspeed; deepspeed.ops.op_builder.CPUAdamBuilder().load()" +python -c "from flash_attn import flash_attn_func, flash_attn_varlen_func" +python -c "import apex.amp; print('Apex is installed and the amp module is available.')" +python -c "from xformers import ops as xops" +ibstat +ofed_info -s +mst version +mpirun --version +``` + > **Images hosted on Docker Hub are no longer updated. Please, use [quay.io image](https://quay.io/repository/jupyter/base-notebook)** [![docker pulls](https://img.shields.io/docker/pulls/jupyter/base-notebook.svg)](https://hub.docker.com/r/jupyter/base-notebook/) diff --git a/spawnerdockerfile/docker-compose_ngc.yml b/spawnerdockerfile/docker-compose_ngc.yml new file mode 100644 index 0000000..b925144 --- /dev/null +++ b/spawnerdockerfile/docker-compose_ngc.yml @@ -0,0 +1,72 @@ +version: '3.9' + +# DeepSpeed支持多种C++/CUDA扩展(ops),这些ops旨在优化深度学习的训练和推理过程。以下是一些主要的DeepSpeed ops及其功能: + +# FusedAdam - 提供融合优化的Adam优化器,适用于GPU。 +# FusedLamb - 类似FusedAdam,针对LAMB优化器,适用于大规模分布式训练。 +# SparseAttention - 用于高效计算稀疏注意力机制。 +# Transformer - 提供Transformer模型的高效实现。 +# TransformerInference - 专门用于Transformer模型的推理优化。 +# CPUAdam - 针对CPU优化的Adam优化器。 +# CPULion - 针对CPU的Lion优化器。 +# Quantizer - 提供量化支持,以减少模型大小和提高推理速度。 +# RandomLTD - 用于随机层裁剪的优化器。 +# StochasticTransformer - 支持随机Transformer模型的训练和推理。 + +# 检测系统总内存(以GB为单位) +# TOTAL_MEM=$(awk '/MemTotal/ {printf "%.0f\n", $2/1024/1024}' /proc/meminfo) +# echo "Docker Compose 文件已生成,shm_size 设置为 ${TOTAL_MEM}GB。" + +services: + ubuntu-finetune: + build: + context: . + dockerfile: Dockerfile.ngc + args: # PyTorch版本、Python版本与pytorch_lightning版本的对应关系表 https://blog.csdn.net/qq_41813454/article/details/137421822 + REGISTRY: "nvcr.io" + OWNER: "nvidia" # nvcr.io/nvidia/pytorch:24.06-py3 + LABEL: "pytorch" + VERSION: "24.06-py3" + DS_BUILD_OPS: 1 + DEEPSPEED_VERSION: "master" + DEEPSPEED_INSTALL_FLAGS: "--allow_sudo" + HTTP_PROXY: "http://127.0.0.1:15777" + HTTPS_PROXY: "http://127.0.0.1:15777" + CACHEBUST: 1 + # volumes: + # - ./workspace:/workspace + # - /tmp:/tmp + container_name: ubuntu-ngc + pull_policy: if_not_present + ulimits: + memlock: + soft: -1 + hard: -1 + # tty: true + # stdin_open: true + restart: unless-stopped + image: hotwa/notebook:ngc + privileged: true + ipc: host + network_mode: host + shm_size: '128gb' + # ports: + # - 3228:2222 + environment: + - NVIDIA_VISIBLE_DEVICES=all + - NVIDIA_DRIVER_CAPABILITIES=compute,utility + - TMPDIR=/var/tmp + # networks: + # - network_finetune + # command: ["/usr/sbin/sshd", "-D"] + deploy: + resources: + reservations: + devices: + - driver: nvidia + count: all + capabilities: [gpu] + +# networks: +# network_finetune: +# name: network_finetune From f685bf6d806b156357ca1719a5e89c16f9352a68 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 17 Jul 2024 04:48:33 +0000 Subject: [PATCH 21/22] add conda --- spawnerdockerfile/install_conda.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 spawnerdockerfile/install_conda.sh diff --git a/spawnerdockerfile/install_conda.sh b/spawnerdockerfile/install_conda.sh new file mode 100644 index 0000000..420690e --- /dev/null +++ b/spawnerdockerfile/install_conda.sh @@ -0,0 +1,20 @@ +# install miniconda +wget -qO- https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O /tmp/miniconda.sh +bash /tmp/miniconda.sh -b -p /opt/conda +rm /tmp/miniconda.sh +ln -s /opt/conda/etc/profile.d/conda.sh /etc/profile.d/conda.sh +echo ". /opt/conda/etc/profile.d/conda.sh" >> ~/.bashrc +. /opt/conda/etc/profile.d/conda.sh +conda init bash +conda config --set show_channel_urls true +# 配置 .condarc 文件 +cat < ~/.condarc +channels: + - conda-forge + - bioconda + - pytorch + - pytorch-nightly + - nvidia + - defaults +show_channel_urls: true +EOF \ No newline at end of file From adc45bc432d6d0aab1323b1834a9075832adb348 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 17 Jul 2024 04:49:01 +0000 Subject: [PATCH 22/22] update to drive --- spawnerdockerfile/Dockerfile.ngc | 73 ++++++++++++++++++++++---------- spawnerdockerfile/README.md | 5 ++- 2 files changed, 54 insertions(+), 24 deletions(-) diff --git a/spawnerdockerfile/Dockerfile.ngc b/spawnerdockerfile/Dockerfile.ngc index 0818e32..7a4e3c5 100644 --- a/spawnerdockerfile/Dockerfile.ngc +++ b/spawnerdockerfile/Dockerfile.ngc @@ -15,6 +15,49 @@ ENV ROOT_PASSWD=${ROOT_PASSWD} WORKDIR /root SHELL ["/bin/bash", "-c"] +# https://network.nvidia.com/products/infiniband-drivers/linux/mlnx_ofed/ +ENV MLNX_OFED_VERSION=23.10-3.2.2.0 +RUN <&1 +# from https://github.com/huggingface/transformers/blob/main/docker/transformers-pytorch-deepspeed-latest-gpu/Dockerfile install deepspeed fail +# reference deepspeed install from https://github.com/microsoft/DeepSpeed/blob/master/docker/Dockerfile +# install deepspeed prepare +# install Mellanox OFED +mkdir -p ${STAGE_DIR} +wget -q -O - http://www.mellanox.com/downloads/ofed/MLNX_OFED-${MLNX_OFED_VERSION}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64.tgz | tar xzf - +cd MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64 +./mlnxofedinstall --user-space-only --without-fw-update --all -q +cd ${STAGE_DIR} +rm -rf ${STAGE_DIR}/MLNX_OFED_LINUX-${MLNX_OFED_VERSION}-ubuntu22.04-x86_64* +EOT + +ARG NV_PEER_MEM_VERSION="1.2" +ENV NV_PEER_MEM_VERSION=${NV_PEER_MEM_VERSION} +ENV NV_PEER_MEM_TAG=${NV_PEER_MEM_VERSION}-0 +RUN <> ~/.bashrc -. /opt/conda/etc/profile.d/conda.sh -conda init bash -conda config --set show_channel_urls true -# 配置 .condarc 文件 -cat < ~/.condarc -channels: - - conda-forge - - bioconda - - pytorch - - pytorch-nightly - - nvidia - - defaults -show_channel_urls: true -EOF +eval "$(curl https://get.x-cmd.com)" # install pixi curl -fsSL https://pixi.sh/install.sh | bash EOT -ENV STAGE_DIR=/tmp RUN <=0.17.0 +python -m pip install --no-deps git+https://github.com/huggingface/optimum.git#egg=optimum[diffusers,quality] EOT RUN <