Hello, MXA!#
This guide will walk you through verifying that the MemryX hardware and software are functioning properly in your system. We will accomplish this by downloading, compiling, and running the lightweight model MobileNet, and benchmarking its performance by running 1000 frames of random data through the MemryX Accelerator (MXA).
Note
Ensure you have completed all the steps in the Get Started guide before proceeding.
Verify Installation#
Before proceeding with the model, let’s verify that the MemryX hardware and runtime software are correctly installed. This ensures that the MXA is detected and fully operational on your system. Use the following command to check the health of the MXA connection and retrieve basic information about the accelerator:
mx_bench --hello
Expected Output:
Hello from MXA!
Group: 0
Number of chips: 4
Interface: PCIe 3.0
Device Map:
/dev/memx0
If you see the output above, your hardware and runtime software are correctly installed, and you can move to the next step. Otherwise, refer to the troubleshooting guide for assistance.
Download and Compile the Model#
Next, we will download and compile the MobileNet model using the MemryX Neural Compiler. This step will verify that both the compiler and SDK tools are installed and functioning as expected. Run the following command to download and compile the MobileNet model:
python3 -c "import tensorflow as tf; tf.keras.applications.MobileNet().save('mobilenet.h5');"
mx_nc -v -m mobilenet.h5
If you’d like to skip the compilation step, you can download a precompiled DFP from here: mobilenet.dfp
.
Expected Output:
╔══════════════════════════════════════╗
║ Neural Compiler ║
║ Copyright (c) 2019-2024 MemryX Inc. ║
╚══════════════════════════════════════╝
════════════════════════════════════════
Converting Model: (Done)
Optimizing Graph: (Done)
Cores optimization: (Done)
Flow optimization: (Done)
. . . . . . . . . . . . . . . . . . . .
Ports mapping: (Done)
MPU 0 input port 0: {'model_index': 0, 'layer_name': 'input_layer', 'shape': [224, 224, 1, 3]}
MPU 3 output port 0: {'model_index': 0, 'layer_name': 'predictions', 'shape': [1, 1, 1, 1000]}
────────────────────────────────────────
Assembling DFP: (Done)
════════════════════════════════════════
If you encounter any issues during this step, please refer to the troubleshooting guide.
Deploy and Benchmark#
Now that the model is compiled, it’s time to deploy it and run a benchmark to test its performance on the MXA hardware. We will run 1000 frames of random data through the accelerator to measure performance metrics.
mx_bench -v -d mobilenet.dfp -f 1000
Expected Output:
Ran 1000 frames
Average FPS: 1713.14
Average System Latency: 1.90 ms
Congratulations 🎉! You’ve successfully tested the MemryX hardware and software.
Note
If you do not yet have a MX3 for your system, you can still use the MemryX simulator to run this example. For those instructions, please refer to the Hello, MobileNet page.
Third-Party License#
This tutorial uses third-party models available through the Keras Applications API. Below are the details of the licenses for these dependencies:
Models: Models sourced from the Keras Applications API
License: Apache License 2.0
See also