Mailing List Archive

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.

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

* OpenMP::Environment
* Alien::OpenMP
* Inline::C
* Tie::OpenMP (!exists, vaporwarez)

https://github.com/Perl-OpenMP/p5-OpenMP-Environment/blob/master/examples/07-2dheat.pl

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 inserting 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 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).

I try to not make an promises that I don't intend to fulfill,
but I am committed to submitting a full talk regarding OpenMP
and Perl at the next conference. There was a surprising amount
of interest when I discussed this during the summer at a
lightning talk,

* https://www.youtube.com/watch?v=LWs_rJT9lg4 (6min,YAPC::ZOOM::2021)
* https://www.youtube.com/watch?v=wHjmxGJd7rQ (2hr,Houston PM, intro to OpenMP)

If you made it this far, note that OpenMP itself is extremely
aware of %ENV, particularly C<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.

Cheers,
Brett

--
--
oodler@cpan.org
oodler577@sdf-eu.org
SDF-EU Public Access UNIX System - http://sdfeu.org
irc.perl.org #openmp #pdl #native