mersenneforum.org  

Go Back   mersenneforum.org > Math Stuff > Computer Science & Computational Number Theory > PARI/GP

Reply
 
Thread Tools
Old 2023-08-16, 10:13   #12
WraithX
 
WraithX's Avatar
 
Mar 2006

10548 Posts
Default

When you start PARI/GP, you should see a line similar to the following:

Code:
parisize = 8000000, primelimit = 500000, nbthreads = 24
If you don't see "nbthreads", then you do not have a multithread capable PARI/GP.

I'm sure you have other examples to work with, but here is one I just created:
Code:
spawn_thread_work(a, b) = {
  print(a+b);
}

calculate_unique_var(i) = {
  return(i);
}

do_parallel_work(num_threads, first_n, last_n) = {
  my(i);
  default(nbthreads, num_threads);
  parfor(i = first_n, last_n,
    my(myvar = calculate_unique_var(i));
    spawn_thread_work(myvar, i);
  );
}

\\ the following line is needed so all threads can have their own copy of functions
export(calculate_unique_var, spawn_thread_work);

\\ now you can call "do_parallel_work" and it should spawn multiple threads
do_parallel_work(4, 1, 1000) \\ 4 threads in this case
WraithX is offline   Reply With Quote
Old 2023-08-16, 12:17   #13
paulunderwood
 
paulunderwood's Avatar
 
Sep 2002
Database er0rr

2×74 Posts
Default

Thanks for that.

Code:
/usr/local/bin/gp
Reading GPRC: /etc/gprc
GPRC Done.

                                  GP/PARI CALCULATOR Version 2.15.1 (released)
                          amd64 running linux (x86-64/GMP-6.2.1 kernel) 64-bit version
                      compiled: Aug 16 2023, gcc version 10.2.1 20210110 (Debian 10.2.1-6)
                                            threading engine: single
                               (readline not compiled in, extended help enabled)

                                     Copyright (C) 2000-2022 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.

parisize = 8000000, primelimit = 500000
Code:
/usr/bin/gp-2.13 
Reading GPRC: /etc/gprc
GPRC Done.

                                  GP/PARI CALCULATOR Version 2.13.1 (released)
                          amd64 running linux (x86-64/GMP-6.2.1 kernel) 64-bit version
                      compiled: Jan 25 2021, gcc version 10.2.1 20210110 (Debian 10.2.1-6)
                                           threading engine: pthread
                                 (readline v8.1 enabled, extended help enabled)

                                     Copyright (C) 2000-2020 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 ?17 for how to get moral (and possibly technical) support.

parisize = 8000000, primelimit = 500000, nbthreads = 128
? 

Goodbye!
This is useful because now parforprime works and I need pthreads to check an ECPP cert.
paulunderwood is offline   Reply With Quote
Old 2023-08-16, 13:10   #14
science_man_88
 
science_man_88's Avatar
 
"Forget I exist"
Jul 2009
Dartmouth NS

851510 Posts
Default

Quote:
Originally Posted by paulunderwood
This is useful because now parforprime works and I need pthreads to check an ECPP cert.
Glad to hear. Still think single pass logic might be good. Don't know default precidence or proper symbol for single pass logic but I'd bet it can still go faster...
science_man_88 is offline   Reply With Quote
Reply

Thread Tools


All times are UTC. The time now is 11:11.


Sun Sep 24 11:11:14 UTC 2023 up 11 days, 8:53, 0 users, load averages: 0.96, 0.91, 0.95

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔