Metadata-Version: 2.4
Name: unofficial-ascend-tools
Version: 0.0.8.post6
Summary: unofficial-ascend-tools
Home-page: https://gitee.com/yuncliu/unofficial-ascend-tools
License: Apache
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >= 3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

## 简介

hccl在未做适配前需要配置/etc/hccl_rootinfo.json文件才能运行，该文件中包含

1. NPU的地址信息
1. 拓扑文件路径，拓扑文件中描述了NPU之间的互联关系


## 安装

### 在线安装
```bash
python3 -m pip install unofficial-ascend-tools
```

### 本地安装

下载好whl软件包
```bash
python3 -m pip install ./<软件包文件>.hwl
```


### 从源码构建

首先进入源码目录（指包含setup.py的目录）

```bash
python3 -m pip install setuptools wheel   #安装构建工具
python3 ./setup.py bdist_wheel   # 构建安装包
python3 -m pip install dist/*.whl  #  安装
```

### 安装可能遇到的问题

#### 1. 使用代理时报证书相关错误

原因:代理软件可能无法正确处理证书

解决方法：

1. 使用--trusted-host参数指定不校验正式，详细用法请查看pip的参数说明

2. 配置pip使用http源

#### 2.操作系统报错可能破坏系统依赖

报错信息类似

```bash
× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
```

原因是，部分python软件包存在两种os源和pip源两种安装方式，当使用pip源安装时可能会破坏os源安装的软件包，因此os提示危险操作

**解决方法:**

1.使用virtualenv方式,例如python自带的venv或者conda均可，以venv为例

```bash
python3 -m venv  myenv
source myenv/bin/activate
#激活虚拟环境后再安装即可
```

2.不推荐，添加--break-system-packages选项强制安装

#### 3. OS缺乏pip、venv等工具

**原因** 操作系统中相关软件包没有安装

**解决办法:**

1.yum包管理器,适用与openeuler等os

```bash
yum makecache
yum install python3-pip python3-venv
```

2.apt包管理器,适用于ubuntu、debian等os

```bash
apt-get update
apt-get install python3-pip python3-venv
```

## 使用工具生成/etc/hccl_rootinfo.json

### 备份之前的文件(可选）

检查/etc/hccl_rootinfo.json 文件是否存在， 如果存在，建议备份

### 生成rootinfo文件

```bash
mindcluster-tools rootinfo -o /etc/hccl_rootinfo.json
```

如果不指定-o参数， 工具会在执行命令的当前目录生产new_hccl_rootinfo.json文件, 需要手动将文件拷贝到`/etc/hccl_rootinfo.json`

**注意**: 由于机型较多，部分未适配机型可能报错，如果报错，需要手动指定topo文件，详见下一个章节

### 手动指定拓扑文件

```bash
mindcluster-tools rootinfo -t <path_to_topo_file> -o /etc/hccl_rootinfo.json
```

**注意**: <path_to_topo_file> 要替换成拓扑文件的绝对路径
