This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can I run two pipelines through multiple threads on TDA4? Or is there a way to run two pipelines simultaneously?

Can I run two pipelines through multiple threads on TDA4? Or is there a way to run two pipelines simultaneously?

  • Hi Fan,

    Could you please provide some more information? What you mean by two pipelines? is it display or capture or two completely different graphs?

    Regards,

    Brijesh

  • Should be two different graphs, one is the sensor thread, the other is the sense thread

  • Yes, it should be fine to run two graphs. What is the input for both the graphs? Is it same sensor output, which goes to both the graphs?

    Regards,

    Brijesh

  • The input of one graph is the camera and radar, and the input of the other graph is the output of the previous graph. Can these two graphs run two pipelines in one app?

  • Yes possible, you would require to dequeue the output of one graph and enqueue it as input to the second graph.. 

  • Yeah, I know what you mean, and that's how I'm running multiple Graphs so far. But I can't find an example of two graphs being run separately by two threads. By the way, openVX is static graph, can't  run two pipelines or two processes at the same time?

  • There is no example, but you could definitely invoke two graphs in two threads or processes in Linux.. The only bit complexity is in sharing the output of graph to the another graph.. Here, you could use graph parameter feature to share the outputs.. 

  • There are two questions: Do these two graphs need to be initialized only once in the same context? Because when we tested it, we found that we couldn't run two demos at the same time, got stuck in app_init.

    Another question is: if two Graphs are running in two threads, how can they share data, can I use thread-safe queues? How do I control that the second graph receives data frame by frame? How do I control it to run at a fixed frame rate

  • There are two questions: Do these two graphs need to be initialized only once in the same context? Because when we tested it, we found that we couldn't run two demos at the same time, got stuck in app_init.

    Yes, graphs typically are initialized only once. Exactly how are you invoking two graphs? Are you creating two processes or two thread? If there are two threads, app_init must be called once. 

    Another question is: if two Graphs are running in two threads, how can they share data, can I use thread-safe queues? How do I control that the second graph receives data frame by frame? How do I control it to run at a fixed frame rate

    Yes, you could have thread-safe queues, or the other way is to declare output of the first graph and input of the second graph as graph parameters, and need to dequeue parameter from one graph and enqueue it on the second graph. Once the second graph completes, dequeue parameter from the second graph and enqueue it back to the first graph.. This is also another way you could share the data between graphs.

    Regards,

    Brijesh

  • Thank you very much for your answer!