This sample is a simple demo shows how to implement, build, install and run a PaddlePaddle plugin.
- Linux
- CMake >= 3.10
- Git >= 1.8
- Python >= 3.6
- Install the latest paddlepaddle
$ pip install paddlepaddle
- In the
demo
code folder, configure and build
$ mkdir build
$ cd build
$ cmake .. -DWITH_KERNELS=ON
$ make
- Install the plugin python wheel
$ pip install dist/*.whl
- 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])