.. _MPK Tool: MPK Tool ######## The MPK tool is a set of commands used by the Palette CLI engine to allow users to build, deploy, and manage applications on the SiMa.ai devices of all form factors. The applications are packaged and deployed in a bundle called an MPK. The MPK commands allow the developer to communicate and manage the MLSoC device (for example, the Developer Board in the SiMa Development Kit). The commands are the same whether the device is connected over Ethernet or PCIe. However, in PCIe mode, you must include the slot number as shown below, ``-s`` being your slot number. .. code-block:: console sima-user@docker-image-id:/home# mpk device connect -s 0 Device Connectivity using mpk ----------------------------- The MPK tool allows for persistent device connection which provides the ability to auto- reconnect to the MLSoC device upon reboot. .. note:: The Palette SDK polls the device for 125 seconds post disconnect. If the device does not reconnect in 125 seconds, the device will be permanently disconnected. Check the device connectivity status using the ``mpk device list`` command. If the connection status is ``cli-agent-down`` or ``offline``, even after 125 seconds, you must manually disconnect and re-connect to the device. .. code-block:: console sima-user@docker-image-id:/home$ mpk device list Active Connections over Ethernet ┏━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Status ┃ Status Details ┃ Target ┃ Username ┃ Device ┃ Jump Server ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ 🔴 │ Cli-agent-down │ 10.42.0.231 │ sima │ diet_danger │ - │ └────────┴────────────────┴─────────────────┴──────────┴─────────────┴─────────────┘ sima-user@docker-image-id:/home$ mpk device list Active Connections over Ethernet ┏━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Status ┃ Status Details ┃ Target ┃ Username ┃ Device ┃ Jump Server ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ 🔴 │ Offline │ 10.42.0.231 │ sima │ diet_danger │ - │ └────────┴────────────────┴─────────────────┴──────────┴─────────────┴─────────────┘ sima-user@docker-image-id:/home$ mpk device disconnect -t sima@10.42.0.231 ℹ Disconnecting 10.42.0.231... ‼ 10.42.0.231 is not connected for sima. sima-user@docker-image-id:/home$ mpk device connect -t sima@10.42.0.231 ℹ Please enter the password for 10.42.0.231 🔐 : ℹ Connecting to sima@10.42.0.231... ✔ Connection established to 10.42.0.231 . sima-user@docker-image-id:/home$ mpk device list Active Connections over Ethernet ┏━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Status ┃ Status Details ┃ Target ┃ Username ┃ Device ┃ Jump Server ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ 🟢 │ Online │ 10.42.0.231 │ sima │ base_topple │ - │ └────────┴────────────────┴─────────────────┴──────────┴─────────────┴─────────────┘ ❕ There are no PCIe devices available. mpk device ---------- The ``mpk device`` command is used for device provisioning. This command lets you connect and disconnect the MLSoC Developer Board from your host machine. To connect and disconnect, you will need the MLSoC Developer Board username and IP/hostname. * ``mpk device -h`` lists the supported commands as shown below: .. code-block:: console sima-user@docker-image-id:/home# mpk device -h usage: mpk device [-h] {connect,disconnect,list,reboot} ... Device Connectivity options: -h, --help show this help message and exit sub-commands: {connect,disconnect,list,reboot} connect Connect to the device disconnect Disconnect from the device list List the connected devices reboot Reboot the device * ``mpk device connect`` is used to connect to the MLSoC Developer Board: .. code-block:: console sima-user@docker-image-id:/home# mpk device connect -h usage: mpk device connect [-h] [-t TARGET] [-u USER] [-p PASSWORD] [-d DEVICE] [-slot PCIE_SLOT] options: -h, --help show this help message and exit -t TARGET, --target TARGET target device ip or fqdn -u USER, --user USER username -p PASSWORD, --password PASSWORD password -d DEVICE, --device DEVICE device id -slot PCIE_SLOT, --slot-number PCIE_SLOT Slot number of the PCIe Soc to connect to sima-user@docker-image-id:/home# mpk device connect -t sima@10.42.0.231 🔗 Connection established to 10.42.0.231 . ``mpk device connect`` uses SSH. For the SSH connection you must have the username/password and the IP address of the device. For the PCIe board, you must connect using the following command: .. code-block:: console sima-user@docker-image-id:/home# mpk device connect -s 0 `-s` being your slot number. * ``mpk device list`` lists the devices (MLSoC Developer Board) already connected, if you do not have available connections: .. code-block:: console sima-user@docker-image-id:/home# mpk device list ❕ There are no active Ethernet connections. ❕ There are no active PCIe connections. If there are connections available: .. code-block:: console sima-user@docker-image-id:/home# mpk device list Active Connections over Ethernet ┏━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━┓ ┃ Status ┃ Target ┃ Username ┃ Device ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━┩ │ 🟢 │ 10.42.0.231 │ sima │ fault_satisfy │ └────────┴─────────────┴──────────┴───────────────┘ ❕ There are no active PCIe connections. .. note:: ``mpk device list`` correctly displays the current device status with red/green indicators (green: active, red: offline). * ``mpk device disconnect`` is used to disconnect from the device: .. code-block:: console sima-user@docker-image-id:/home# mpk device disconnect -h usage: mpk device disconnect [-h] [-t TARGET] [-u USER] [-d DEVICE] [-slot PCIE_SLOT] options: -h, --help show this help message and exit -t TARGET, --target TARGET target device ip or fqdn -u USER, --user USER username -d DEVICE, --device DEVICE device id -slot PCIE_SLOT, --slot-number PCIE_SLOT Slot number of the PCIe Soc to connect to sima-user@docker-image-id:/home# mpk device disconnect -t sima@10.42.0.231 ✔ 10.42.0.231 successfully disconnected for user sima ! * ``mpk device reboot`` is used to reboot the device: .. code-block:: console sima-user@docker-image-id:/home# mpk device reboot -h usage: mpk device reboot [-h] [-t TARGET] [-d DEVICE] options: -h, --help show this help message and exit -t TARGET, --target TARGET target device ip or fqdn -d DEVICE, --device DEVICE device id .. code-block:: console sima-user@docker-image-id:/home# mpk device reboot -t 10.42.0.231 ℹ Rebooting 10.42.0.231, please wait ℹ 10.42.0.231 is rebooted. More Options ~~~~~~~~~~~~ You have the ability to specify the username using the ``-u`` option and assign a name to the device as shown below. Once assigned, use the device name in the commands. .. code-block:: console sima-user@docker-image-id:/home# mpk device connect -t 10.42.0.231 -u sima -d my_device ℹ Please enter the password for 10.42.0.231 🔐 : 🔗 Connection established to 10.42.0.231 . sima-user@docker-image-id:/home# mpk device list Active Connections over Ethernet ┏━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┓ ┃ Status ┃ Target ┃ Username ┃ Device ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━┩ │ 🟢 │ 10.42.0.231 │ sima │ my_device │ └────────┴─────────────┴──────────┴───────────┘ ❕ There are no active PCIe connections. sima-user@docker-image-id:/home# mpk device disconnect -d my_device ℹ Disconnecting User: sima from Target: 10.42.0.231 ✔ 10.42.0.231 successfully disconnected for user sima ! mpk create ---------- The ``mpk create`` command is used for creating an mpk package from the source directory of your application which can then be deployed on the MLSoC Developer Board. .. note:: For the ``mpk create`` command, do not use the slot number when connected over PCIe. .. code-block:: console sima-user@docker-image-id:/home# mpk create -h usage: mpk create [-h] [-d OUTPUT_DIR] [-s INPUT_DIR] options: -h, --help show this help message and exit -d OUTPUT_DIR, --dir OUTPUT_DIR folder to be used for mpk creation -s INPUT_DIR, --src INPUT_DIR folder where project sources are located sima-user@docker-image-id:/home# cd /usr/local/simaai/app_zoo/Gstreamer/PeopleTracker/ sima-user@docker-image-id:/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker# ls application.json build core plugins README.md resources sima-user@docker-image-id:/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker# mpk create -d . -s . ℹ Step COMPILE completed successfully. ℹ Step COPY RESOURCE completed successfully ℹ Step RPM BUILD completed successfully. ℹ Successfully created MPK at '/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker/project.mpk' sima-user@docker-image-id:/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker# ls application.json build core plugins project.mpk README.md resources mpk project create ------------------ The ``mpk project create`` command is used for createing a project/pipeline from a model.tar.gz using a combination of pre-process, MLA, and post-process plugins (or a only a specific plugin as specified by the user). The project/pipeline created by default includes ``simaaisrc`` as the source and ``fakesink`` as the sink. .. note:: For the ``mpk project create`` command, do not use the slot number when connected over PCIe. .. code-block:: console sima-user@docker-image-id:/home# mpk project create -h usage: mpk project create [-h] [--model-path MODEL_PATH] [--preproc-kernel PREPROC_KERNEL] [--plugin-json PLUGIN_JSON] [--input-resource INPUT_RESOURCE] options: -h, --help show this help message and exit --model-path MODEL_PATH Path to the model.tar.gz file. This file contains the model to be used for generating the mini pipeline. --preproc-kernel PREPROC_KERNEL Optional parameter: You may specify a pre-processing kernel, such as 200 (gen_preproc, the default value if not specified) or 202 (quanttess). This parameter is only applicable when using the 5-plugin pipeline and is not valid for creating a mini pipeline for a specific plugin. --plugin-json PLUGIN_JSON Optional parameter: You may specify a JSON file corresponding to any plugin in the model (e.g., pre-process, MLA, or post-process). If this parameter is provided, the project/pipeline will use only the specified plugin (e.g., processcvu for pre and post processes or process for MLA plugin). The project/pipeline will include simaaisrc as the source and fakesink as the sink. --input-resource INPUT_RESOURCE Path to the input resources (e.g., image or video files) for the simaaisrc plugin. The path can include a %d placeholder, which will be replaced by a sequence of numbers, enabling the plugin to process all files matching the pattern in the specified directory. sima-user@docker-image-id:/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker# mpk create -d . -s . ℹ Step COMPILE completed successfully. ℹ Step COPY RESOURCE completed successfully ℹ Step RPM BUILD completed successfully. ℹ Successfully created MPK at '/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker/project.mpk' sima-user@docker-image-id:/usr/local/simaai/app_zoo/Gstreamer/PeopleTracker# ls application.json build core plugins project.mpk README.md resources mpk deploy ---------- The ``mpk deploy`` command is used for deploying the application to the MLSoC Developer Board. This command will install and launch the pipeline application on the MLSoC Developer Board. The target device can be mentioned either using option -t (ip address) or -d (device name) as shown below. If you do not specify the target device, then it will be deployed to the last connected device. .. code-block:: console sima-user@docker-image-id:/home# mpk deploy -h usage: mpk deploy [-h] [-f FILE] [-t TARGET] [-d DEVICE] [-slot PCIE_SLOT] [--set-default] options: -h, --help show this help message and exit -f FILE, --file FILE mpk file to be deployed to device -t TARGET, --target TARGET fqdn or ip of devkit onto which to deploy mpk -d DEVICE, --device DEVICE device id/tag of devkit onto which to deploy mpk -slot PCIE_SLOT, --slot-number PCIE_SLOT slot number of PCIe devkit onto which to deploy mpk --set-default set the current application as default one so that it runs at board boot sima-user@docker-image-id:/home# mpk deploy -f /usr/local/simaai/app_zoo/Gstreamer/PeopleTracker/project.mpk -t 10.42.0.231 -d my_device 🚀 Sending MPK to 10.42.0.231... Transfer Progress for project.mpk: 100.00% 🏁 MPK sent successfully! ✔ MPK Deployment is successful for project.mpk The MPK CLI Engine lets you deploy an application as the default application which runs automatically when the device boots up. For example, use the ``--set-default`` argument to make PeopleTracker the default pipeline which starts when you boot up the device. mpk launch ---------- When deploying an application, the SDK installs the application on the device and automatically launches it. If an application is then killed, or the device is rebooted and the ``--set-default`` flag was not used, you can relaunch an application by using the ``mpk launch`` command, without having to redeploy it (reinstall and launch). Assuming that an application was previously deployed (using ``mpk deploy``) you can relaunch an application by: .. code-block:: console sima-user@docker-image-id:/home# mpk launch -h usage: mpk launch [-h] [-a APP] [-t TARGET] [-d DEVICE] [-slot PCIE_SLOT] options: -h, --help show this help message and exit -a APP, --application APP name of the previously deployed mpk -t TARGET, --target TARGET fqdn or ip of devkit onto which to deploy mpk -d DEVICE, --device DEVICE device id/tag of devkit onto which to deploy mpk -slot PCIE_SLOT, --slot-number PCIE_SLOT Slot number of the PCIe Soc to upgrade sima-user@docker-image-id:/home# mpk launch -t 10.42.0.231 -d my_device -a com.sima.awesome_app ℹ Launching mpk deployment on 10.42.0.231 with application_name: com.sima.awesome_app. ✔ MPK with id: peopletracker_Pipeline is successfully launched on 10.42.0.231 🚀 You can check if the pipeline has launched successfully using the ``mpk list`` command. This command launches the application on the device. Use this command if the application has already been deployed on the device and has not been removed from the device. mpk list -------- The ``mpk list`` command lists the deployed MPKs. .. code-block:: console sima-user@docker-image-id:/home# mpk list Active MPK deployments ┏━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┃ mpk_id ┃ file ┃ application_name ┃ Target ┃ Time ┃ Status ┃ ┡━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ │ peopletracker_Pipeline │ project.mpk │ com.sima.awesome_app │ 10.42.0.231 │ 01/02/2024 06:08 PM │ active │ └────────────────────────┴─────────────┴──────────────────────┴─────────────┴─────────────────────┴────────┘ ‼ No MPKs deployed for PCIe mpk kill -------- The ``mpk kill`` command is used to kill the MPK application on the MLSoC Developer Board, that is, it stops the application from running on the device. For PCIe mode, use ``-slot 0``. .. code-block:: console sima-user@docker-image-id:/home# mpk kill -h usage: mpk kill [-h] [-i MPK_ID] options: -h, --help show this help message and exit -i MPK_ID, --id MPK_ID id of mpk deployment to be killed. In case an id isn't provided, it will kill the latest active deployment sima-user@docker-image-id:/home# mpk kill -i peopletracker_Pipeline ℹ killing mpk with peopletracker_Pipeline on 10.42.0.231 ✔ MPK with id: peopletracker_Pipeline is successfully killed on 10.42.0.231 💀 mpk remove ---------- The ``mpk remove`` command allows you to remove a previously deployed MPK application. For PCIe mode, add ``slot -0``. .. code-block:: console sima-user@docker-image-id:/home# mpk remove -h usage: mpk remove [-h] [-a APP] [-t TARGET] [-d DEVICE] [-slot PCIE_SLOT] options: -h, --help show this help message and exit -a APP, --application APP name of the previously deployed mpk -t TARGET, --target TARGET fqdn or ip of devkit onto which to deploy mpk -d DEVICE, --device DEVICE device id/tag of devkit onto which to deploy mpk -slot PCIE_SLOT, --slot-number PCIE_SLOT Slot number of the PCIe Soc to upgrade sima-user@docker-image-id:/home# mpk remove -t 10.42.0.231 -d my_device -a com.sima.awesome_app ℹ Removing mpk deployment on 10.42.0.231 with application_name: com.sima.awesome_app. ✔ Successfully removed mpk deployment with application_name: com.sima.awesome_app and id: peopletracker_Pipeline on target: 10.42.0.231 The ``mpk remove`` command kills the deployed pipeline and removes all application-installed data. To verify that the application was successfully removed, run the command below: #. Check for the deployed application using the ``mpk list`` command. #. Check that the directory ``/usr/local/simaai/*`` does not contain any package data for the application that was removed. .. mpk debug .. --------- .. The ``mpk debug`` command is used for debugging purposes. .. Remote debugging of applications/pipeline is supported by the CLI. This is done using the .. ``gdbserver`` on the MLSoC Developer Board when the user requests it. Once the debugging .. session ends, the ``gdbserver`` completes its work. .. To support the debugging process, the device connectivity (host and target) must support a set .. of commands to start a ``gdbserver`` instance. The hostname (IP address) and port number used by .. the ``gdbserver`` need to be set implicitly. That is, the user must not have the option to change or .. modify them. .. Example of device connectivity command: ``mpk debug -f /path/to/application/on/host/docker -t `` .. NOTE .. For this flow, the user must know the absolute path to the debugged program (on the device) so .. the ``gdbserver`` can run it once requested. Once the gdbserver starts, you can use the gdb command .. on CLI Docker to connect to the gdbserver and start debugging. .. .. code-block:: console .. sima-user@docker-image-id:/home# mpk debug -h .. usage: mpk debug [-h] [-f FILE] [-t TARGET] [-d DEVICE] .. options: .. -h, --help show this help message and exit .. -f FILE, --file FILE mpk file to be deployed to device .. -t TARGET, --target TARGET .. fqdn or ip of devkit onto which to deploy mpk .. -d DEVICE, --device DEVICE .. device id/tag of devkit onto which to deploy mpk .. _mpk firmware-upgrade: mpk firmware-upgrade -------------------- The ``mpk firmware-upgrade`` command lets users wirelessly (Over-the-Air) upgrade the firmware on the MLSoC devices using the Palette CLI. The upgrade tool updates the media on which device is booted. Supported boot media are EMMC or SDCard images. The firmware update process is independent of how the host machine is connected to the MLSoC board. .. code-block:: console sima-user@docker-image-id:/home# mpk firmware-upgrade -h usage: mpk firmware-upgrade [-h] [-f FILE] [-t TARGET] [-slot PCIE_SLOT] [-d DEVICE] [--reboot-on-upgrade] options: -h, --help show this help message and exit -f FILE, --file FILE Software Update file -t TARGET, --target TARGET fqdn or ip of devkit to upgrade -slot PCIE_SLOT, --slot-number PCIE_SLOT Slot number of the PCIe Soc to upgrade -d DEVICE, --device DEVICE device id/tag of devkit to upgrade --reboot-on-upgrade reboot the device on upgrade Prerequisites ^^^^^^^^^^^^^ #. Latest SDK installed on the host machine. #. Device flashed and booted with the last release or the working build. #. Device connected to host over (Ethernet or PCIe). Ensure you are connected to the device by pinging it or SSH into it. #. ``.swu`` package for firmware to upgrade on the device. Steps ^^^^^ #. Copy the ``.swu`` package to Docker or place it in your ``workspace`` directory. .. code-block:: console sima-user@sima-user-machine:~$ sima-user@sima-user-machine:~$ cd Downloads/MLSoC1.1_Firmware sima-user@sima-user-machine:~/Downloads/MLSoC1.1_Firmware$ cp simaai-image-palette-upgrade-davinci.swu ~/workspace #. On the Docker container run ``mpk device connect``. .. code-block:: console sima-user@docker-image-id:/home# mpk device connect -t -u -d my_device ℹ Please enter the password for 10.42.0.231 🔐 : ℹ Connecting to sima@10.42.0.231... ✔ Connection established to 10.42.0.231 . sima-user@docker-image-id:/home# mpk device list Active Connections over Ethernet ┏━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━┓ ┃ Status ┃ Status Details ┃ Target ┃ Username ┃ Device ┃ Jump Server ┃ ┡━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━┩ │ 🟢 │ Online │ 10.42.0.231 │ sima │ my_device │ - │ └────────┴────────────────┴─────────────┴──────────┴───────────┴─────────────┘ ❕ There are no PCIe devices available. #. Run the firmware-upgrade command from the CLI: .. code-block:: console sima-user@docker-image-id:/home# mpk firmware-upgrade -h usage: mpk firmware-upgrade [-h] [-f FILE] [-t TARGET] [-slot PCIE_SLOT] [-d DEVICE] [--reboot-on-upgrade] options: -h, --help show this help message and exit -f FILE, --file FILE Software Update file -t TARGET, --target TARGET fqdn or ip of devkit to upgrade -slot PCIE_SLOT, --slot-number PCIE_SLOT Slot number of the PCIe Soc to upgrade -d DEVICE, --device DEVICE device id/tag of devkit to upgrade --reboot-on-upgrade reboot the device on upgrade sima-user@docker-image-id:/home# mpk firmware-upgrade -f /home/docker/sima-cli/simaai-image-palette-upgrade-davinci.swu -d my_device Sending software upgrade file to 10.42.0.231... Transfer Progress for simaai-image-palette-upgrade-davinci.swu: 100.00% ❕ Extracting details from the upgrade file, please wait... ❕ Extracted details from the upgrade file. 🚀 Upgrading 10.42.0.231 from 1.4.0_master_B1230 to 1.5.0_master_B1417, please wait... ✔ Device Upgraded! ━━━━━━━━━━━━━━━━ Installing update.sh... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing simaai-image-palette-davinci.ext4.gz... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing u-boot.bin... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing Image... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing davinci-combo-board.dtb... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing davinci-dual-m2.dtb... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing davinci-hhhl.dtb... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing boot.scr.uimg... ━━━━━━━━━━━━━━━━ 100% 0:00:00 Installing update.sh... ━━━━━━━━━━━━━━━━ 100% 0:00:00 ✔ Successfully upgraded 10.42.0.231 to 1.5.0_master_B1417 ❔ Reboot the device? [y/n]: y ℹ Rebooting 10.42.0.231, please wait ℹ 10.42.0.231 is rebooted. Waiting for device to come back online... ━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 ℹ Device is back online ✔ Sevices started. ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00 ℹ Verifying build details on the board, thank you for your patience... ✔ Device 10.42.0.231 was successfully upgraded to 1.5.0_master_B1417! ℹ You can continue to use the device now. #. Verify that the device was successfully upgraded to the latest build version by running: ``cat /etc/build``. .. code-block:: console sima-user@docker-image-id:/home# ssh sima@ The authenticity of host '10.42.0.231 (10.42.0.231)' can't be established. ED25519 key fingerprint is SHA256:mTD8tqYTR/NrmVcE0pyMaVGYXpbkgJ4iJppskpDL3yM. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.42.0.231' (ED25519) to the list of known hosts. sima@10.42.0.231's password: davinci:~$ cat /etc/build ----------------------- Build Configuration: | ----------------------- DISTRO = poky DISTRO_VERSION = 4.0.23 MACHINE = davinci DATE = 20241214 TIME = 181909 SIMA_BUILD_VERSION = 1.5.0_master_B1417 ----------------------- Layer Revisions: | ----------------------- meta = kirkstone:8e092852b63e998d990b8f8e1aa91297dec4430f meta-poky = kirkstone:8e092852b63e998d990b8f8e1aa91297dec4430f meta-yocto-bsp = kirkstone:8e092852b63e998d990b8f8e1aa91297dec4430f meta-simaai = master:ea4335caeffa48bd9347f53b743aa00262353dd8 -- modified meta-oe = kirkstone:4ad41baed6236d499804cbfc4f174042d84fce97 meta-python = kirkstone:4ad41baed6236d499804cbfc4f174042d84fce97 meta-networking = kirkstone:4ad41baed6236d499804cbfc4f174042d84fce97 meta-swupdate = kirkstone:6918be849ddf1fed5b7a0173e51c7a136e8d4101 Performance Estimator --------------------- The Performance Estimator (PE) is a utility in the Palette software that lets you start and stop the performance analysis of your GStreamer pipelines by using the command, ``mpk pe``. The Performance Estimator will generate .json files in ``/tmp/PerformanceEstimator_*``. It also starts the local server with the current Performance Estimator content and the user can visualize data in their browser. .. note:: * The Performance Estimator tool only reports Tracer data from plugins. * Performance Estimator and Dynamic KPI collection are only functional when the MPK is created using the ``mpk create --gst-app`` option and then deployed. * Please ensure you create the MPK with this option, deploy it, and then run mpk pe start. For example, ``mpk create -s . -d . --gst-app`` Follow the commands described below when using the Performance Estimator. * ``mpk pe -h`` lists the supported commands as shown below. .. code-block:: console sima-user@docker-image-id:/home$ mpk pe -h usage: mpk pe [-h] {start,stop} ... Performance Estimator Note: Performance Estimator and Dynamic KPI collection are only functional when the MPK is created using the mpk create --gst-app option and then deployed. Please ensure you create the MPK with this option, deploy it, and then run mpk pe start. options: -h, --help show this help message and exit sub-commands: {start,stop} start Start Performance Estimator in dynamic or static mode. stop Stop Performance Estimator. usage: mpk pe --help * ``mpk pe start`` is used to start performance analysis of the pipeline running on the MLSoC Developer Board. Before executing ``mpk pe start``, make sure the pipeline is running on the MLSoC board. .. code-block:: console sima-user@docker-image-id:/home# mpk pe start -h usage: mpk pe start [-h] [-f FILE] [-i ID] [--period PERIOD] [-t TARGET] [-d DEVICE] [--count COUNT] options: -h, --help show this help message and exit -f FILE, --file FILE mpk file to be deployed to device. -i ID, --id ID id of the deployed pipeline. --period PERIOD period of time to collect the kpis. -t TARGET, --target TARGET IP address/FQDN of the device. -d DEVICE, --device DEVICE Name of the device. --count COUNT Number of Collated Json files to be collected for the period. sima-user@docker-image-id:/home# mpk list Active MPK deployments ┏━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━┓ ┃ mpk_id ┃ file ┃ application_name ┃ Target ┃ Time ┃ Status ┃ ┡━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━┩ │ yolov7_Pipeline │ project.mpk │ com.sima.awesome_app │ 192.168.135.242 │ 05/08/2024 02:35 AM │ active │ └─────────────────┴─────────────┴──────────────────────┴─────────────────┴─────────────────────┴────────┘ ‼ No MPKs deployed for PCIe sima-user@docker-image-id:/home# mpk pe start -i yolov7_Pipeline -t 192.168.135.242 --count 35 ℹ Starting Dynamic Performance Estimator for pipeline: yolov7_Pipeline on device: 192.168.135.242. 🚀 Dynamic Performance estimator can be accessed at: http://localhost/getDynamicKPI?directoryPath=/tmp/PerformanceEstimator_b61cfced72d943cebce4f1dae917801c sima-user@docker-image-id:/home# * ``mpk pe stop`` is used to stop performance analysis of a pipeline running on the MLSoC Developer Board. .. code-block:: console sima-user@docker-image-id:/home# mpk pe stop -h usage: mpk pe stop [-h] [-f FILE] [-i ID] [-t TARGET] [-d DEVICE] options: -h, --help show this help message and exit -f FILE, --file FILE mpk file to be deployed to device. -i ID, --id ID id of the deployed pipeline. -t TARGET, --target TARGET IP address/FQDN of the device. -d DEVICE, --device DEVICE Name of the device. sima-user@docker-image-id:/home# mpk pe stop -i yolov7_Pipeline -t 192.168.135.242 ✔ Stopped Performance estimator for yolov7_Pipeline on 192.168.135.242. sima-user@docker-image-id:/home# * To interpret data open a .json file from ``/tmp/PerformanceEstimator_*`` in your editor. You can view data for each frame for all three processing units (CVU, APU and MLA) and the plugins that are executed to compute on that processing unit. .. code-block:: console sima-user@docker-image-id:/tmp/PerformanceEstimator_b61cfced72d943cebce4f1dae917801c$ ls -ltr total 13364 -rw-r--r-- 1 sima-user sima-user 312967 Aug 5 02:36 yolov7_Pipeline_1722843378.json -rw-r--r-- 1 sima-user sima-user 391186 Aug 5 02:36 yolov7_Pipeline_1722843383.json sima-user@docker-image-id:/tmp/PerformanceEstimator_b61cfced72d943cebce4f1dae917801c$ cat yolov7_Pipeline_1722843378.json | head -n200 { "pipeline_id":"yolov7_Pipeline", "timestamp":"2024-08-05T07:36:17Z", "num_frames":80, "period":5, "data":[ { "frame_id":1207, "pipeline_id":"yolov7_Pipeline", "plugins":[ { "frame_id":1207, "kpis":{ "dma_BW":{ ... ... "frame_id":1208, "pipeline_id":"yolov7_Pipeline", "plugins":[ { * To visualize performance data in a browser, click the link which was generated when the ``mpk pe start`` command executed successfully. See the output in the browser as shown below. To further analyze data, zoom in or put your cursor on the specific processing unit data as shown in screenshots below. .. image:: media/PerformanceEstimator_viewDataInBrowser_screen1.png :scale: 70% :align: center :alt: Viewing Data in Browser .. image:: media/PerformanceEstimator_viewDataInBrowser_screen2.png :scale: 70% :align: center :alt: Zooming in on Data for Further Analysis * ``mpk pe model`` command can be used to generate KPIs directly from the given model.tar.gz file and the input image. The command streamlines the process of creating a project, running necessary operations, and collecting KPI data. The command ``mpk pe model`` executes the following operations in a sequence: #. ``mpk project create`` with the provided model.tar.gz and input image. #. ``mpk create`` to be run on the project created in the previous step. #. ``mpk deploy`` to deploy the mpk to the default device. #. ``mpk pe`` to start collecting the dynamic KPIs for the default interval of time. #. Collect the JSON output and print a message instructing the user to check the hyperlink for the KPI data. Connect to the device where the model needs to be run. The model is deployed on the last connected device. .. code-block:: console sima-user@docker-image-id:/home$ mpk device connect -t sima@192.168.135.97 ℹ Please enter the password for 192.168.135.97 🔐 : ℹ Connecting to sima@192.168.135.97... ✔ Connection established to 192.168.135.97 . See example code below. .. code-block:: console sima-user@docker-image-id:/home/docker/sima-cli/models_files/new$ mpk pe model --model-path alexnet.tar.gz --input-resource /home/docker/sima-cli/scratch/test-gst-automation/img/image1.rgb ⏳ Starting the project creation process for the model: alexnet.tar.gz... ✔ Step 1: Project created successfully for the model: alexnet.tar.gz. ⏳ Starting the mpk creation process for the mini pipeline associated with model: alexnet.tar.gz... ✔ Step 2: MPK created successfully at /home/docker/sima-cli/models_files/new. ⏳ Starting the mpk deploy process for the mini pipeline associated with model: alexnet.tar.gz... ✔ Step 3: MPK deploy command executed successfully. ⏳ Starting the collection of dynamic KPIs for the mini pipeline associated with the model: alexnet.tar.gz... ✔ ℹ Starting Dynamic Performance Estimator for pipeline: alexnet_Pipeline on device: 192.168.135.97. 🚀 Dynamic Performance estimator can be accessed at: http://localhost:49152/getDynamicKPI?directoryPath=/tmp/PerformanceEstimator_ad947fd09c5e4439a7520c26b8fc60ab Step 4: Successfully launched the Performance Estimator.