Editing
Portal:Perl+OpenMP
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Introduction == WIth most perl binaries compiled with a version of GCC that [https://gcc.gnu.org/projects/gomp/ supports OpenMP] in some form, it make a lot of sense to explore the use of OpenMP with Perl programs - and to make it much easier. This is where the Perl+OpenMP Project comes into play. The following page is really meant to be an overview of what is possible and the resources available to those interested in such efforts. ==== See Also ==== See main project site, https://github.com/Perl-OpenMP/ for more information. == Quick Start == #!/usr/bin/env perl use strict; use warnings; use OpenMP; use Inline ( C => 'DATA', with => qw/OpenMP::Simple/, ); my $omp = OpenMP->new; for my $want_num_threads ( 1 .. 8 ) { $omp->env->omp_num_threads($want_num_threads); $omp->env->assert_omp_environment; # (optional) validates %ENV # call parallelized C function my $got_num_threads = _check_num_threads(); printf "%0d threads spawned in ". "the OpenMP runtime, expecting %0d\n", $got_num_threads, $want_num_threads; } __DATA__ __C__ /* C function parallelized with OpenMP */ int _check_num_threads() { int ret = 0; PerlOMP_GETENV_BASIC #pragma omp parallel { #pragma omp single ret = omp_get_num_threads(); } return ret; } __END__ == Alternate Compiler Support == This section will cover using Perl+OpenMP on compilers other than GCC. The trick is to adapt `Alien::OpenMP` to support other compilers that can be used to compile `perl` and also support OpenMP. === Clang === In principle, `Alien::OpenMP` supports clang. === Intel OneAPI === section in progress ... (track at https://github.com/Perl-OpenMP/p5-Alien-OpenMP/issues/25) == Special Topics == === Perl+OpenMP and wxPerl === See https://github.com/Perl-OpenMP/p5-OpenMP-wxPerl for a demo. [[File:400638381-d93611d5-e068-4130-821a-b6da55101545.png|thumb|Example wxPerl application controlling real OpenMP threads in realtime. Demo project hosted [https://github.com/Perl-OpenMP/p5-OpenMP-wxPerl here].]] === Intel Xeon Phi Co-Processor === section in process ...(track https://github.com/Perl-OpenMP/p5-Alien-OpenMP/issues/26)
Summary:
Please note that all contributions to Perl Guilds - Getting Medieval with Perl may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Perl Guilds - Getting Medieval with Perl:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Tools
What links here
Related changes
Page information