Skip to content

Commit

Permalink
Fix doc error
Browse files Browse the repository at this point in the history
  • Loading branch information
hipudding authored and FFFrog committed Jun 14, 2024
1 parent 7070f97 commit 7bbad00
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 38 deletions.
12 changes: 6 additions & 6 deletions _static/pytorch_actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 \\
Expand All @@ -69,19 +69,19 @@ docker run \\
} else if (options['install_type'] == "pip") {
$('#codecell1').html("# install torch<br>");
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("<br><br># install torch-npu<br>pip3 install torch-npu==" + options['pytorch_npu']);
$("#codecell1").append("<br><br># install torch-npu<br>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<br>conda install cmake ninja<br><br># get torch source<br>git clone -b "+options['pytorch']+" --recursive https://github.com/pytorch/pytorch<br>cd pytorch<br>git submodule update --init --recursive<br><br># install torch<br>pip install -r requirements.txt<br>export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-\"$(dirname $(which conda))/../\"}<br>python setup.py develop");
$("#codecell4").html("# install requirements<br>conda install cmake ninja git<br><br># get torch source<br>git clone -b v"+options['pytorch']+" --recursive https://github.com/pytorch/pytorch<br>cd pytorch<br>git submodule sync<br>git submodule update --init --recursive<br><br># install torch<br>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt<br>export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-\"$(dirname $(which conda))/../\"}<br>USE_CUDA=0 python setup.py develop");

$('#codecell2').append("<br><br># get torch-npu source<br>git clone https://github.com/ascend/pytorch.git -b "+options['pytorch_npu']+" --depth 1 pytorch_npu<br>cd pytorch_npu<br><br>#install torch-npu<br>bash ci/build.sh --python=$(python --version 2>&1 | awk '{print $2}' | cut -d '.' -f 1,2)");
$('#codecell4').append("<br><br># get torch-npu source<br>git clone https://github.com/ascend/pytorch.git -b "+match_versions['npu_branch']+" --depth 1 pytorch_npu<br>cd pytorch_npu<br><br># install torch-npu<br>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -r requirements.txt<br>bash ci/build.sh --python=$(python --version 2>&1 | awk '{print $2}' | cut -d '.' -f 1,2)<br>pip install dist/torch_npu*.whl");

$('#install-pytorch-pip-section').hide();
$('#install-pytorch-docker-section').hide();
Expand Down
49 changes: 22 additions & 27 deletions sources/ascend/quick_install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Python 3.8, 3.9, 3.10
------------------
根据您的需求,选择合适的软件包版本:

.. note::

建议使用非root用户安装

.. raw:: html

<script type="text/javascript" src="../../_static/ascend_actions.js"></script>
Expand Down Expand Up @@ -87,12 +91,12 @@ Python 3.8, 3.9, 3.10
<p><b>安装依赖</b></p>
<div class="highlight-default notranslate" id="install-dependencies-ubuntu">
<div class="highlight">
<pre>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</pre>
<pre>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</pre>
</div>
</div>
<div class="highlight-default notranslate" id="install-dependencies-openeuler">
<div class="highlight">
<pre>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</pre>
<pre>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</pre>
</div>
</div>
<p><b>创建驱动运行用户</b></p>
Expand All @@ -114,13 +118,17 @@ Python 3.8, 3.9, 3.10
<pre></pre>
</div>
</div>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>根据提示决定是否需要重启系统</p>
</div>
</section>
<section id="install_cann_section">
<h3>安装CANN</h3>
<p><b>安装python依赖</b></p>
<div class="highlight-default notranslate">
<div class="highlight">
<pre>pip3 install attrs numpy decorator sympy cffi pyyaml pathlib2 psutil protobuf scipy requests absl-py wheel typing_extensions</pre>
<pre>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</pre>
</div>
</div>
<p><b>下载并安装</b></p>
Expand All @@ -140,7 +148,7 @@ Python 3.8, 3.9, 3.10
<p><b>设置环境变量</b></p>
<div class="highlight-default notranslate">
<div class="highlight">
<pre>echo "source /usr/local/Ascend/ascend-toolkit/set_env.sh" >> ~/.bashrc<br>source ~/.bashrc</pre>
<pre>echo "source ~/Ascend/ascend-toolkit/set_env.sh" >> ~/.bashrc<br>source ~/.bashrc</pre>
</div>
</div>
</section>
Expand Down Expand Up @@ -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 |
+======================+===============+====================================================+
... ...
**验证固件**

Expand All @@ -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.
卸载
Expand All @@ -235,4 +230,4 @@ Python 3.8, 3.9, 3.10

.. code-block:: bash
<path>/ascend-toolkit/<cann_version>/{arch}-linux/script/uninstall.sh
~/Ascend/ascend-toolkit/<cann_version>/{arch}-linux/script/uninstall.sh
36 changes: 31 additions & 5 deletions sources/pytorch/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,57 @@
</div>
</div>

.. warning::

非Docker的安装方式,需要根据上述表格的建议 :doc:`安装<../ascend/quick_install>` CANN-toolkit版本。


安装 PyTorch
----------------
.. raw:: html

<section id="install-pytorch-docker-section">
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>请确保已经<a class="reference internal" href="../ascend/quick_install.html"><span class="doc">安装</span></a>了与上述CANN-toolkit版本匹配的驱动和固件。</p>
</div>
<div class="highlight">
<pre></pre>
</div>
</section>
<section id="install-pytorch-pip-section">
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>请确保已经根据上述表格建议<a class="reference internal" href="../ascend/quick_install.html"><span class="doc">安装</span></a>了对应的CANN-toolkit版本以及相应的固件和驱动,并应用了CANN-toolkit环境变量。</p>
</div>
<div class="highlight">
<pre></pre>
</div>
</section>
<div id="install-pytorch-source-section">
<section>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>请确保已经根据上述表格建议<a class="reference internal" href="../ascend/quick_install.html"><span class="doc">安装</span></a>了对应的CANN-toolkit版本以及相应的固件和驱动,并应用了CANN-toolkit环境变量。</p>
</div>
<h3>环境依赖</h3>
<p>1. Python 3.8 ~ 3.10<br>2. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)</p>
<ol>
<li>Python 3.8 ~ 3.10</li>
<li>支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)</li>
<li><a class="reference internal" href="https://docs.anaconda.com/free/miniconda/#quick-command-line-install"><span class="doc">Conda (可选)</span></a></li>
</ol>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>如果使用Conda,请确保CANN-toolkit依赖的Python包在Conda环境中已经<a class="reference internal" href="../ascend/quick_install.html"><span class="doc">安装</span></a></p>
</div>
<div class="admonition warning">
<p class="admonition-title">警告</p>
<p>不建议您使用Conda提供的gcc,可能需要解决一些编译依赖问题,如果一定要使用,可参考以下命令:</p>
</div>
<div class="highlight"><pre>conda install -c conda-forge libstdcxx-ng libgcc-ng gcc=9.4 gxx=9.4</pre></div>
</section>
<section>
<div class="admonition note">
<p class="admonition-title">备注</p>
<p>请确认CXX11_ABI是关闭的,如果无法确定,建议显式关闭:</p>
</div>
<div class="highlight"><pre>export _GLIBCXX_USE_CXX11_ABI=0</pre></div>
<h3>构建</h3>
<div class="highlight">
<pre></pre>
Expand Down

0 comments on commit 7bbad00

Please sign in to comment.