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

Home » Public Forums » archive » Running a code multiple times automatically
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: Running a code multiple times automatically [message #92576 is a reply to message #92575] Sat, 16 January 2016 13:38 Go to previous messageGo to previous message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 1/16/16 9:20 AM, nd451frd wrote:
> Dear friend of the forum.
>
> I am kindly writing to ask you if you know a practical way to run a
> code several times in a kind of parallel way in IDL.
>
> Lets say I have a code that is called "namecode.pro"
>
> which needs 2 inputs. I have to run it as:
>
> IDL> namecode, 'stringvar1', 'stringvar2'
>
>
> I would like to do something like
>
> for i=0, (9) do begin namecode, 'stringvar1', 'stringvar2' endfor
>
> but without waiting that process in i=0 is over and then the i=1 is
> over and so on, I just would like to run it 10 times all at the same
> time just to use 10 processors.
>
> I can open 10 terminals and run the code in each of the terminals,
> but I would like to do it in a code. It does not have to be with IDL,
> it could be done in a bash or tcsh as well.
>
> I am trying to use the IDL_IDLBridge option of IDL but with not
> success at the moment.
>
> Any help is very welcome.
>
> All the best and thanks in advance.
>

This uses my library at github.com/mgalloy/mglib, particularly the
src/multiprocessing set of routines. These use the IDL_IDLBridge to do
what you are looking to do.

; create 10 processes
pool = mg_pool(n_processes=10)

; I assume the arguments will be different for each process, but here
; we set them all to be the same
str1 = strarr(10) + 'stringvar1'
str2 = strarr(10) + 'stringvar2'

; since NAMECODE is a procedure result will be !null
result = mg_pool->map('namecode', str1, str2, /is_procedure)

; free the processes
obj_destroy, pool

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: list concatenation
Next Topic: problem with idl program

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

Current Time: Wed Oct 08 19:58:23 PDT 2025

Total time taken to generate the page: 0.00234 seconds