Piercarlo Giannattasio on Mon, 30 Jun 2025 21:35:42 +0200


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

Re: Forprime and posix multithreading


Attached to the mail, you will find the code.
Compiled with PARI/GP 2-17-2 and GCC c=99.

Piercarlo

Il giorno lun 30 giu 2025 alle ore 13:25 Piercarlo Giannattasio <piercarlo.giannattasio@gmail.com> ha scritto:

Piercarlo da Iphone 

Inizio messaggio inoltrato:

Da: Bill Allombert <Bill.Allombert@math.u-bordeaux.fr>
Data: 30 giugno 2025 alle ore 12:40:30 CEST
A: pari-users@pari.math.u-bordeaux.fr
Oggetto: Re: Forprime and posix multithreading

On Mon, Jun 30, 2025 at 10:14:13AM +0000, Piercarlo Giannattasio wrote:
Good morning,
I'm trying to code a prime number generator in a specified range, using GP
and C, and I need to reduce processing times.

What is a prime number generator ? How is it different from forprime ?

I'm trying to use forprime and posix multithreading, but when executing the
code I'm exceeding the parisizemax. I've tried with 1-15 threads, assigning
16GB of memory only to PARI, but I still get the same error: sometimes it
only calculates the first iteration of forprime_next...

You need to set threadsizemax too.

Also, is there any technical documentation for the C implementation, besides
the one I'm studying (User Guide, Tutorial, Introduction to gp2c,
Introduction to Parallel GP) ?

Thre are the libpari manual, the examples directory, and of course the PARI source code.

But I suggest you send me your code, I will tell you what you need to read.

Cheers,
Bill.

Attachment: primegen.c
Description: Binary data