Erkan Tairi on Thu, 11 Jun 2020 21:00:42 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: How to use OpenMP with PARI/GP?


Hi Bill,

>However, you need to make sure you are using the tls version of libpari.
>You need to build PARI with
>./Configuree --mt=pthread
>or with
>./Configure --enable-tls 

Thanks, configuring with --mt=pthread worked nicely. However, I have one issues
when one uses GEN type inside a struct. Please find my updated code here: https://codeshare.io/5OxlA0
That code throws PAR/GP segmentation fault, and somehow only the first entry from
the vector is printed. Any ideas about it?

Best regards,
Erkan

On Thu, Jun 11, 2020 at 2:03 PM Bill Allombert <Bill.Allombert@math.u-bordeaux.fr> wrote:
On Thu, Jun 11, 2020 at 12:39:40PM +0200, Erkan Tairi wrote:
> Hi,
>
> I'm interested in parallelizing a for loop that includes some PARI/GP
> operation using OpenMP. However, this seems a rather non-trivial task, and
> the closest thing to that is given here:
> https://fossies.org/linux/pari/examples/openmp.c
> But that uses the "sections" clause from OpenMP. I intend to parallelize a
> for loop, that's why I'm trying to use the "parallel for" clause. My test
> code along with the problem description is given here:
> https://stackoverflow.com/questions/62322277/how-to-use-openmp-with-pari-gp

Hello Erkan,
Your program seems correct. It works for me.
However, you need to make sure you are using the tls version of libpari.
You need to build PARI with
./Configuree --mt=pthread
or with
./Configure --enable-tls

Cheers,
Bill.