|No such thing as a small change|
Re: OpenMP from Perl?by Moron (Curate)
|on Jun 21, 2007 at 12:45 UTC||Need Help??|
It is unclear if the Fortran only or the C++ as well made you shiver. I am hoping it was only the Fortran, because you might need to get at least your hair wet in respect of the C++ to solve this.
I know absolutely nothing about OpenMP (update: but Google is my friend - it already tells me that ANSI C is enough, so already the water got warmer).
It appears that OpenMP is dissembled across embedded, environment variable and shared object facilities. To use Perl instead of C for all three of these requires then three separate techniques:
1) compiler directives: For this part of the interface you could translate Perl main programs to C main programs without knowledge of C using B::C (update: or perlcc) and then apply the OpenMP directives to that as directed by the OpenMP documentation.
2) Environment variables: For these, I tend to make a subroutine that gets them parametrically and then uses IPC::Open3 to create a session with whatever foreign program (could be your own C from Perl program in thes case) is being run with syntax something like:
(update: strictly speaking that is a translation technique of shell to Perl rather than C to Perl of course)
3) shared objects - load those into Perl using P5NCI::Library.
That at least completes the 3 requirements to build the interfacing I found by googling - if there are more, do tell and we'll have a look for you. But (update) to address more of your questions:
"Is Perl 5 multi-threading robust enough to take such a standard?" Nothing to do with robustness - the OpenMP standard is suitable for C. You could try to take Perl's multithreading at source level and interface that to OpenMP, but I suspect the water is too cold for you there. (Update: to be clear, for an OpenMP implementation you would have to achieve the multithreading via something like the three techniques I outline above, and not by using Perl's own multithreading) Will Perl 6 support OpenMP? I presume that the modules I have mentioned will get ported to Perl 6 so I presume yes insofar as you need to build your own main glue interfacing along lines such as above.
^M Free your mind!