Jump to content

Parallel loops with priorities


Recommended Posts

Hi all. We have a project where parallel loops are needed, but also setting priority for each loop is a requirement. At first it seemed that "Timed loops" are an answer to these problems, since they support priority, but "Timed loops" have other problems with the code that doesn't execute quickly enough.

So, in short I am looking for a solution that would give me the ability to set priorities for parallel loops and also support arbitrary execution time for each iteration.

Thanks in advance, Mike

Link to comment

Hi all. We have a project where parallel loops are needed, but also setting priority for each loop is a requirement. At first it seemed that "Timed loops" are an answer to these problems, since they support priority, but "Timed loops" have other problems with the code that doesn't execute quickly enough.

So, in short I am looking for a solution that would give me the ability to set priorities for parallel loops and also support arbitrary execution time for each iteration.

Thanks in advance, Mike

I would first investigate making the code that does not run fast enough run faster, so the timed loop can be used.

Ben

Link to comment

Unfortunately the code is a framework thingy, so code could later be added that simply would not finish in the required amount of time sad.gif

Mike5

Well there is no way to optimize a thingy so moving on...

What did you mean when you wrote " support arbitrary execution time for each iteration" since they will be executing thingys?

If you get more specific about what you are up too...

Ben

Link to comment

Why not place each parallel loop in separate subVIs and set the execution priority of the subVI?

You have to do a bit more than that to force LV to run certain vi's is certain threads. This is where "Threadconfig.vi" comes into its own.

vi.lib\utility\sysinfo\threadconfig.vi

It all gets a bit tricky from here on in as you need to manually manage what vi's are going into which execution systems and at what priorities. Most of what you need to know is in this thread (no pun intended...lol)

Loop Timing & Execution difference

  • Like 1
Link to comment

Well, I'm glad I have some options (setting VI/process priority was on my list as well, but I was looking for all possible options), but to answer some other questions as well.

Regarding "arbitrary execution time" - as we all know, things change in a live system. Sometimes the application has to log some things, and sometimes it doesn't, so unless you are really doing just one specific thing on a real-time system, you don't really know how long an iteration may last.

As I already stated, I am aware of the VI priority, but that only offers me 5 priorities with one that I think it's best avoided (the RT one). Timed loop offers 65535 priorities, but maybe 4 will be enough after all.

I'll look into the thread that ShaunR suggested and hopefully find what I need there.

Thank you all for your help, and if you have any other ideas, please keep them coming :)

Mike

Link to comment

I see that setting the VI execution priority is not an option, since two instances of an object can not set the priority of the same VI to different values. Also, setting priority on a reentrant VI is not possible at all, since as soon as you open a VI reference with the option "Prepare for reentrant run" changing of priority is not possible.

So, if I want to use priorities, then I need a Timed loop. So, my other question, can I somehow configure a Timed loop so that it runs as quickly as possible but still finish each iteration, even if some iterations take longer then the allocated period?

I have been reading documentation and performing different tests all day, but so far it seems that this is not possible.

Thanks, Mike

Link to comment

I see that setting the VI execution priority is not an option, since two instances of an object can not set the priority of the same VI to different values. Also, setting priority on a reentrant VI is not possible at all, since as soon as you open a VI reference with the option "Prepare for reentrant run" changing of priority is not possible.

So, if I want to use priorities, then I need a Timed loop. So, my other question, can I somehow configure a Timed loop so that it runs as quickly as possible but still finish each iteration, even if some iterations take longer then the allocated period?

I have been reading documentation and performing different tests all day, but so far it seems that this is not possible.

Thanks, Mike

In reply #5 above above David recomended a Timed Sequence.

THat gives you multiple levels of priority and as well.

Ben

Link to comment
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.