1 Star 0 Fork 270

geekgaoxiang / op-plugin

forked from Ascend / op-plugin 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

AscendPyTorch OpPlugin

简介

本项目开发了NPU PyTorch算子插件,为使用PyTorch框架的开发者提供便捷的NPU算子库调用能力。 OP-Plugin算子插件的编译、使用依赖昇腾PyTorch Adapter。因此,在编译op_plugin之前,需要了解、安装昇腾PyTorch。使用手册可参考昇腾社区pytorch

编译、安装op_plugin

发布包安装

暂未正式发布

源码安装

安装依赖

安装时需要安装系统依赖及官方PyTorch框架。安装指导可参考昇腾pytorch社区安装依赖

  1. 配置CANN环境变量脚本。

    source <CANN软件安装目录>/<CANN软件路径>/set_env.sh

    环境变量脚本的默认路径一般为:/usr/local/Ascend/ascend-toolkit/set_env.sh,其中ascend-toolkit路径取决于安装的CANN软件名称。

  2. 编译生成插件的二进制安装包。

    下载对应op_plugin版本分支代码,进入插件根目录,以master为例

    git clone https://gitee.com/ascend/op-plugin.git
    cd op-plugin

    可指定Python版本编包。如,--python3.8(缺省) 或 --python3.9 可指定昇腾pytorch版本编包。当前支持昇腾pytorch 1.11/2.0/2.1(master)版本。如,--pytorch=master(缺省) 或 --pytorch=v1.11.0 或 --pytorch=v2.0.1。

    bash ci/build.sh --python=3.8 --pytorch=master

    编译过程中,会在插件根目录新建build文件夹,并下载昇腾pytorch对应版本的源码,协同编译。 若build/pytorch目录存在,则编译op-plugin时,不再重复下载昇腾pytorch源码。如需下载所依赖的最新昇腾pytorch源码,删除build/pytorch目录即可。

  3. 完成编译后,安装dist目录下生成的插件torch_npu包,如果使用非root用户安装,需要在命令后加**--user**。

    pip3 install --upgrade dist/torch_npu-1.11.0-cp37-cp37m-linux_aarch64.whl
    # 若用户在x86架构下安装插件,请替换为对应的whl包。
BSD 3-Clause License Copyright (c) 2023, Huawei Technologies Co., Ltd Copyright (c) 2019, Facebook CORPORATION. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

Ascend PyTorch OP-Plugin 展开 收起
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/geekgaoxiang/op-plugin.git
git@gitee.com:geekgaoxiang/op-plugin.git
geekgaoxiang
op-plugin
op-plugin
master

搜索帮助