Skip to content

Examples

The following application examples demonstrate how to use Coral FPGA Resource Manager, to automatically scale your accelerated solutions using in-house or 3rd-party accelerators, from high-level programming languages.

1. Prerequisites-

  • Docker Community Edition (CE)

  • FPGA Runtime (Intel or Xilinx)

  • Git | OpenJDK (Java Development Kit) 8 | Maven

  • OpenCV 3.4.2

Amazon F1

Find InAccel Default Image, equipped with all the required development tools (and many more), available free on EC2 Community AMIs section.

2. Download InAccel-

git clone https://bitbucket.org/inaccel/release.git inaccel && cd inaccel

Computer Vision-

Acknowledgements:

The Computer vision accelerators (FPGA bitstreams/kernels) used for the purposes of this demonstation are written by developers at Xilinx.

Resources:


Launching InAccel Coral-

To start inaccel-coral container service:

MY_PLATFORM=$(pwd)/examples/coral/amazonf1/platform

docker run --name "inaccel-coral" \
    -h coral -p 55677:55677 \
    --ipc=host --privileged --restart=on-failure \
    -v ${MY_PLATFORM}:/opt/inaccel/platform \
    -e CORAL_HOSTNAME="coral" -e CORAL_PORT="55677" \
    -e CORAL_MAX_SLAVES="2" \
    -v ${XILINX_XRT}:/opt/inaccel/rte -e XILINX_XRT="/opt/inaccel/rte" \
    -d "inaccel/coral-free:current-amazonf1"
MY_PLATFORM=$(pwd)/examples/coral/alveou200/platform

docker run --name "inaccel-coral" \
    -h coral -p 55677:55677 \
    --ipc=host --privileged --restart=on-failure \
    -v ${MY_PLATFORM}:/opt/inaccel/platform \
    -e CORAL_HOSTNAME="coral" -e CORAL_PORT="55677" \
    -e CORAL_MAX_SLAVES="2" \
    -v ${XILINX_XRT}:/opt/inaccel/rte -e XILINX_XRT="/opt/inaccel/rte" \
    -d "inaccel/coral-free:current-alveou200"

Building the Examples-

To build the example programs, run:

mvn -f examples/coral/pom.xml package

Running the Examples-

Run Affine Application [src]

bin/run-coral-example vision.Affine data/vision

Run Convolve Application [src]

bin/run-coral-example vision.Convolve data/vision

Run EdgeDetection Application [src]

bin/run-coral-example vision.EdgeDetection data/vision

Logistic Regression with Apache Arrow-

Launching InAccel Coral-

To start inaccel-coral container service:

MY_PLATFORM=$(pwd)/examples/coral/amazonf1/platform

docker run --name "inaccel-coral" \
    -h coral -p 55677:55677 \
    --ipc=host --privileged --restart=on-failure \
    -v ${MY_PLATFORM}:/opt/inaccel/platform \
    -e CORAL_HOSTNAME="coral" -e CORAL_PORT="55677" \
    -e CORAL_MAX_SLAVES="2" \
    -v ${XILINX_XRT}:/opt/inaccel/rte -e XILINX_XRT="/opt/inaccel/rte" \
    -d "inaccel/coral-free:current-amazonf1"
MY_PLATFORM=$(pwd)/examples/coral/alveou200/platform

docker run --name "inaccel-coral" \
    -h coral -p 55677:55677 \
    --ipc=host --privileged --restart=on-failure \
    -v ${MY_PLATFORM}:/opt/inaccel/platform \
    -e CORAL_HOSTNAME="coral" -e CORAL_PORT="55677" \
    -e CORAL_MAX_SLAVES="2" \
    -v ${XILINX_XRT}:/opt/inaccel/rte -e XILINX_XRT="/opt/inaccel/rte" \
    -d "inaccel/coral-free:current-alveou200"

Load datasets into target file system

The datasets will be read in from inaccel-demo s3 bucket.


picture

bin/load-demo-data-file nist/letters_libsvm_train.csv
bin/load-demo-data-file nist/letters_libsvm_test.csv

Building the Examples-

To build the example programs, run:

mvn -f examples/arrow/pom.xml package

Running the Examples-

Run Logistic Regression powered by Apache Arrow [src]

bin/run-arrow-example ml.ArrowLogisticRegressionExample \
    --trainSet data/nist/letters_libsvm_train.csv \
    --testSet data/nist/letters_libsvm_test.csv \
    --numFeatures 784 \
    --numClasses 26 \
    --maxIter 100 \
    --inaccel true