On Nov 22, 2010, at 10:48 AM, Daniel Carrera wrote:
> On Sun, Nov 21, 2010 at 3:15 PM, Craig DeForest
> <[email protected]> wrote:
>> It seems that way to me -- PDL, like those other vectorized  
>> languages, is useful for comparatively
>> brain intensive (vs. cpu intensive) tasks such as data analysis,  
>> while really heavy duty stuff like
>> (say) MHD modeling is best performed down in a lower level compiled  
>> language.  That said, I do
>> use PDL as a front end for our solar MHD model, which is written in  
>> C and can take days to weeks
>> to complete a simulation in 8 CPUs.
>
> Heh, some theorists might be disappointed to hear that their work is
> not brain intensive ;-)

It's all about the ratio :-)

> But I think I get your meaning. I am actually
> interested in going toward the theory / computation side of
> astrophysics, so I was thinking about what role PDL could play in my
> work. I could use Fortran or C to run a simulation and then PDL as a
> front end to analyze the results, just as you do with your MHD model.

Fronting can be done at a couple of levels.  Of course you can have  
your sim generate output and then snarf it in to PDL for analysis; our  
MHD sim is implemented more or less as just a C library of function  
calls -- a plugboard, if you will.  All control functions and data  
access (aside from a simple dump/restore capability for saving  
simulation state) are mediated through the PDL front-end - there is an  
XS library that treats the internal data structures as tied hashes and  
PDLs; and the basic simulation tasks are all mediated through top- 
level XS functions that jump into the C library.

That was a pain to implement at first (I had to learn a bit about how  
XS and data ref counts work) but in the long run has been a boon,  
since it allows pretty good transparency into what the sim is doing at  
each step.

Of course, if you're using an existing code with a well defined  
interface then you don't need to implement another one, but if you're  
starting from scratch an all-Perl control interface isn't such a bad  
idea.



_______________________________________________
Perldl mailing list
[email protected]
http://mailman.jach.hawaii.edu/mailman/listinfo/perldl

Reply via email to