From support at acutisdata.com Fri Jul 19 02:13:39 2024 From: support at acutisdata.com (Brett Estrade) Date: Fri, 19 Jul 2024 00:13:39 +0000 Subject: [PerlOMP] first post, test Message-ID: <219f96f1-eafe-4be3-b0f6-d9a8294a820e@acutisdata.com> Hellow!! Cheers, Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: From brett at acutisdata.com Fri Jul 19 02:19:00 2024 From: brett at acutisdata.com (Brett Estrade, Principal) Date: Fri, 19 Jul 2024 00:19:00 +0000 Subject: [PerlOMP] test 2 Message-ID: <2825de1c-3b8f-424b-a727-8e0c0d5f3ad2@acutisdata.com> Check this out, # !/usr/bin/env perl use strict; use warnings; use OpenMP::Simple; use OpenMP::Environment; use Inline ( C => ' DATA ' , with => qw/ OpenMP::Simple / , ); my $env = OpenMP::Environment -> new; for my $want_num_threads ( 1 .. 8 ) { $env -> omp_num_threads( $want_num_threads ); $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_UPDATE_WITH_ENV__NUM_THREADS /* <~ MACRO x OpenMP::Simple */ #pragma omp parallel { #pragma omp single ret = omp_get_num_threads(); } return ret; } __END__ -- Brett Estrade Principal/Owner Coastal Computing Services, LLC DBA Acutis Computing and Data Consultancy https://coastalcomputingservices.net https://acutisdata.com -------------- next part -------------- An HTML attachment was scrubbed... URL: