Compiling SiMa.ai Plugins

In this section we will cross-compile the necessary SiMa.ai GStreamer plugins using Palette on our development machine, and then copy those plugins over to the MLSoC board.

Creating an application directory on the MLSoC board

Before continuing, let’s create a directory for our SiMa.ai Gstreamer plugins, and one where we will store all application files while we develop, test and debug the pipeline. On the MLSoC board, create the following directories:

davinci:~$ pwd
    /home/sima
davinci:~$ mkdir gst-plugins resnet50_example_app
davinci:~$ mkdir resnet50_example_app/data resnet50_example_app/models
davinci:~$ ls
    gst-plugins  resnet50_example_app

Compiling the plugins

In order to use the SiMa.ai gstreamer plugins, we need to cross-compile them from source, and then copy them over to the board. In this example, we will need to compile the following plugins: simaaisrc, simaaiprocesscvu, and simaaiprocessmla. Some plugins have some dependencies on dispatcher-lite so we will go ahead and build that as well.

  1. From the Palette Docker container on your host machine, go to the directory /usr/local/simaai/plugin_zoo/gst-simaai-plugins-base/

    sima-user@docker-image-id:/home$ cd /usr/local/simaai/plugin_zoo/gst-simaai-plugins-base/
    sima-user@docker-image-id:/usr/local/simaai/plugin_zoo/gst-simaai-plugins-base$ ls
        build  ci_jobs      CMakeLists.txt  core  gst
    
  2. In order to compile the necessary plugins, run the make command:

    sima-user@docker-image-id:/usr/local/simaai/plugin_zoo/gst-simaai-plugins-base$ cd build/
    sima-user@docker-image-id:/usr/local/simaai/plugin_zoo/gst-simaai-plugins-base/build$ make gstsimaaisrc gstsimaaiprocesscvu gstsimaaiprocessmla dispatcher-lite
        ...
        [ 57%] Built target dispatcher-lite
        [ 78%] Built target gstsimaallocator
        [ 85%] Building CXX object gst/processmla/CMakeFiles/gstsimaaiprocessmla.dir/gstsimaaiprocessmlastandalone.cpp.o
        [ 92%] Building CXX object gst/processmla/CMakeFiles/gstsimaaiprocessmla.dir/gstsimaaiprocessmla.cpp.o
        [100%] Linking CXX shared library libgstsimaaiprocessmla.so
        [100%] Built target gstsimaaiprocessmla
        [100%] Built target dispatcher-lite
    
  3. To verify that all of the correct plugins/libraries were successfully built:

    sima-user@docker-image-id:/usr/local/simaai/plugin_zoo/gst-simaai-plugins-base/build$ find ./gst/* | grep "\.so"
        ./gst/processcvu/libgstsimaaiprocesscvu.so
        ./gst/processmla/simaai/src/dispatcher-lite-build/libgstsimacore-lite.so
        ./gst/processmla/libgstsimaaiprocessmla.so
        ./gst/simaaisrc/libgstsimaaisrc.so
    

    Note

    You might see more plugins already pre-compiled.

  4. To copy the plugins over to the MLSoC, create a target directory on the MLSoC board first (in this case /home/sima/gst-plugins) and then copy them over:

    sima-user@docker-image-id:/usr/local/simaai/plugin_zoo/gst-simaai-plugins-base/build$ scp \
    ./gst/processcvu/libgstsimaaiprocesscvu.so \
    ./gst/processmla/simaai/src/dispatcher-lite-build/libgstsimacore-lite.so \
    ./gst/processmla/libgstsimaaiprocessmla.so \
    ./gst/simaaisrc/libgstsimaaisrc.so \
    sima@<IP address of MLSoC>:/home/sima/gst-plugins
    
    libgstsimaaiprocesscvu.so                                                                                100% 2705KB   6.3MB/s   00:00
    libgstsimacore-lite.so                                                                                   100%   59KB  13.9MB/s   00:00
    libgstsimaaiprocessmla.so                                                                                100%  163KB  32.9MB/s   00:00
    libgstsimaaisrc.so                                                                                       100%  103KB  23.6MB/s   00:00
    

Now we have all of the plugins necessary to debug and build our example pipeline.

Conclusion and next steps

In this section, we:

  • Create an application directory in our MLSoC in order to house our plugins and resources as we develop and debug the application.

  • Compiled the SiMa.ai Gstreamer plugins we will use in our ResNet50 GStreamer application.

  • Copied all plugins over to the MLSoC directory we created for the GStreamer plugins.

In the next section, we will begin developing a gst-launch-1.0 string one plugin at a time, and verify the correctness of the output at each stage.