develooper Front page | perl.perl5.porters | Postings from August 2021

Re: concurrency list (was Re: Relinquishing Maintenance of CoreModules)

Thread Previous | Thread Next
From:
David Christensen
Date:
August 3, 2021 05:40
Subject:
Re: concurrency list (was Re: Relinquishing Maintenance of CoreModules)
Message ID:
4ded81c2-bb5b-ce07-2ef0-58e25ce88878@holgerdanske.com
On 8/2/21 9:14 PM, Yuki Kimoto wrote:
> 2021-8-3 12:05 David Christensen <dpchrist@holgerdanske.com> wrote:
>> On 8/2/21 7:20 PM, Yuki Kimoto wrote:

>>> https://metacpan.org/pod/SPVM

> I'm sorry for introducing my personal development.


Thank you for introducing SPVM.  :-)


>> At a glance, SPVM looks like an alternative to Perl XS
> 
> Yes. SPVM is a language transpiler to C.


Okay.


>> Does SPVM support concurrency in any form(s)?
> 
> First concurrency support is easy to implement C openmp binding.
> 
> https://github.com/yuki-kimoto/SPVM/tree/master/examples/native/openmp/lib

<snip>


I would like to understand the first concurrency example, and will hold 
off on the second example and remainder of your reply for now.  Please 
bring the removed ideas back into the conversation if and when it makes 
sense.


Looking at:

https://github.com/yuki-kimoto/SPVM/tree/master/examples/native/openmp


I see:

- lib/MyOpenMP.c => contains C source code:

   - int32_t SPNATIVE__MyOpenMP__sum_vec_int(...) {...} => defines a 
SPVM native function in the package "MyOpenMP" with function name 
"sum_vec_int"

   - #pragma omp parallel for => enables OpenMP parallelization of the 
following "for" loop

- lib/MyOpenMP.spvm => contains SPVM source code:

   - package MyOpenMP => sets the package namespace

   - sub test : void () {...} => defines the package "MyOpenMP" function 
"test"

- lib/MyOpenMP.conf => contains SPVM transpiler configuration settings

- openmp.pl => contains Perl source code:

   - use SPVM 'MyOpenMP' => imports the package "MyOpenMP" created by 
the SPVM transpiler (presumably via EUMM or MB)

   - MyOpenMP->test => invokes the class "MyOpenMP" method "test"


So, SPVM deals with several intermediate layers between OpenMP 
concurrency and the Perl script:

- pragmatized C "for" loop

- C function "SPNATIVE__MyOpenMP__sum_vec_int"

- SPVM function "MyOpenMP::sum_vec_int"

- SPVM function "MyOpenMP::test"


Is there a way to eliminate one or more intermediate layers?

- Calling MyOpenMP::sum_vec_int() from Perl?

- Putting "#pragma omp parallel for" above a Perl "for" loop?


David

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About