[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple threads



In article <37E0FE2C.79095DC9@clinmed.gla.ac.uk>,
David Brennan  <9147261b@clinmed.gla.ac.uk> wrote:
>My department is thinking of buying a new Sun system. We are considering
>buying a dual processor system. However, to take full advantage of this
>I need software that can be run as a multithread.
>
>1. Can IDl be written to take advantage of multithread processing?

IDL is capable of some multiprocessing will appropriate call_externals
and link_images, but not multithreading.  I've written some multiprocessing
code, but haven't ever published it, nor is it in a publishable state.
In order to do usable work you need the shared memory capabilities of
my VARRAY package (available at my web site).  If you wan't I'll put my
routines somewhere where you can get to them.  I haven't yet gotten any
good iplementations of IPCs beyond shared memory.

Here's a simple multiprocessing routine as an example of what I've done....

---------------------------------------------------------------------
function test
; create a 1024x1024 shared float array
  a=VARRAY(float(0),1024,1024,/writable) 
; process the [*,0:511] elements in the background
; process the [*,512:1023] elements in the foreground
  if PROC_FORK() eq 0 then begin
    a[*,0:511]=randomn(seed,1024,512)
    PROC_EXIT
  endif else begin
    a[*,512:1023]=randomu(seed,1024,512)
    PROC_WAIT
  endelse
  return,a
end
-----------------------------------------------------------------------


>2. If so, how is this accomplished, i.e does anyone have any example
>code?

Specialized libraries call the system code you need to make new processes.

Eric

-- 
Eric Korpela                        |  An object at rest can never be
korpela@ssl.berkeley.edu            |  stopped.
<a href="http://sag-www.ssl.berkeley.edu/~korpela";>Click for home page.</a>