.. _run_multi_pipelines: Run Multiple (Concurrent) Pipelines ################################### The Palette SDK supports running multiple (upto 4) pipelines, concurrently, on a single MLSoC device set up in PCIe mode. This option, in which tasks are interleaved (managed at the same time), offers efficient resource management across pipelines enabling high-throughput workloads. **Steps** 1. Make sure you have a host machine with a SiMa.ai PCIe HHHL card appropriately installed in its slot. Additionally, you must have at least two or more uniquely named working GStreamer pipelines. 2. In the SDK, enable the multi-pipeline feature by updating the application.json file for each pipeline as shown below. * Configure the ``queue`` parameter in the plugins, simaaipciesrc and simaaipciesink, for the order in which the pipeline will run. Use one single queue for each pipeline. * Configure the ``multi-pipeline`` parameter for the plugin ``simaaiprocessmla`` to be ``true``. That is, ``multi-pipeline = true``. .. code:: console "gst": "simaaipciesrc queue=3 ! tee name='allegro_tee' ! queue2 ! simaaiprocesscvu name=simaai_preprocess num-buffers=5 ! simaaiprocessmla multi-pipeline=true name=simaai_process_mla num-buffers=5 ! simaaiboxdecode name='simaai_boxdecode' ! 'application/vnd.simaai.tensor' ! simaai-overlay2 name=overlay render-info='input::simaaipciesrc,bbox::simaai_boxdecode' labels-file='/data/simaai/applications/YoloV7_PCIe/share/overlay/labels.txt' ! simaaipciesink queue=3 allegro_tee. ! queue2 ! overlay." 3. Run the command ``mpk create`` to generate an updated mpk for the pipeline. 4. On the host side, update the ``queue`` parameter of the plugin ``pciehost`` for each gst-pipeline. Make sure to use the same queue number as used in the corresponding JSON file of the pipeline. .. code:: console gst-launch-1.0 rtspsrc location= ! rtph264depay ! h264parse ! avdec_h264 ! videoconvert ! video/x-raw,format=NV12 ! pciehost queue=3 queuedepth=8 showfps=1 ! videoparse format=nv12 width=1280 height=720 ! autovideoconvert ! autovideosink 5. Use the command ``mpk deploy`` to run the pipeline on the SoC device in the appropriate sequence configured in the application.json file. 6. Repeat steps 2, 3, and 4, above, for each pipeline you will be running.