This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.

OpenAMP Matrix Multiply Sample

Matrix Multiply Intro

The matrix multiply reference sample, as the name suggests, demonstrates OpenAMP Interprocessor Communications (IPC) components through matrix multiplication. The demonstration uses a main controller client, which generates random matrices. It sends them to a service/daemon on a remote which performs a matrix calculation and returns the result via a RPMsg endpoint. The main controller then writes the matrix result to console output.

../_images/matrix-multiply-intro.svg

Matrix Multiply Components

There are two applications involved in this demonstration. The remote application runs as an daemon/service which performs a matrix calculation and returns the result on an RPMsg endpoint. The main controller application is the client application sending two matrices as a packet to the daemon/service and monitoring for the return result.

The underlying OpenAMP architectural components used by these applications are

The following architecture diagram shows the components involved in the demonstration.

../_images/matrix-multiply-components.svg

The top-level control flow is shown in the following message diagram.

../_images/matrix-multiply-control-flow.svg

RPMsg Matrix Multiply Remote Application

The remote application, matrix_multiplyd, is the core of the demonstration. It is a simple application serving a RPMsg endpoint running as the main task on the remote processor.

Matrix Multiply Main Application

The main controller application generates two matrices into a structure with size and 6x6 matrix, sequentially into a RPMsg packet. It then waits for matrix sized bytes to be returned and prints the resultant matrix as calculated by the remote.

There are two implementations. The mat_mul_demo application forms the main controller side of the demonstration, as a linux user space client application. The matrix_multiply application forms the main controller side of the demonstration, as a baremetal client application.

Matrix Multiply Main Script

The main controller is also responsible for loading the firmware containing the RPMsg Matrix Multiply Remote Application and starting the remote processor using Remoteproc.

For main controllers, like Linux, a script can be used to pipe the firmware to the exposed remoteproc system, followed by the execution of the user space mat_mul_demo application. For controllers without scripting capability, like baremetal and RTOS (Real Time Operating systems), this would be achieved in the code.

Matrix Multiply Source

RPMsg Matrix Multiply Baremetal Sources

There are two baremetal applications, a daemon/service to run on the remote and a main controller application which is the matrix multiply client requesting the calculations.

The RPMsg Matrix Multiply daemon/service application is available as a baremetal solution in the OpenAMP Repository. Take note of the d for daemon at the end of the file.

The RPMsg Matrix Multiple main controller client application is available as a baremetal solution in the OpenAMP Repository.

Both are CMake applications and can be built for any remote as long as the relevant OS/HW abstraction layer components like libmetal are ported for that platform.

Matrix Multiply Linux Source

The matrix multiply Linux application is executed on the Linux main controller as a user space application. The application is available in the OpenAMP System Reference repository.

It is a Makefile application and can be built using the Yocto rpmsg-mat-mul recipe.

An example main control script is given in the matrix multiply readme.

Reference Board Implementations

This Matrix Multiply Sample is demonstrated in the following reference implementations.