comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Parallel Processing
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Parallel Processing [message #80712 is a reply to message #80624] Thu, 05 July 2012 08:29 Go to previous messageGo to previous message
Russell Ryan is currently offline  Russell Ryan
Messages: 122
Registered: May 2012
Senior Member
On Thursday, July 5, 2012 11:16:27 AM UTC-4, Stefan wrote:
> Am Donnerstag, 5. Juli 2012 17:13:02 UTC+2 schrieb fawltyl...@gmail.com:
>> On Thursday, July 5, 2012 4:52:23 PM UTC+2, Stefan wrote:
>>> Hi
>>>
>>> Now that I have successfully implemented multi-threading another problem occured:
>>>
>>> To invoke multiple processes I start in a loop with
>>>
>>> bridges[i]->EXECUTE, 'program,par1,par2', /NOWAIT
>>>
>>> where 'bridges' is an object-array which holds the different child processes.
>>> Upon the execution of the last process I do
>>>
>>> bridges[i]->EXECUTE, 'program,par3,par4'
>>>
>>> And after that I destroy my bridges in a loop.
>>>
>>> Now I have a problem if the last process finishes before one of the previous processes since upon its completion it will directly move to the part where all bridges are destroyed and kills my program...
>>>
>>> Is there an easy way to tell IDL to wait for all my processes to finish and then destroy the bridges?
>>>
>>> thanks
>>> Stefan
>>
>> Use IDL_IDLBridge::Status to determine whether the job is finished. Pseudocode:
>>
>> ndone=0
>> running=replicate(1, njobs)
>> while ndone lt njobs begin
>> for j=0,njobs-1 do begin
>> if running[j] then begin
>> query status of the j-th job with IDL_IDLBridge::Status
>> if finished
>> destroy bridge
>> running[j]=0
>> ndone++
>> endif
>> endif
>> endfor
>> wait, 1
>> endwhile
>>
>>
>> regards,
>> Lajos
>
> Ah, I see you put WAIT there if its not finished. I thought of using this in a loop but without putting WAIT you spend too many resources.
>
> Thanks! :)

Yeah, I put a wait in there too. I've thought about "calibrating" the wait time. It seems to me that if your process takes (say 30 minutes) then polling the bridges every 1 second seems like overkill. My gut-feeling is that this wait time should be roughly 1/3 or 1/4 the expected time per process, but of course you'd want to ensure that it's always waiting a minimum of ~0.5 s.

Russell
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Upgrade IDL
Next Topic: Function graphics equivalent of !X.OMARGIN?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:27:57 PDT 2025

Total time taken to generate the page: 0.00405 seconds