Bill Allombert on Thu, 11 Jun 2020 14:03:48 +0200


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

Re: How to use OpenMP with PARI/GP?


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.