2

I am writing a global climate simulation software system. My idea is the following :

At the top of everything, I interface to the OS using D, a very powerful language for compile time code generation. The D code gets environmental variables, finds necessary input data, and then according to the config files, initiates Lua codes.

Lua is a pretty fast language used in many games, and the good thing about it is that it offers certain dynamism, considering the the lanuage is not typed, variables can have any type - this is very nice to have to account for polymorphism. ( Iknow fortran can support polymorphism, but Lua is comfortable)

Finally I want to convert the polymorphic data back to static data just in time of computation and call Fortran or Python methods, or may be even C. For this, I will use pipes - or fifos, based on the requirements.

My question would be: can Fortran / C / Python handle pipe and fifo without loosing much of its speed?

nicoguaro
  • 8,500
  • 6
  • 23
  • 49
Sean
  • 121
  • 3
  • Welcome to the site. I've got a lot to say about performance, and mostly it is not to prejudge anything, but to wait and see what actually takes time, and then fix it, because it won't be anything you could guess. That said, since I/O is basically a system function, the only way any run-time library can slow it down is by spending time formatting/unformatting data. I do binary I/O if I/O is taking too much time.
  • – Mike Dunlavey Jul 21 '14 at 13:29
  • The question is perhaps a little unclear. Why not just do everything from Lua? Or D if you need the performance? And why use sockets and not just call C/Fortran/python directly from Lua? A little more info would be nice :) – LKlevin Jul 21 '14 at 15:22
  • I would prefer D for writing comfort - it is very capable of compile time code generation. – Sean Jul 21 '14 at 18:33
  • Do you want to call Fortran/C/Python functions from Lua, or D? Most languages have a foreign function interface to C, so calling C functions typically isn't a problem, and then the operative question becomes, "Do I have to call Fortran and Python via C?" Cursory research suggests there are interfaces to call Python code from both D and Lua, and that you'd need to call Fortran code via C in both languages. Like LKlevin, I also don't understand why you want to use sockets. – Geoff Oxberry Jul 21 '14 at 18:48
  • I want to call C/ Fortan methods from Lua, and I know how to do it. But I will loose some performance on the interface. Question is, which language, when combined with Lua is the least lose of performance. – Sean Jul 21 '14 at 21:27