Aganlengzi / paddlepaddle_ascend910

PaddlePaddle Ascend910 Plugin Demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PaddlePaddle Ascend910 Plugin Demo

This sample is a simple demo shows how to implement, build, install and run a PaddlePaddle plugin.

Supported OS

  • Linux

Prerequisites

  • CMake >= 3.10
  • Git >= 1.8
  • Python >= 3.6

build & run

  1. Install the latest paddlepaddle
$ pip install paddlepaddle
  1. In the demo code folder, configure and build
$ mkdir build
$ cd build
$ cmake .. -DWITH_KERNELS=ON
$ make
  1. Install the plugin python wheel
$ pip install dist/*.whl
  1. Now we can run the paddlepaddle and use the plug-in device
$ python
>>> import paddle
>>> paddle.device.get_all_custom_device_type()
['Ascend910']
>>> paddle.set_device('Ascend910')
>>> x = paddle.to_tensor([1])
>>> x
Tensor(shape=[1], dtype=int64, place=Place(Ascend910:0), stop_gradient=True,
       [1])

About

PaddlePaddle Ascend910 Plugin Demo


Languages

Language:C++ 95.5%Language:Python 2.5%Language:CMake 2.0%