Skip to content

it is possible to use pathos with gmpy2 ?Β #279

@christopher52

Description

@christopher52

HELLO !
I'm writting a program that works without pathos but it uses 1 processor / 16.
I found a prime number with 40000 digits but it takes 1 week to get the result (only 1 processor)
My goal is to find faster very large prime numbers with rounding floats (more than 40000 digits) thanks pathos and gmpy2 in order to get prime integers.

At the beginning of my program :
import gmpy2
from gmpy2 import mpz, mpfr, is_prime
import sys
sys.set_int_max_str_digits(0)
import ppft

LOCAL_WORKERS = 'autodetect' #XXX: 'autodetect' or 0,1,2,...
print("Known servers: [('local',)] %s" % (job_server.ppservers))
result : 16 processors

n_list = [ ]
while n < 9999999:
if is_prime(n):
n_list.append(n)
if len(n_list) > 1:
resultat = MyEquation
inputs = (resultat)
jobs = [(input, job_server.submit(is_prime, (input, ), (newprimes, ),
("math", ))) for input in inputs]
for input, job in jobs:
print(MyEquation)
("is_prime" is a function imported already written by gmpy2)
("newprimes" is a function I wrote using mpfr and mpz from gmpy2 for calcul)
("resultat" and "myEquation" are variable as result from using calcul with mpz and mpfr)

But I get these errors :
TypeError: 'mpfr' object is not iterable
TypeError: 'mpz' object is not iterable

your help would be much appreciated!
Thanks,
Christophe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions