8000 GitHub - memryx/MxAccl: MxAccl: open-source code for both the MemryX C++ runtime library and the acclBench benchmarking tool. These components enable seamless integration and performance measurement of C++ applications using the MemryX MX3 accelerator.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ MxAccl Public

MxAccl: open-source code for both the MemryX C++ runtime library and the acclBench benchmarking tool. These components enable seamless integration and performance measurement of C++ applications using the MemryX MX3 accelerator.

License

Notifications You must be signed in to change notification settings

memryx/MxAccl

Repository files navigation

MemryX Accl

MemryX SDK C++

MemryX Accl

The MxAccl repository provides the open-source code for both the mx_accl runtime library and the acclBench benchmarking tool. These components enable seamless integration and performance measurement of C++ applications using the MemryX MX3 accelerator.

MxAccl Library

The mx_accl library is designed to efficiently handle multi-model and multi-input streams. It offers:

  • Auto-threading Mode: Where the library manages send and receive threads automatically, simplifying usage.
  • Manual-threading Mode: Where the user manually creates and manages threads, providing greater control and customization.

This architecture helps maximize the performance of the MX3’s pipelined dataflow system, while also allowing users to manage resources and threading as needed.

AcclBench Tool

The acclBench command line interface tool provides an easy way to benchmark model performance on the MX3 accelerator. It measures the latency and FPS of inference operations, capturing the performance from the host side, which includes driver and interface time. acclBench supports both single and multi-stream scenarios and is built using the high-performance MxAccl C++ API.

Full Documentation

For detailed information on using the mx_accl library and acclBench tool, please visit the MemryX Developer Hub:

Note: If you are looking for the Python API for the MemryX MX3 accelerator, please visit the Developer Hub for documentation and usage examples. This repository only contains the C++ version of the library.

Repository Overview

This repository contains the source code for the core mx_accl library and associated tools. These components are typically pre-built and packaged as memx-accl within the MemryX SDK.

Folder Description
mx_accl Core MxAccl runtime library code
mx_accl/tests Unit tests for MxAccl
mx_server MXA-Manager daemon and config files
tools Utilities like acclBench

IMPORTANT: For most users, we highly recommend using the prebuilt memx-accl package provided by the MemryX SDK, as it simplifies development and ensures all dependencies are properly managed.

Recommended Installation: MemryX SDK

To simplify development and avoid building from source, install the memx-accl package through the MemryX SDK. The SDK includes precompiled libraries, drivers, and tools optimized for MemryX accelerators. Follow the installation guide for step-by-step instructions.

The MemryX Developer Hub provides comprehensive documentation, tutorials, and examples to get you started quickly.

Advanced Installation: Building from Source

For advanced users who prefer to build the MxAccl library from source, follow these instructions:

Step 1: Clone the repository

git clone https://github.com/memryx/MxAccl.git

Step 2: Build gRPC (only required if using mxa-manager)

Outside your MxAccl folder, we need to build a static library version of gRPC.

# clone and make build dirs
git clone --recurse-submodules -b v1.68.2 --depth 1 --shallow-submodules https://github.com/grpc/grpc
cd grpc
mkdir cmake/build
cd cmake/build

# configure gRPC and set it to install to $HOME/grpc_inst
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DgRPC_BUILD_GRPC_CSHARP_PLUGIN=OFF \
  -DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF -DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
  -DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF -DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF -DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \
  -DCMAKE_INSTALL_PREFIX=$HOME/grpc_inst \
  -DCMAKE_BUILD_TYPE=Release ../..

# build (will take a while)
make -j$(nproc)

# install to $HOME/grpc_inst
make install

Step 3: Build MxAccl

If you plan on using Shared mode, you will have to build gRPC above and then use Step 3a to build MxAccl.

If you're definitely only going to use one application at a time in Local mode, such as on Yocto systems, you can skip the dependency on mxa-manager (and thus gRPC) entirely with Step 3b.

Hint: if you don't care about running unit tests, use the -DBUILD_TYPE=Packaging argument!

Step 3a: with mxa-manager & gRPC support

mkdir build && cd build

# must include the path to grpc_inst here
PATH="$HOME/grpc_inst:$PATH" cmake [-DBUILD_TYPE=[Debug | Release | Packaging]] ..
make -j

Step 3b: without mxa-manager / gRPC support

mkdir build && cd build

cmake -DDISABLE_DAEMON=1 [-DBUILD_TYPE=[Debug | Release | Packaging]] ..
make -j

Additional Dependencies for Development

  • Gtest: Required for running the unit test suite. You can find it here.

  • Test Models: Download the DFPs and source models for the unit tests from this link and extract them into the mx_accl/tests/models/ folder.

Usage

MxAccl

The typical use of MxAccl is to integrate it directly into your C++ application to manage model inference on the MemryX MX3 accelerator. For complete documentation and detailed integration tutorials, visit the MxAccl Documentation and Tutorials Page.

mxa_manager

Starting with the 1.1 release, the mxa_manager process is used, even if you're not using Shared mode, for the daemon to manage locks/access to connected MX3 devices.

But, if you compile with -DDISABLE_DAEMON=1 like in Step 3b above, it can be bypassed by your applications. This is not recommended unless you have no alternative way to build gRPC for your platform.

So before starting any tests or example apps, run the mxa_manager command in a separate terminal and leave it going.

./mx_server/mxa_manager

Now to verify your setup, you can run the unit tests with the following command:

cd build
ctest

acclBench

To measure the performance (latency and FPS) of a model on the MemryX MX3 accelerator, use the acclBench command line tool. Here's how to get started:

Step 1: Obtain a DFP Model File

You can download a precompiled MobileNet DFP file from the link below:

For more information on creating and using DFP files, refer to the Hello MXA Tutorial.

Step 2: Run acclBench

Once you have the DFP file and have successfully installed the MemryX SDK, drivers, and runtime libraries, navigate to the directory where you downloaded the MobileNet DFP file and run:

acclBench -d mobilenet.dfp -f 1000
Explanation of the Command
  • -d mobilenet.dfp: Specifies the DFP model file to be used for benchmarking.
  • -f 1000: Sets the number of frames for testing inference performance. The default is 1000 frames.

Pre/Post Plugins

For Onnx, Tensorflow, and TFLite pre/post plugins, refer to the MxUtils repository. These plugins are packaged separately to minimize dependencies for the core MxAccl library and are only required if pre/post models are used.

License

MxAccl is open-source software under the permissive MIT license.

See Also

Enhance your experience with MemryX solutions by exploring the following resources:

  • Developer Hub: Access comprehensive documentation for MemryX hardware and software.
  • MemryX SDK Installation Guide: Learn how to set up essential tools and drivers to start using MemryX accelerators.
  • Tutorials: Follow detailed, step-by-step instructions for various use cases and applications.
  • Model Explorer: Discover and explore models that have been compiled and optimized for MemryX accelerators.
  • Examples: Explore a collection of end-to-end AI applications powered by MemryX hardware and software.

About

MxAccl: open-source code for both the MemryX C++ runtime library and the acclBench benchmarking tool. These components enable seamless integration and performance measurement of C++ applications using the MemryX MX3 accelerator.

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •  
0