diff --git a/.gitignore b/.gitignore index 0a23ae0..a24c778 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ examples/hBN/negf_output_k70/self_energy/* examples/CNT/output/* examples/long_cnt/* CLAUDE* +ai_docs/* run_config.json diff --git a/Dockerfile b/Dockerfile index 7de2431..1e020c2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -31,22 +31,22 @@ RUN apt-get update > /dev/null && \ WORKDIR /app COPY . . -# 2. 创建环境并安装所有依赖 +# 2. Create the environment and install all dependencies RUN \ sed -i 's/build-backend = "poetry_dynamic_versioning.backend"/build-backend = "poetry.core.masonry.api"/' pyproject.toml && \ conda create -n dpnegf python=3.10 -c conda-forge -y && \ git clone https://github.com/deepmodeling/DeePTB.git && \ conda run -n dpnegf pip install --upgrade pip setuptools wheel && \ - # [1] 强制拉取纯 CPU 版本的 PyTorch 2.1.1,极大地减小镜像体积并对齐底层接口 - conda run -n dpnegf pip install torch==2.1.1 --index-url https://download.pytorch.org/whl/cpu && \ - # [2] 强制使用 PyG 专属源拉取 torch-scatter,并使用 --only-binary=torch-scatter 彻底关闭源码编译。 - # 这样如果找不到精确匹配的 Wheel,它会立刻报错,而不是花 10 分钟编译出一个会引发崩溃的包。 - conda run -n dpnegf pip install torch-scatter -f https://data.pyg.org/whl/torch-2.1.1+cpu.html --only-binary=torch-scatter && \ - # [3] 给本地仓库的安装加上 CPU 源保护,防止安装过程触发隐藏依赖,把刚才装好的 CPU 版 Torch 顶替成带 CUDA 的版本 - conda run -n dpnegf pip install ./DeePTB torch==2.1.1 --extra-index-url https://download.pytorch.org/whl/cpu && \ - conda run -n dpnegf pip install ./ torch==2.1.1 --extra-index-url https://download.pytorch.org/whl/cpu && \ + # [1] Force the CPU-only PyTorch 2.5.1 wheel to shrink the image and align the low-level ABI. + conda run -n dpnegf pip install torch==2.5.1 --index-url https://download.pytorch.org/whl/cpu && \ + # [2] Pull torch-scatter from the PyG wheel index and use --only-binary=torch-scatter to fully disable source builds. + # If no matching wheel is found it fails immediately instead of spending ~10 minutes compiling a package that would crash at runtime. + conda run -n dpnegf pip install torch-scatter -f https://data.pyg.org/whl/torch-2.5.0+cpu.html --only-binary=torch-scatter && \ + # [3] Guard the local-repo installs with the CPU index so hidden dependencies can't replace the CPU torch with a CUDA build. + conda run -n dpnegf pip install ./DeePTB torch==2.5.1 --extra-index-url https://download.pytorch.org/whl/cpu && \ + conda run -n dpnegf pip install ./ torch==2.5.1 --extra-index-url https://download.pytorch.org/whl/cpu && \ conda clean --all -y && \ rm -rf /root/.cache/pip -# 3. 设置默认启动环境 +# 3. Activate the dpnegf environment by default in interactive shells RUN echo "conda activate dpnegf" >> ~/.bashrc