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)use IPC::Open3; sub NameOfCommandInterface { # subcommand, envvar, val, envvar, val... my $subcommand = shift; my $env = ''.; while ( @_ ) { $env .= 'export ' . shift(); $env .= '="' . shift() . '";'; } my $pid = open3 my $wh, my $rh, my $eh, $env . 'NameOfCommand' or +die $!; print $wh $subcommand; close $wh; my @er = <$eh> and die ( join ('',@er )); close $eh; my @rt = <$rh>; close $rh; waitpid $pid, 0; return @rt; }
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!
In reply to Re: OpenMP from Perl?
by Moron
in thread OpenMP from Perl?
by cdarke
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |