SiMa.ai(以降SiMa)はGPU(グラフィックス処理ユニット)を提供するα社の性能に匹敵する、エッジでのAIに強みを持ったデバイスです。そんなSiMaのMLSoC(Machine Learning System-on-Chip)を実際に使ってみたいという声も上がっています。今回は、α社のGPUで動作していたモデルをSiMaに移植し、実際に動かす方法をご紹介いたします。
移植の手順は以下の通りです。
なお、今回デモ動画結果は以下です。
α社動画
SiMa動画
開発・評価をするためのボードとホストマシンの環境構築について
3ページに分けてご紹介いたします。
2. ホストマシンの環境構築
準備編でも説明した通り、Paletteのインストールには要求事項があります。
今一度ご確認ください。
要件の種類 | 詳細 |
---|---|
ホストマシン |
|
OS |
|
Dockerエンジン |
|
Python |
|
Open Port |
|
ファイアーウォールの設定 |
|
Paletteソフトウェアパッケージは、Dockerコンテナアプリケーションを使用して提供されています。Dockerコンテナアプリケーションのアップデートもしくはインストールのために、以下コマンドを実行してください。
sima-user@sima-user-machine:~$ sudo apt-get update
sima-user@sima-user-machine:~$ sudo apt-get install docker-engine
※ Dockerのインストール手順の詳細については、公式ドキュメントを参照してください。
https://docs.docker.com/engine/install/linux-postinstall/
Docker Desktopを使用している場合は、公式インストールドキュメントの手順に従ってください。
https://docs.docker.com/desktop/install/linux/ubuntu/
Developer Portalの「Palette」の「 Software Installation」の「Download Palette Software 」からPaletteソフトウェアをダウンロードできます。
Download Nowをクリックするとzipファイルがダウンロードされます。
※ SiMa HPのDeveloper Portalに登録することで閲覧およびダウンロードができるようになります。
登録しても見れない場合は、新光商事までお問い合わせください
ダウンロードしたソフトウェアパッケージを解凍するために、以下コマンドを実行してください。
sima-user@sima-user-machine:~$ cd Downloads
sima-user@sima-user-machine:~/Downloads$ unzip SiMa_CLI_1.4.0_master_B122.zip
Archive: SiMa_CLI_1.4.0_master_B122.zip
creating: 1.4.0_master_B122/
creating: 1.4.0_master_B122/sima-cli/
inflating: 1.4.0_master_B122/sima-cli/uninstall.py
inflating: 1.4.0_master_B122/sima-cli/release-notes.txt
inflating: 1.4.0_master_B122/sima-cli/stop.py
inflating: 1.4.0_master_B122/sima-cli/start.py
inflating: 1.4.0_master_B122/sima-cli/install.py
inflating: 1.4.0_master_B122/sima-cli/simaclisdk_1_4_0_master_B122.tar
inflating: 1.4.0_master_B122/sima-cli/preinstall.py
sima-user@sima-user-machine:~/Downloads$ cd 1.4.0_master_B122/sima-cli/
sima-user@sima-user-machine:~/Downloads/1.4.0_master_B122/sima-cli$ ls
install.py release-notes.txt start.py uninstall.py preinstall.py simaclisdk_1_4_0_master_B122.tar stop.py
※ もし前にインストールしたのPaletteソフトウェアが残っている場合
既にPaletteソフトウェアをインストールしている場合は、新しいバージョンをインストールする前に、現在のDockerコンテナを停止してください。これにより、Paletteソフトウェアを使用中のプロセスが正常に終了します。
以下のコマンドを実行して、必要なパッケージをインストールします。
sima-user@sima-user-machine:~$ sudo apt-get install python3
sima-user@sima-user-machine:~$ sudo apt-get install python3-pip
sima-user@sima-user-machine:~$ sudo apt-get install net-tools
ダウンロードしたソフトウェアパッケージをインストールするために、以下コマンドを実行してください。
sima-user@sima-user-machine:~/Sima_CLI_<SDK_version>/sima-cli$ python3 install.py
<SDK_version> Palette Dependency Checklist
**********************************
This script checks the necessary dependencies a system needs to meet to ensure compatibility and
readiness for Palette installation and use. Please review and verify each of the following dependencies.
___________________________________________________________________________
SYSTEM REQUIREMENTS REPORT
Component Requirement Found Result
========== ============ ========== =========
OS Version 20.04.5/22.04 Ubuntu 22.04 LTS [PASS]
Docker v20.10.21 24.0.5, [PASS]
Python 3.8.10 3.10.12 [PASS]
CPU/RAM 4 Cores/16 GB RAM 6 Cores/33.35 GB [PASS]
Free space 30 GB free 47.12GB [PASS]
Host
specification Meets requirements Meets requirements [PASS]
Firewall status disabled disabled [PASS]
Port 80 Not used Not used [PASS]
----------------------------------------------------------------------------------------------------
Result:
[PASS] All system requirements are successfully meet, you may proceed to Palette installation.
----------------------------------------------------------------------------------------------------
Checking if SiMa CLI version 1.4.0_develop_B1052 is already installed...
Enter work directory [/home/manuel/workspace]:
Loading Docker image version 1.4.0_master_B122...
This step may take a few minutes to complete. Thank you for your patience.
Image loaded successfully.
Checking SiMa SDK Bridge Network...
SiMa SDK Bridge Network found.
Creating and starting the Docker container...
Installation successful. To log in to the Docker container, please use the './start.py or python3 start.py'
Your local work directory '/home/manuel/workspace' has been mounted to '/home/docker/sima-cli'
Paletteソフトウェアを正しくインストールするためには、システムが必要な依存関係を満たしていることを確認する必要があります。
install.pyというインストールスクリプトは、この依存関係を自動的にチェックし、インストールが成功するための要件を満たしているか確認します。
すべての依存関係が確認されると最終レポートが表示され、インストールが進みます。
もしシステムの準備状況のみを確認したい場合は、install.pyスクリプト実行時に–check-dependenciesフラグを付けて実行してください。これにより、依存関係の確認のみが行われ、ソフトウェアのインストールは進みません。
sima-user@sima-user-machine:~/Sima_CLI_1.4.0_master_B109/1.4.0_master_B109/sima-cli$ python3 install.py --check-dependencies
python3 install.pyを実行しDocker共有ディレクトリを設定します。Dockerコンテナ内にマウントされる作業ディレクトリを指定するよう求められます。このディレクトリは、Docker SDKイメージとホストマシン間で共有されます。ここに開発ファイルを保存することで、コンテナを停止してもデータが失われません。自分の好きなディレクトリを指定できます。
インストール成功後に作成されたDockerコンテナにログインするために、以下コマンドを実行してください。
sima-user@sima-user-machine:~/Downloads/1.4.0_master_B122/sima-cli$ python3 start.py
Checking if the container is already running...
==> Starting the stopped container: simaclisdk_1_4_0_master_B122
simaclisdk_1_4_0_master_B122
sima-user@docker-image-id:/home$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
sima-user 1 4.6 0.1 30928 22596 pts/0 Ss+ 05:52 0:00 /usr/bin/python3 /usr/bin/supervisord -n -c /etc/supervisor/conf.d/
sima-user 7 0.0 0.0 7244 3712 pts/1 Ss 05:52 0:00 bash
sima-user 21 199 1.2 7570224 205076 pts/0 Sl 05:52 0:03 java -jar rpm-service.jar
sima-user 22 205 1.2 7570224 210388 pts/0 Sl 05:52 0:04 java -jar plugin-compilation.jar
sima-user 23 33.0 0.0 2908 1792 pts/0 S 05:52 0:00 /usr/local/bin/device_status_shadow -v
sima-user 24 221 1.2 7570224 209960 pts/0 Sl 05:52 0:04 java -jar gst-generator-service.jar
sima-user 25 35.5 0.0 2908 1792 pts/0 S 05:52 0:00 /usr/local/bin/local_port_forwarding -v
sima-user 26 210 1.3 5495088 215624 pts/0 Sl 05:52 0:04 java -Xmx2048m -jar packaging-service.jar
sima-user 27 38.5 0.0 2908 1792 pts/0 S 05:52 0:00 /usr/local/bin/pcie_forwarding -v
sima-user 28 140 0.8 7570224 145372 pts/0 Sl 05:52 0:02 java -jar performance-estimator.jar
sima-user 29 19.0 0.0 2908 1664 pts/0 S 05:52 0:00 /usr/local/bin/remote_port_forwarding -v
sima-user 127 31.0 0.6 479800 99848 pts/0 Sl 05:52 0:00 /usr/local/bin/remote_port_forwarding -v
sima-user 128 61.0 0.7 129396 115032 pts/0 S 05:52 0:00 /usr/local/bin/device_status_shadow -v
sima-user 129 57.0 0.7 500208 116800 pts/0 Sl 05:52 0:00 /usr/local/bin/local_port_forwarding -v
sima-user 141 53.0 0.6 480952 104888 pts/0 Sl 05:52 0:00 /usr/local/bin/pcie_forwarding -v
sima-user 164 0.0 0.6 279012 105364 pts/0 Sl 05:52 0:00 /usr/local/bin/local_port_forwarding -v
sima-user 187 0.0 0.0 8896 2944 pts/1 R+ 05:52 0:00 ps aux
Paletteソフトウェアパッケージに含まれているMPKツールの実行でインストールのが正しく行われているか確認します。
以下コマンドを実行してください。
sima-user@docker-image-id:/home$ mpk --help
usage: mpk [-h] [-d] [-q] [-v] {remote-log,device,create,debug,deploy,firmware-upgrade,kill,launch,list,pe,remove} ...
SiMa CLI Tool
options:
-h, --help show this help message and exit
-d, --debug full application debug mode
-q, --quiet suppress all console output
-v, --version show program's version number and exit
sub-commands:
{remote-log,device,create,debug,deploy,firmware-upgrade,kill,launch,list,pe,remove}
remote-log remote-log controller
device device controller
create create mpk from directory
debug debug a running package or deploy mpk in debug mode
deploy Deploy mpk to target
firmware-upgrade Upgrade or Reset a device
kill Kill the current running package. Note: 1. In case -i/--id parameter isn't provided, it will kill the
latest active deployment. 2. Incase only -i/--id parameter is provided, the latest deployed mpk (to a
target) with the given id is killed. 3. In case both -i/--id and -t/--target parameters are provided, only
the latest active deployment with given id on given target will be killed.
launch Launch previously deployed mpk
list List the current running packages
pe Run Performance Estimator
remove Remove previously deployed mpk
MPKツールのヘルプ情報が表示されれば成功です。
次の章では、アプリケーションの実装についてご説明いたします。