已合并
算子直调+aclgraph示例代码readme增加编译选项说明 #4081
mihudan创建于 1月20日
算子直调+aclgraph示例代码readme增加编译选项说明 #4081
已合并
共 4 个文件变更+16-5
| @@ -127,8 +127,8 @@ | |||
| 127 | 1. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch | 127 | 1. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch |
| 128 | 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。 | 128 | 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。 |
| 129 | 129 | ||
| 130 | - 本样例需torch2.6.0版本以上,支持`backend="npugraph_ex"`需7.3.0版本以上。 | 130 | + 本样例需torch2.6.0及以上版本,支持`backend="npugraph_ex"`需7.3.0及以上版本。 |
| 131 | -2. 根据实际环境安装CANN toolkit包,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。 | 131 | +2. 根据实际环境安装CANN toolkit包,本样例需8.5.0及以上版本,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。 |
| 132 | 3. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装: | 132 | 3. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装: |
| 133 | 133 | ||
| 134 | ```bash | 134 | ```bash |
| @@ -152,6 +152,8 @@ | |||
| 152 | 152 | ||
| 153 | 153 | ||
| 154 | - 样例执行 | 154 | - 样例执行 |
| 155 | + | ||
| 156 | + 参考[表格](https://www.hiascend.com/document/detail/zh/canncommercial/850/opdevg/BishengCompiler/atlas_bisheng_10_0010.html),根据实际昇腾AI处理器架构修改[setup.py](./setup.py)中的--npu-arch参数,并执行如下命令: | ||
| 155 | 157 | ||
| 156 | ```bash | 158 | ```bash |
| 157 | python setup.py bdist_wheel | 159 | python setup.py bdist_wheel |
| @@ -58,6 +58,9 @@ class AscendBuildExtension(build_ext): | |||
| 58 | ext_fullpath = self.get_ext_fullpath(ext.name) | 58 | ext_fullpath = self.get_ext_fullpath(ext.name) |
| 59 | os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True) | 59 | os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True) |
| 60 | 60 | ||
| 61 | + use_cxx11_abi = torch._C._GLIBCXX_USE_CXX11_ABI | ||
| 62 | + abi_value = "1" if use_cxx11_abi else "0" | ||
| 63 | + | ||
| 61 | compile_cmd = [ | 64 | compile_cmd = [ |
| 62 | "bisheng", | 65 | "bisheng", |
| 63 | "-x", "asc", | 66 | "-x", "asc", |
| @@ -65,6 +68,7 @@ class AscendBuildExtension(build_ext): | |||
| 65 | "-shared", | 68 | "-shared", |
| 66 | "-fPIC", | 69 | "-fPIC", |
| 67 | "-std=c++17", | 70 | "-std=c++17", |
| 71 | + f"-D_GLIBCXX_USE_CXX11_ABI={abi_value}", | ||
| 68 | "-ltorch_npu", "-ltorch", "-lc10", | 72 | "-ltorch_npu", "-ltorch", "-lc10", |
| 69 | *ext.sources, | 73 | *ext.sources, |
| 70 | "-o", ext_fullpath, | 74 | "-o", ext_fullpath, |
| @@ -126,8 +126,8 @@ | |||
| 126 | 1. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch | 126 | 1. 请参考与您当前使用的版本配套的[《Ascend Extension for PyTorch |
| 127 | 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。 | 127 | 软件安装指南》](https://www.hiascend.com/document/detail/zh/Pytorch/720/configandinstg/instg/insg_0001.html),获取PyTorch和torch_npu详细的安装步骤。 |
| 128 | 128 | ||
| 129 | - 本样例需torch2.6.0版本以上,支持`backend="npugraph_ex"`需7.3.0版本以上。 | 129 | + 本样例需torch2.6.0及以上版本,支持`backend="npugraph_ex"`需7.3.0及以上版本。 |
| 130 | -2. 根据实际环境安装CANN toolkit包,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。 | 130 | +2. 根据实际环境安装CANN toolkit包,本样例需8.5.0及以上版本,安装指导详见《[CANN 软件安装指南](https://www.hiascend.com/document/redirect/CannCommunityInstSoftware)》。 |
| 131 | 3. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装: | 131 | 3. 根据实际环境安装CANN ops包。根据产品型号和环境架构,下载对应安装包,可参考[下载链接](https://ascend.devcloud.huaweicloud.com/cann/run/software/8.5.0-beta.1)并执行如下命令安装: |
| 132 | 132 | ||
| 133 | ```bash | 133 | ```bash |
| @@ -151,7 +151,8 @@ | |||
| 151 | 151 | ||
| 152 | 152 | ||
| 153 | - 样例执行 | 153 | - 样例执行 |
| 154 | - | 154 | + |
| 155 | + 参考[表格](https://www.hiascend.com/document/detail/zh/canncommercial/850/opdevg/BishengCompiler/atlas_bisheng_10_0010.html),根据实际昇腾AI处理器架构修改[setup.py](./setup.py)中的--npu-arch参数,并执行如下命令: | ||
| 155 | ```bash | 156 | ```bash |
| 156 | python setup.py bdist_wheel | 157 | python setup.py bdist_wheel |
| 157 | pip install dist/*.whl --force-reinstall | 158 | pip install dist/*.whl --force-reinstall |
| @@ -58,6 +58,9 @@ class AscendBuildExtension(build_ext): | |||
| 58 | ext_fullpath = self.get_ext_fullpath(ext.name) | 58 | ext_fullpath = self.get_ext_fullpath(ext.name) |
| 59 | os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True) | 59 | os.makedirs(os.path.dirname(ext_fullpath), exist_ok=True) |
| 60 | 60 | ||
| 61 | + use_cxx11_abi = torch._C._GLIBCXX_USE_CXX11_ABI | ||
| 62 | + abi_value = "1" if use_cxx11_abi else "0" | ||
| 63 | + | ||
| 61 | compile_cmd = [ | 64 | compile_cmd = [ |
| 62 | "bisheng", | 65 | "bisheng", |
| 63 | "-x", "asc", | 66 | "-x", "asc", |
| @@ -65,6 +68,7 @@ class AscendBuildExtension(build_ext): | |||
| 65 | "-shared", | 68 | "-shared", |
| 66 | "-fPIC", | 69 | "-fPIC", |
| 67 | "-std=c++17", | 70 | "-std=c++17", |
| 71 | + f"-D_GLIBCXX_USE_CXX11_ABI={abi_value}", | ||
| 68 | "-ltorch_npu", "-ltorch", "-lc10", | 72 | "-ltorch_npu", "-ltorch", "-lc10", |
| 69 | *ext.sources, | 73 | *ext.sources, |
| 70 | "-o", ext_fullpath, | 74 | "-o", ext_fullpath, |