Update MACA

repos 2024-12-24 14:46:11 +08:00
parent c7d8840169
commit 73092e5fbc

165
MACA.md

@ -250,109 +250,10 @@
- 如果不使用 PyTorch Extension 功能,可以不配置 cu-bridge 环境。关于 PyTorch Extension 功能,参见官网描述。
## Pypi源配置
## Pypi安装
### 一次性安装
- **使用以下命令一次性安装指定包**
```bash
pip install <PKG Name> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host https://repos.metax-tech.com
```
### 永久配置
- **如需永久配置 PyPI 源,使用以下命令**
```bash
pip config set global.index-url https://repos.metax-tech.com/r/maca-pypi/simple
pip config set global.trusted-host https://repos.metax-tech.com
### 列出可用版本
- **对于 pip 22.0 及之前版本,使用以下命令触发错误并列出包的所有可用版本**
```bash
pip install <package>== -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **对于 pip 22.0 之后版本,使用以下命令列出某个包的所有可用版本**
```bash
pip index versions <package> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
## Conda源配置
### 一次性安装
- **使用以下命令一次性安装指定包**
```bash
conda install <PKG Name> -c https://repos.metax-tech.com/r/maca-conda/
```
### 永久配置
- **添加新channels**
```bash
conda config --add channels https://repos.metax-tech.com/r/maca-conda/
conda config --set show_channel_urls yes
```
- **删除默认channels**
```bash
conda config --remove channels defaults
或者手动方式
For Linux sed -i.bak '/- defaults/d' ~/.condarc
For Windows 在文件 %USERPROFILE%/.condarc 中删除 "- defaults" 这一行
```
### 列出可用版本
-
```bash
conda search <PKG Name> --info -c https://repos.metax-tech.com/r/maca-conda/
```
## 兼容性
- 当前仓库仅支持 Python 3.8 和 Python 3.10 版本。
- 当前仓库仅支持cpython编译器。
## 安装指南
- **1.安装 mcPyTorch**
```bash
使用 pip 安装
pip install torch==<version> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **2. 安装 mcFlashattn**
```bash
使用 pip 安装
pip install flash_attn==<version> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **3.安装 mcTorchvision(可选)**
```bash
使用 pip 安装
pip install torchvision==<version> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **4.安装mcTorchaudio(可选)**
```bash
使用 pip 安装
pip install torchaudio==<version> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **5.安装 mcApex(可选)**
```bash
使用 pip 安装
pip install apex==<version> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **6.安装 mcTriton(可选)**
```bash
使用 pip 安装
pip install triton==<version> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **7.通过requirements.txt安装**
maca-pypi源地址预设在requirement.txt 文件中,用户执行命令不需关注maca-pypi源地址
### 通过requirements.txt安装
- **maca-pypi源地址预设在requirement.txt 文件中,用户执行命令不需关注maca-pypi源地址**
```bash
cat <<EOF> ./requirements.txt
-i https://repos.metax-tech.com/r/maca-pypi/simple
@ -372,7 +273,7 @@
pip install -r ./requirements.txt
```
在命令行中指定 maca-pypi 源地址
- **在命令行中指定 maca-pypi 源地址**
```bash
cat <<EOF> ./requirements.txt
apex
@ -392,35 +293,41 @@
```
## 验证安装
- **运行前设置环境变量**
### 单包安装
- **使用以下命令安装指定包**
```bash
export MACA_PATH=/opt/maca/
export LD_LIBRARY_PATH=${MACA_PATH}/lib:${MACA_PATH}/mxgpu_llvm/lib:${LD_LIBRARY_PATH}
export MACA_CLANG_PATH=${MACA_PATH}/mxgpu_llvm/bin
export PYTORCH_USE_FLASHATTN=1
```
- **如果使用PyTorch Extension功能,需要安装cu-bridge环境,并额外设置以下环境变量**
```bash
export CUDA_PATH=/opt/maca/tools/cu-bridge/
export CUCC_PATH=/opt/maca/tools/cu-bridge/
export PATH=${CUCC_PATH}/tools:${CUCC_PATH}/bin:${PATH}
```
- **执行以下命令,会输出 `"tensor([1., 1.], device='cuda:0')"` 即表明安装成功**
```bash
python -c "import torch; print(torch.ones(2).cuda())"
```
## 卸载
- **卸载mcPyTorch**
```bash
pip uninstall <PKG Name>
pip install <package> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
### 列出可用版本
- **对于 pip 22.0 及之前版本,使用以下命令触发错误并列出包的所有可用版本**
```bash
pip install <package>== -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
- **对于 pip 22.0 之后版本,使用以下命令列出某个包的所有可用版本**
```bash
pip index versions <package> -i https://repos.metax-tech.com/r/maca-pypi/simple --trusted-host repos.metax-tech.com
```
## Conda安装
### 单包安装
- **使用以下命令安装指定包**
```bash
conda install <PKG Name> -c https://repos.metax-tech.com/r/maca-conda/
```
### 列出可用版本
-
```bash
conda search <PKG Name> --info -c https://repos.metax-tech.com/r/maca-conda/
```
## 兼容性
- 当前仓库仅支持 Python 3.8 和 Python 3.10 版本。
- 当前仓库仅支持cpython编译器。