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

Home » Public Forums » archive » Re: Passing an array from IDL to MPI
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Passing an array from IDL to MPI [message #28852] Mon, 14 January 2002 06:03 Go to next message
Mark Rivers is currently offline  Mark Rivers
Messages: 49
Registered: February 2000
Member
Miska Le Louarn <lelouarn@eso.org> wrote in message
news:3C428D26.1080405@eso.org...
> Hi all IDL / parallel computing experts !
>
> I am trying to integrate a piece of MPI-code written in C into my IDL
> program.
> I have a cube of data produced in the IDL code, which needs to be
> Fourier transformed. So I want to write a little MPI program (in C)
> which uses several CPUs to compute the FFT of each plane in the cube.
> My problem is that I need to pass the data cube to the MPI program. This
> would not a problem with a plain C program (a simple call_external would
> do the trick), but MPI likes to be lauched with the "mpirun" command
> which initializes all the parallel stuff.

You might want to consider another solution to obtain rapid 2-D FFTs taking
advantage of multiple CPUs. This is to use the Intel Math Kernal Library
(MKL) routines. These are free, highly optimized for Intel CPUs, and take
advantage of multiple CPUs if they are present. I have written tomography
reconstruction code that is accessed via CALL_EXTERNAL from IDL, and uses
this library. The MKL speeded things up a factor of 3-4 compared to non-MKL
FFT routines. The latest version of the MKL is available for Linux as well
as Windows.

Mark Rivers
Re: Passing an array from IDL to MPI [message #28855 is a reply to message #28852] Mon, 14 January 2002 04:18 Go to previous messageGo to next message
ronn is currently offline  ronn
Messages: 123
Registered: April 1999
Senior Member
in article 3C428D26.1080405@eso.org, Miska Le Louarn at lelouarn@eso.org
wrote on 1/14/02 2:47 AM:

> Hi all IDL / parallel computing experts !
>
> I am trying to integrate a piece of MPI-code written in C into my IDL
> program.
> I have a cube of data produced in the IDL code, which needs to be
> Fourier transformed. So I want to write a little MPI program (in C)
> which uses several CPUs to compute the FFT of each plane in the cube.
> My problem is that I need to pass the data cube to the MPI program. This
> would not a problem with a plain C program (a simple call_external would
> do the trick), but MPI likes to be lauched with the "mpirun" command
> which initializes all the parallel stuff.
>
> Any ideas ?
> Of course I could write the data cube to a file from IDL. I could then
> spawn the mpirun process from IDL and have the MPI code read the file.
> But I think there is a significant loss of time doing that. Plus it's
> not very elegant...
>
> I hope someone has an idea...
Hi Miska,

I have written an IDL interface to PVM (another parallel processing system)
so it is possible to do. PVM must also be initialized with a function call
that returns some parameters. You then spawn off the child processes with
these parameters as part of the call.

What this means is that you have to write a multi-function dll that contains
all the interface routines that you need.

Hope this helps.

-Ronn


--
Ronn Kling
KRS, inc.
email: ronn@rlkling.com
"Application Development with IDL"� programming book updated for IDL5.5!
"Calling C from IDL, Using DLM's to extend your IDL code" NEW BOOK!
http://www.rlkling.com/
Re: Passing an array from IDL to MPI [message #28962 is a reply to message #28855] Mon, 21 January 2002 07:41 Go to previous message
Miska Le Louarn is currently offline  Miska Le Louarn
Messages: 8
Registered: December 1995
Junior Member
> I have written an IDL interface to PVM (another parallel processing system)
> so it is possible to do. PVM must also be initialized with a function call
> that returns some parameters. You then spawn off the child processes with
> these parameters as part of the call.
>
> What this means is that you have to write a multi-function dll that contains
> all the interface routines that you need.


Hmm, this looks interesting...
Could you give a 2 line example on how to do this ? :-)
For the moment, I know how to use call externals and spawns. What is, in
this case, the big advantage of using DLLs ?

Thanks !

Miska

--
* Miska Le Louarn Phone: (49) 89 320 06 908 *
* European Southern Observatory FAX : (49) 89 320 23 62 *
* Karl Schwarzschild Str. 2 e-mail: lelouarn@eso.org *
* D-85748 Garching http://www.eso.org/~lelouarn *
* Germany
*
Re: Passing an array from IDL to MPI [message #28963 is a reply to message #28852] Mon, 21 January 2002 07:38 Go to previous message
Miska Le Louarn is currently offline  Miska Le Louarn
Messages: 8
Registered: December 1995
Junior Member
>
> You might want to consider another solution to obtain rapid 2-D FFTs taking
> advantage of multiple CPUs. This is to use the Intel Math Kernal Library
> (MKL) routines. These are free, highly optimized for Intel CPUs, and take
> advantage of multiple CPUs if they are present. I have written tomography
> reconstruction code that is accessed via CALL_EXTERNAL from IDL, and uses
> this library. The MKL speeded things up a factor of 3-4 compared to non-MKL
> FFT routines. The latest version of the MKL is available for Linux as well
> as Windows.
>


Yes, that is a solution. Another one is to use IDL 5.5 which includes
some parallel processing support (FFT is threaded).

MKL is also nice but not really portable. Even AMD processors (which
provide a cheaper way to build fairly fast machines) are not MKL
compatible...

However, these approaches allow "only" a gain of a factor of 2 with
"cheap architectures". More than 2 CPUs on one motherboard is usually
really expensive.
I was planning to use 5-10 CPUs, so threading is not really an option.

Thanks for your help thought.

Miska

--
* Miska Le Louarn Phone: (49) 89 320 06 908 *
* European Southern Observatory FAX : (49) 89 320 23 62 *
* Karl Schwarzschild Str. 2 e-mail: lelouarn@eso.org *
* D-85748 Garching http://www.eso.org/~lelouarn *
* Germany
*
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Turning off math error checking for a code block
Next Topic: naming elements in an array

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

Current Time: Wed Oct 08 15:51:55 PDT 2025

Total time taken to generate the page: 0.00616 seconds