diff --git a/_static/pytorch_actions.js b/_static/pytorch_actions.js index de98780..6395f7b 100644 --- a/_static/pytorch_actions.js +++ b/_static/pytorch_actions.js @@ -44,9 +44,9 @@ $(document).ready(function () { $.gen_content = function () { var options = $.get_options(); + var pytorch_version = options['pytorch']; + var match_versions = pytorch_versions[pytorch_version]; if (options['install_type'] == "docker") { - var pytorch_version = options['pytorch']; - var match_versions = pytorch_versions[pytorch_version]; var dockerCommand = ` docker run \\ --name cann_container \\ @@ -69,19 +69,19 @@ docker run \\ } else if (options['install_type'] == "pip") { $('#codecell1').html("# install torch
"); if(options['arch'] == "aarch64") - $('#codecell1').append("pip3 install torch==" + options['pytorch']); + $('#codecell1').append("pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch==" + options['pytorch']); else $('#codecell1').append("pip3 install torch=="+options['pytorch']+"+cpu --index-url https://download.pytorch.org/whl/cpu"); - $("#codecell1").append("

# install torch-npu
pip3 install torch-npu==" + options['pytorch_npu']); + $("#codecell1").append("

# install torch-npu
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple torch-npu==" + options['pytorch_npu']); $('#install-pytorch-source-section').hide(); $('#install-pytorch-docker-section').hide(); $('#install-pytorch-pip-section').show(); } else { - $("#codecell2").html("# install requirements
conda install cmake ninja

# get torch source
git clone -b "+options['pytorch']+" --recursive https://github.com/pytorch/pytorch
cd pytorch
git submodule update --init --recursive

# install torch
pip install -r requirements.txt
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-\"$(dirname $(which conda))/../\"}
python setup.py develop"); + $("#codecell4").html("# install requirements
conda install cmake ninja git

# get torch source
git clone -b v"+options['pytorch']+" --recursive https://github.com/pytorch/pytorch
cd pytorch
git submodule sync
git submodule update --init --recursive

# install torch
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-\"$(dirname $(which conda))/../\"}
USE_CUDA=0 python setup.py develop"); - $('#codecell2').append("

# get torch-npu source
git clone https://github.com/ascend/pytorch.git -b "+options['pytorch_npu']+" --depth 1 pytorch_npu
cd pytorch_npu

#install torch-npu
bash ci/build.sh --python=$(python --version 2>&1 | awk '{print $2}' | cut -d '.' -f 1,2)"); + $('#codecell4').append("

# get torch-npu source
git clone https://github.com/ascend/pytorch.git -b "+match_versions['npu_branch']+" --depth 1 pytorch_npu
cd pytorch_npu

# install torch-npu
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt
bash ci/build.sh --python=$(python --version 2>&1 | awk '{print $2}' | cut -d '.' -f 1,2)
pip install dist/torch_npu*.whl"); $('#install-pytorch-pip-section').hide(); $('#install-pytorch-docker-section').hide(); diff --git a/sources/ascend/quick_install.rst b/sources/ascend/quick_install.rst index 5ffe4e1..6cd03ea 100644 --- a/sources/ascend/quick_install.rst +++ b/sources/ascend/quick_install.rst @@ -34,6 +34,10 @@ Python 3.8, 3.9, 3.10 ------------------ 根据您的需求,选择合适的软件包版本: +.. note:: + + 建议使用非root用户安装 + .. raw:: html @@ -87,12 +91,12 @@ Python 3.8, 3.9, 3.10

安装依赖

-
sudo apt-get install -y gcc g++ make cmake zlib1g zlib1g-dev openssl libsqlite3-dev libssl-dev libffi-dev unzip pciutils net-tools libblas-dev gfortran libblas3
+
sudo apt-get install -y gcc g++ make cmake zlib1g zlib1g-dev openssl libsqlite3-dev libssl-dev libffi-dev unzip pciutils net-tools libblas-dev gfortran libblas3 python3-dev
-
sudo yum install -y gcc gcc-c++ make cmake unzip zlib-devel libffi-devel openssl-devel pciutils net-tools sqlite-devel lapack-devel gcc-gfortran
+
sudo yum install -y gcc gcc-c++ make cmake unzip zlib-devel libffi-devel openssl-devel pciutils net-tools sqlite-devel lapack-devel gcc-gfortran python3-devel

创建驱动运行用户

@@ -114,13 +118,17 @@ Python 3.8, 3.9, 3.10

                         
                     
+                    
+

备注

+

根据提示决定是否需要重启系统

+

安装CANN

安装python依赖

-
pip3 install attrs numpy decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions
+
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple attrs numpy decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions

下载并安装

@@ -140,7 +148,7 @@ Python 3.8, 3.9, 3.10

设置环境变量

-
echo "source /usr/local/Ascend/ascend-toolkit/set_env.sh" >> ~/.bashrc
source ~/.bashrc
+
echo "source ~/Ascend/ascend-toolkit/set_env.sh" >> ~/.bashrc
source ~/.bashrc
@@ -178,27 +186,8 @@ Python 3.8, 3.9, 3.10 | 0 xxx | OK | 0.0 40 0 / 0 | | 0 | 0000:C1:00.0 | 0 882 / 15169 0 / 32768 | +======================+===============+====================================================+ - | 1 xxx | OK | 0.0 35 0 / 0 | - | 0 | 0000:81:00.0 | 0 1603 / 15169 0 / 32768 | - +======================+===============+====================================================+ - | 2 xxx | OK | 0.0 32 0 / 0 | - | 0 | 0000:41:00.0 | 0 2440 / 15169 0 / 32768 | - +======================+===============+====================================================+ - | 3 xxx | OK | 0.0 40 0 / 0 | - | 0 | 0000:01:00.0 | 0 1014 / 15071 0 / 32768 | - +======================+===============+====================================================+ - | 4 xxx | OK | 0.0 39 0 / 0 | - | 0 | 0000:C2:00.0 | 0 457 / 15169 0 / 32768 | - +======================+===============+====================================================+ - | 5 xxx | OK | 0.0 33 0 / 0 | - | 0 | 0000:82:00.0 | 0 523 / 15169 0 / 32768 | - +======================+===============+====================================================+ - | 6 xxx | OK | 0.0 31 0 / 0 | - | 0 | 0000:42:00.0 | 0 2182 / 15169 0 / 32768 | - +======================+===============+====================================================+ - | 7 xxx | OK | 0.0 39 0 / 0 | - | 0 | 0000:02:00.0 | 0 2771 / 15071 0 / 32768 | - +======================+===============+====================================================+ + + ... ... **验证固件** @@ -214,7 +203,13 @@ Python 3.8, 3.9, 3.10 .. code-block:: bash - [INFO] Ascend-cann-toolkit install success + Ascend-cann-toolkit install success. + +安装算子包后,若系统出现以下关键回显信息,表示算子包安装成功。 + +.. code-block:: bash + + Ascend-cann-kernels install success. 卸载 @@ -235,4 +230,4 @@ Python 3.8, 3.9, 3.10 .. code-block:: bash - /ascend-toolkit//{arch}-linux/script/uninstall.sh \ No newline at end of file + ~/Ascend/ascend-toolkit//{arch}-linux/script/uninstall.sh \ No newline at end of file diff --git a/sources/pytorch/install.rst b/sources/pytorch/install.rst index b777ab1..9619bc9 100644 --- a/sources/pytorch/install.rst +++ b/sources/pytorch/install.rst @@ -50,31 +50,57 @@ -.. warning:: - - 非Docker的安装方式,需要根据上述表格的建议 :doc:`安装<../ascend/quick_install>` CANN-toolkit版本。 - 安装 PyTorch ---------------- .. raw:: html
+
+

备注

+

请确保已经安装了与上述CANN-toolkit版本匹配的驱动和固件。

+

         
+
+

备注

+

请确保已经根据上述表格建议安装了对应的CANN-toolkit版本以及相应的固件和驱动,并应用了CANN-toolkit环境变量。

+

         
+
+

备注

+

请确保已经根据上述表格建议安装了对应的CANN-toolkit版本以及相应的固件和驱动,并应用了CANN-toolkit环境变量。

+

环境依赖

-

1. Python 3.8 ~ 3.10
2. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)

+
    +
  1. Python 3.8 ~ 3.10
  2. +
  3. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)
  4. +
  5. Conda (可选)
  6. +
+
+

备注

+

如果使用Conda,请确保CANN-toolkit依赖的Python包在Conda环境中已经安装

+
+
+

警告

+

不建议您使用Conda提供的gcc,可能需要解决一些编译依赖问题,如果一定要使用,可参考以下命令:

+
+
conda install -c conda-forge libstdcxx-ng libgcc-ng gcc=9.4 gxx=9.4
+
+

备注

+

请确认CXX11_ABI是关闭的,如果无法确定,建议显式关闭:

+
+
export _GLIBCXX_USE_CXX11_ABI=0

构建