项目作者: sunsided

项目描述 :
OpenVX in Rust - an experiment
高级语言: Rust
项目地址: git://github.com/sunsided/rust-openvx.git
创建时间: 2020-09-14T23:29:55Z
项目社区:https://github.com/sunsided/rust-openvx

开源协议:MIT License

下载


OpenVX 1.3 meets Rust



codecov

This repo consists of the following parts:

  • openvx-sys is the bindgen-generated Rust wrapper around OpenVX,
  • openvx contains a Rust-y wrapper around the sys crate.

Test applications:

Here’s an example input and output of the Canny Edge Detection sample.

  1. VX_TYPE_GRAPH: CANNY_GRAPH, 3 nodes, VX_GRAPH_STATE_COMPLETED, avg perf 0.044175636, 0 parameters, 1 refs
  2. VX_TYPE_NODE: RGB_TO_YUV, 2 params, avg perf 0.002818527, VX_SUCCESS, 1 refs
  3. VX_TYPE_NODE: EXTRACT_LUMA, 3 params, avg perf 0.002013746, VX_SUCCESS, 1 refs
  4. VX_TYPE_NODE: CANNY_EDGE, 5 params, avg perf 0.039333154, VX_SUCCESS, 1 refs

Note that for some reason the graph release operation

  1. vxReleaseGraph(&mut graph);

currently produces the following log messages with the associated status VX_ERROR_INVALID_REFERENCE:

  1. Failed to remove kernel[0]=org.khronos.extra.edge_trace
  2. Failed to remove kernel[1]=org.khronos.extra.euclidean_nonmaxsuppression_harris
  3. Failed to remove kernel[2]=org.khronos.extras.harris_score
  4. Failed to remove kernel[3]=org.khronos.extras.laplacian3x3
  5. Failed to remove kernel[4]=org.khronos.extras.image_to_list
  6. Failed to remove kernel[5]=org.khronos.extra.nonmaximasuppression
  7. Failed to remove kernel[6]=org.khronos.extra.elementwise_norm
  8. Failed to remove kernel[7]=org.khronos.extras.scharr3x3
  9. Failed to remove kernel[8]=org.khronos.extras.sobelMxN

The OpenVX 1.3 Quick Reference Guide was added here
for convenience.

WIP

To install Intel OpenCL on Ubuntu 20.04, run

  1. sudo apt-get install ocl-icd-opencl-dev intel-opencl-icd

Test using clinfo.

Install the Khronos OpenVX Sample Implementation

  1. git clone --recursive https://github.com/KhronosGroup/OpenVX-sample-impl

I built from commit 9caba36 by using

  1. python Build.py \
  2. --os=Linux --arch=64 --conf=Release \
  3. --c=clang --cpp=clang \
  4. --conf_vision --conf_nn \
  5. --opencl_interop --enh_vision --ix \
  6. --streaming --pipelining

The commit was added as a git submodule at vendor/openvx-sample-impl for convenience.

Building using --conf_nnef (the Neural Network Exchange Format) didn’t work for some
reason, and specifying --opencl always targeted NEON architecture, so didn’t work.

To build the Rust projects, make sure the OpenVX library and headers are in scope:

  1. export OPENVX_DIR=/path/to/OpenVX-sample-impl/install/Linux/x64/Release
  2. export LIBRARY_PATH=$LIBRARY_PATH:$OPENVX_DIR/bin
  3. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPENVX_DIR/bin

Further reading