hermann on Tue, 06 Jun 2023 21:41:07 +0200


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

Re: Abnormous memory use for gaussian gcd()?


        Thank you, I did build from last stable on i7-11850H.
        How can I build from master branch?


    I also fixed gcd to be faster (slightly faster than ggcd).

    To get the master branch
    do
    git checkout master
    ...

Thanks for the instructions, I followed and all worked fine.
In latest commit I added quite some ";" to three .gp files to avoid unnecessary output:
https://github.com/Hermann-SW/RSA_numbers_factored/commit/f40882de70f7742ee5e3a7b3d71d7a551fec18e4

During the tests I saw that resident memory still went above 6G.
So I thought that GP might only cleanup if needed (and it was not needed with my 24G settings in /etc/gprc). So I did set parisize and parisizemax back to 2G and now all is fine memory wise, with same runtimes:

As you said, now gcd() is a bit faster than ggcd().

pari$ gp-2.16 < 36401.gp
Reading GPRC: /etc/gprc
GPRC Done.

        GP/PARI CALCULATOR Version 2.16.1 (development 28569-63935bc03)
          amd64 running linux (x86-64/GMP-6.1.2 kernel) 64-bit version
            compiled: Jun  6 2023, gcc version 8.5.0 20210514 (GCC)
                           threading engine: pthread
                (readline v7.0 disabled, extended help enabled)

                     Copyright (C) 2000-2023 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?18 for how to get moral (and possibly technical) support.

parisizemax = 2000003072, primelimit = 1048576, nbthreads = 8
foobar
gcd()
  ***   last result: cpu time 11,587 ms, real time 11,645 ms.
ggcd()
  ***   last result: cpu time 11,794 ms, real time 11,808 ms.
Goodbye!
pari$


So thanks for fixing gcd() and for the master branch git pointers.

But I have to thank the most for your halfgcd() tip.
I used gcd(p, sqrtm1+I) to determine (unique) sum of squares for prime p.
halfgcd(sqrtm1, p) does compute something different than gcd().
But it allows to determine sum of squares as well.
In 87ms(!!!) yesterday for 388342-digit prime:
https://pari.math.u-bordeaux.fr/archives/pari-users-2306/msg00011.html
https://github.com/Hermann-SW/RSA_numbers_factored/blob/main/pari/388342.halfgcd.gp

That is so cool, with your gcd() fix halgcd() became even faster!

pari$ gp-2.16 < 388342.halfgcd.gp
Reading GPRC: /etc/gprc
GPRC Done.

        GP/PARI CALCULATOR Version 2.16.1 (development 28569-63935bc03)
          amd64 running linux (x86-64/GMP-6.1.2 kernel) 64-bit version
            compiled: Jun  6 2023, gcc version 8.5.0 20210514 (GCC)
                           threading engine: pthread
                (readline v7.0 disabled, extended help enabled)

                     Copyright (C) 2000-2023 The PARI Group

PARI/GP is free software, covered by the GNU General Public License, and comes
WITHOUT ANY WARRANTY WHATSOEVER.

Type ? for help, \q to quit.
Type ?18 for how to get moral (and possibly technical) support.

parisizemax = 2000003072, primelimit = 1048576, nbthreads = 8
foobar
  ***   last result: cpu time 60 ms, real time 60 ms.
done
Goodbye!
pari$


Regards,

Hermann Stamm-Wilbrandt.