![]() |
![]() |
#12 |
Mar 2006
22×139 Posts |
![]()
When you start PARI/GP, you should see a line similar to the following:
Code:
parisize = 8000000, primelimit = 500000, nbthreads = 24 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 |
![]() |
![]() |
![]() |
#13 |
Sep 2002
Database er0rr
2×74 Posts |
![]()
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! ![]() |
![]() |
![]() |
![]() |
#14 | |
"Forget I exist"
Jul 2009
Dartmouth NS
5·13·131 Posts |
![]() Quote:
|
|
![]() |
![]() |