open invitation to participate in Perl-OpenMP on Github

I've had https://github.com/Perl-OpenMP up for a while, but I only recently thought to post an open invitation for others interested in this exploration topic to join. #openmp on irc.perl.org exists, semi-related IRC channels inlcude: #native and #pdl.

My confidence in the value of this line of work was bolstered recently when I shoved in an old finite element of 2dheat conduction into a Perl script using,

Two interesting examples follow:

The second of these examples takes an example from Inline::C::Cookbook that shows how to process an array reference, coupled with an OpenMP reduction by OMP_NUM_THREADS threads.

gcc has supported OpenMP's 4.5 specification as of version 7. So it's there and there are many ways that it can be leveraged via Perl.

The goal of this project initially is mainly just figuring out all the ways to leverage OpenMP in as Perlish of a way as possible.

It helps to be familiar with OpenMP, but that's not required. Some open questions I'd like to explore personally, include:

  • utility of an Inline::OpenMP and what it'd look like/provide e.g., automatically nserting calls to 'getenv' to look for the current state of the runtime %ENV (e.g., OMP_NUM_THREADS)
  • architecture and viability of "parallel" data structures using Tie::* (or something else)
  • extending compiler and platform support via Alien::OpenMP
  • what does a "perlish" general interface to OpenMP things look like
  • discovering real world (and non-obvious) applications
  • where can OpenMP be applied wrt Perl API/internals (via Inline::C or XS)

This is laser focused on OpenMP and is not intended to replace anything that's out there (SPVM, PDL, async, fork, etc). OpenMP implies a peculiar programming and memory model, so the main work will focus on where "Perl and OpenMP meet". This is also not generally for "shared memory" - BUT, I'd be more than happy to get anyone interested in shared memory programming (in general and Perl).

There was a surprising amount of interest when I discussed this during the summer at a lightning talk,

If you made it this far, note that OpenMP itself is extremely aware of %ENV, particularly OMP_NUM_THREADS. This might get lost on someone not familiar with it - but it presents some challenges to the way we generally think about %ENV and the loading of shared libs created by things like Inline::C. The example I linked above has a naive way to check %ENV each time it's called; which is actually a work around from the native behavior of libgomp (and I am sure other compiler implementations) checking the environment when the shared lib is initially loaded via Inline::C magic.

There's no urgency here, just radiating it's available. I'm just as guilty of ignoring this stuff for periods of time. So it's for fun and no pressure. But It does seem like a topic others might be interested in - please leave your thoughts in the comments below!

1 Comment

This is absolutely so cool

Leave a comment

About Oodler 577

user-pic Mayor of Falvortown