Skip to content

Commit

Permalink
deploy: ede2554
Browse files Browse the repository at this point in the history
  • Loading branch information
FFFrog committed Jun 3, 2024
0 parents commit 76cae85
Show file tree
Hide file tree
Showing 56 changed files with 7,062 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 1edb04168cf61dbf49438e384b102252
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added .doctrees/environment.pickle
Binary file not shown.
Binary file added .doctrees/index.doctree
Binary file not shown.
Binary file added .doctrees/sources/ascend/quick_install.doctree
Binary file not shown.
Binary file added .doctrees/sources/pytorch/install.doctree
Binary file not shown.
Empty file added .nojekyll
Empty file.
30 changes: 30 additions & 0 deletions _sources/index.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
昇腾AI处理器快速入门指南
==================================================

.. -----------------------------------------
.. Page TOC
.. -----------------------------------------
.. toctree::
:maxdepth: 2
:hidden:
:includehidden:
:caption: Get Started

sources/ascend/quick_install.rst

.. toctree::
:maxdepth: 2
:hidden:
:includehidden:
:caption: PyTorch

sources/pytorch/install.rst


.. warning::

文档仍在开发中,内容可能存在错误,内容可能会随时更新,请勿将其用于生产环境。

选择您的偏好,并按照 :doc:`快速安装昇腾环境<sources/ascend/quick_install>` 的安装指导进行操作。

安装成功后,请参考快速开始和样例来开始使用昇腾AI处理器。
231 changes: 231 additions & 0 deletions _sources/sources/ascend/quick_install.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
快速安装昇腾环境
================

跟随指导,在您的机器上快速安装昇腾环境。

1. 系统要求
----------------
1.1 前置检查
^^^^^^^^^^^^^
确认昇腾AI处理器已经安装妥当
::

lspci | grep 'Processing accelerators'

确认操作系统架构及版本
::

uname -m && cat /etc/*release


1.2 软件要求
^^^^^^^^^^^^^
======== ========================================
软件 版本
======== ========================================
操作系统 openEuler20.03/22.03, Ubuntu 20.04/24.04
Python 3.8, 3.9, 3.10
======== ========================================


2. 环境安装
------------------
根据您的需求,选择合适的软件包版本:

.. raw:: html

<script type="text/javascript" src="../../_static/ascend_actions.js"></script>
<div id="div-installation" style="">
<div class="row">
<div class="row-element-1" id="col-headings">
<div class="headings-element">安装方式</div>
<div class="headings-element">操作系统</div>
<div class="headings-element" id="header-os_version">操作系统版本</div>
<div class="headings-element">CPU架构</div>
<div class="headings-element">NPU型号</div>
<div class="headings-element" id="header-python_version">Python版本</div>
<div class="headings-element">昇腾套件版本</div>
</div>
<div class="row-element-2" id="col-values">
<div class="row" id="row-install_type">
<div class="mobile-headings">安装方式</div>
<div class="values-element block-2 install-type selected" id="install_type-direct">直接安装</div>
<div class="values-element block-2 install-type" id="install_type-docker">Docker</div>
</div>
<div class="row" id="row-os">
<div class="mobile-headings">操作系统</div>
<div class="values-element block-2 install-os selected" id="os-openeuler">openEuler</div>
<div class="values-element block-2 install-os" id="os-ubuntu">Ubuntu</div>
</div>
<div class="row" id="row-os_version">
<div class="mobile-headings">操作系统版本</div>
</div>
<div class="row" id="row-arch">
<div class="mobile-headings">CPU架构</div>
<div class="values-element block-2 install-arch" id="arch-x86_64">x86-64</div>
<div class="values-element block-2 install-arch selected" id="arch-aarch64">aarch64</div>
</div>
<div class="row" id="row-npu">
<div class="mobile-headings">NPU型号</div>
<div class="values-element block-2 install-npu selected" id="npu-910b">Atlas 300T A2 训练卡</div>
<div class="values-element block-2 install-npu" id="npu-310p">Atlas 300I Pro 推理卡</div>
</div>
<div class="row" id="row-python_version">
<div class="mobile-headings">Python版本</div>
</div>
<div class="row" id="row-ascend_version">
<div class="mobile-headings">昇腾套件版本</div>
<select class="values-element block-3 install-package" id="cann-version">
<option value="na">Select CANN Version</option>
</select>
<div class="values-element block-3 install-package" id="driver-version">Driver</div>
<div class="values-element block-3 install-package" id="firmware-version">Firmware</div>
</div>
</div>
</div>
<div id="install-instructions" style="display:none;">
<section>
<h3>2.1 安装驱动</h3>
<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>
</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>
</div>
</div>
<p><b>创建驱动运行用户</b></p>
<div class="highlight-default notranslate">
<div class="highlight">
<pre>sudo groupadd -g HwHiAiUser<br>sudo useradd -g HwHiAiUser -d /home/HwHiAiUser -m HwHiAiUser -s /bin/bash<br>sudo usermod -aG HwHiAiUser $USER</pre>
</div>
</div>
<p><b>下载并安装</b></p>
<div class="highlight-default notranslate">
<div class="highlight">
<pre id="install_drvier"></pre>
</div>
</div>
<section>
<h3>2.2 安装固件</h3>
<div class="highlight-default notranslate">
<div class="highlight">
<pre id="install_firmware"></pre>
</div>
</div>
</section>
<section id="install_cann_section">
<h3>2.3 安装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>
</div>
</div>
<p><b>下载并安装</b></p>
<div class="highlight-default notranslate">
<div class="highlight">
<pre id="install_cann"></pre>
</div>
</div>
<div id="install_kernel_section">
<p><b>安装算子包(可选)</b></p>
<div class="highlight-default notranslate">
<div class="highlight">
<pre id="install_kernel"></pre>
</div>
</div>
</div>
<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>
</div>
</div>
</section>
<section id="use_docker_section">
<h3>2.3 使用Docker镜像</h3>
<div class="highlight-default notranslate">
<div class="highlight">
<pre id="use_docker"></pre>
</div>
</div>
</section>
</section>
</div>
</div>


3. 验证安装(可选)
---------------------
**验证驱动**

确认您的驱动是否安装成功,可以通过以下命令验证:``npu-smi info``
,若出现以下回显信息,说明驱动安装成功。
::

+-------------------------------------------------------------------------------------------+
| npu-smi 23.0.2 Version: 23.0.2 |
+----------------------+---------------+----------------------------------------------------+
| NPU Name | Health | Power(W) Temp(C) Hugepages-Usage(page)|
| Chip | Bus-Id | AICore(%) Memory-Usage(MB) HBM-Usage(MB) |
+======================+===============+====================================================+
| 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 |
+======================+===============+====================================================+

**验证固件**

安装固件后,若系统出现如下关键回显信息,表示固件安装成功。
::

Firmware package installed successfully!

**验证CANN-toolkit**

安装CANN-toolkit后,若系统出现以下关键回显信息,表示CANN-toolkit安装成功。
::

[INFO] Ascend-cann-toolkit install success


4. 卸载
----------
**卸载驱动**
::

sudo /usr/local/Ascend/firmware/script/uninstall.sh

**卸载固件**
::

sudo /usr/local/Ascend/driver/script/uninstall.sh

**卸载CANN-toolkit**
::

<path>/ascend-toolkit/<cann_version>/{arch}-linux/script/uninstall.sh
114 changes: 114 additions & 0 deletions _sources/sources/pytorch/install.rst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
安装PyTorch和PyTorch-NPU
===========================

跟随指导,安装在NPU上运行的PyTorch版本。


1. 选择需要安装的PyTorch版本
------------------------------
根据您的需求,选择合适的PyTorch和CANN版本:

.. raw:: html

<script type="text/javascript" src="../../_static/pytorch_actions.js"></script>
<div id="div-installation" style="">
<div class="row">
<div class="row-element-1" id="col-headings">
<div class="headings-element">PyTorch版本</div>
<div class="headings-element">PyTorch-NPU版本</div>
<div class="headings-element">CANN-toolkit版本</div>
<div class="headings-element">CPU架构</div>
<div class="headings-element">安装方式</div>
</div>
<div class="row-element-2" id="col-values">
<div class="row" id="row-pytorch">
<div class="mobile-headings">PyTorch版本</div>
<div class="values-element block-3 install-pytorch selected" id="pytorch-2.2.0">2.2.0</div>
<div class="values-element block-3 install-pytorch" id="pytorch-2.1.0">2.1.0</div>
<div class="values-element block-3 install-pytorch" id="pytorch-2.0.1">2.0.1</div>
</div>
<div class="row" id="row-pytorch_npu">
<div class="mobile-headings">PyTorch-NPU版本</div>
<div class="values-element block-1 install-pytorch_npu selected" id="pytorch_npu-version">null</div>
</div>
<div class="row" id="row-cann">
<div class="mobile-headings">CANN-toolkit版本</div>
<div class="values-element block-1 install-cann selected" id="cann-version">null</div>
</div>
<div class="row" id="row-arch">
<div class="mobile-headings">CPU架构</div>
<div class="values-element block-2 install-arch" id="arch-x86_64">x86-64</div>
<div class="values-element block-2 install-arch selected" id="arch-aarch64">aarch64</div>
</div>
<div class="row" id="row-install_type">
<div class="mobile-headings">安装方式</div>
<div class="values-element block-2 install-type selected" id="install_type-pip">pip</div>
<div class="values-element block-2 install-type" id="install_type-source">源码构建</div>
</div>
</div>
</div>
</div>


请先根据上述表格建议的CANN-toolkit版本 :doc:`安装昇腾环境<../ascend/quick_install>`。


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

<section id="install-pytorch-pip-section">
<p><b>使用pip安装</b></p>
<div class="highlight">
<pre id="install-pytorch-pip"></pre>
</div>
</section>
<div id="install-pytorch-source-section">
<section>
<h3>2.1 环境依赖</h3>
<p>1. Python 3.8及以上<br>2. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)</p>
</section>
<section>
<h3>2.2 构建</h3>
<div class="highlight">
<pre id="install-pytorch-source-build"></pre>
</div>
</section>
</div>

3. 安装PyTorch-NPU
--------------------

.. raw:: html

<section id="install-pytorch_npu-pip-section">
<p><b>使用pip安装</b></p>
<div class="highlight">
<pre id="install-pytorch_npu-pip"></pre>
</div>
</section>
<div id="install-pytorch_npu-source-section">
<section>
<h3>3.1 环境依赖</h3>
<p>1. Python 3.8 ~ 3.10<br>2. 支持C++17的编译器,例如clang 或者 gcc (9.4.0及以上)</p>
</section>
<section>
<h3>3.2 构建</h3>
<div class="highlight">
<pre id="install-pytorch_npu-source-build"></pre>
</div>
</section>
</div>

4. 验证安装结果
------------------

::

import torch
import torch_npu

torch.npu.set_device(0)
a = torch.randn(2,3).to('npu')
b = torch.randn(2,3).to('npu')
a + b
Loading

0 comments on commit 76cae85

Please sign in to comment.