Ask Your Question

Softy's profile - activity

2022-01-31 22:47:44 +0200 received badge  Notable Question (source)
2021-01-15 05:58:59 +0200 received badge  Famous Question (source)
2020-05-17 09:51:07 +0200 received badge  Famous Question (source)
2019-12-03 00:00:13 +0200 received badge  Notable Question (source)
2019-12-03 00:00:00 +0200 received badge  Popular Question (source)
2019-08-28 05:10:39 +0200 received badge  Popular Question (source)
2019-07-31 13:22:50 +0200 received badge  Notable Question (source)
2019-02-21 17:15:29 +0200 received badge  Popular Question (source)
2018-06-15 11:26:07 +0200 commented answer @parallel Parallel Pollard-Rho

Ok thank you for the advice! So there is no easy and quick solution to my problem? To have 4 CPUs work on a shared list and look for a matching element?

2018-06-14 18:25:51 +0200 commented answer @parallel Parallel Pollard-Rho

In my example, how can I realize that different CPUs are working on the same list looking for a match?

2018-06-14 18:07:25 +0200 commented answer @parallel Parallel Pollard-Rho

How can I implement that? Neither works. If I comment out the @parallel, my program has the same speed as with the @parallel. Something is not working... Where would I need toput the @fork decorator? (I'm really not that good a programmer.. and I don't seem to understand the parallel logic sage uses.)

2018-06-14 17:46:08 +0200 commented answer @parallel Parallel Pollard-Rho

the @fork does not seem to work either .. or I don't know how to implement it the right way.. Could you maybe explain a bit more about how to do this?

2018-06-14 16:50:23 +0200 received badge  Supporter (source)
2018-06-14 16:27:09 +0200 commented answer @parallel Parallel Pollard-Rho

How do I use fork? Do I just change the @parallel to @fork(4)? And how could I use 'threading'? If you have the time it would be really helpfull if you could explain this is some more detail!! (or an example?) But in any case thank you for the answer!

2018-06-13 15:56:44 +0200 received badge  Editor (source)
2018-06-13 13:52:34 +0200 received badge  Student (source)
2018-06-13 13:47:04 +0200 asked a question @parallel Parallel Pollard-Rho

I am currently working on the implementation of a parallelized Pollard-Rho algorithm. I want to use the @parallel command to

D = {}
@parallel(4)
def dist_points(P,Q,dist_prop,r):
    ord = P.order()
    seed = randint(1,ord)
    X = [seed*P,seed, 0]
    counter = 0
    counter4 = 0
    m = [randrange(0,ord) for i in range(r)]
    n = [randrange(0,ord) for k in range(r)]
    T = [(m[j]*P + n[j]*Q) for j in range(r)]
    while(True):
       #step function (linear walk)
       X = step_linear(T,m,n,ord,X,r)
        counter += 1
        counter4 += 1
        (Pi, ai, bi) = X
        x_coord = Pi[0]
        global D
        if ZZ(x_coord)%dist_prop==0:
            if Pi in D:
                (a,b) = D[Pi]
                if gcd((b-bi),ord)==1:
                    log = ((ai-a)/(b-bi))%ord
                    return log, counter4
            else:
                D[Pi] = (ai,bi)
                seed = randint(1,P.order())
                X = [seed*P, seed, 0]
                counter = 0
        elif counter > 100*dist_prop:
            seed = randint(1,P.order())
            X = [seed*P,seed, 0]
            counter = 0

The result of the function works. But I have the feeling that the parallelization does not work. I want my 4 CPU's to work parallel on a same list D looking for points until they find a match. But when I change the 6th line to

X = [P,1,0]

so that all the CPU's do the same walk (since my step_linear function is deterministic), I get the same timing. So it seems that the parallization does not work...

Also this program should work faster for a dist_prop>1. Since we put otherwise all points in the list, and then there is no need for a parallelization right? But my program gets slower the bigger the 'dist_prop' is.

So I thought that might be due to a wrong use of the @parallel command.

I hope someone can help me with the parallel problem!

2018-06-08 18:38:46 +0200 commented answer @Parallel - how to use all CPUs

Thank you very much! Where do I type the 'export' comment in?

2018-05-26 01:40:40 +0200 received badge  Scholar (source)
2018-05-26 01:39:46 +0200 asked a question @Parallel - how to use all CPUs

I am currently working on a parallelised implementation of Pollard-Rho.

For the parallelization of the program I want to use @parallel. But how can I allow Sage to use all the CPUs I have? When I put what they propose in ''doc.sagemath.org/html/en/reference/parallel/sage/parallel/parallelism.html'' :

Using all the cores available on the computer to parallelize tensor computations:

sage: Parallelism().set('tensor')
sage: Parallelism() # random (depends on the computer)

I get back:

Number of processes for parallelization:
- tensor computations: 1

But my computer has more. (Windows tells me: Processor: Intel(R) Core(TM)i5CPU M560 @2.67GHz 2.67 GHz). How do I activate these?

2018-05-10 23:45:41 +0200 asked a question Twists of an Elliptic Curve over a Finite Field (secp256k1)

I would like to calculate the twists of secp256k1 up to isomorphism (find one representative for the quadratic twist, and so on). Therefore I tried the function
E.quadratic_twist(d) and E.sextic_twist(d)
with E = EllipticCurve(GF(115792089237316195423570985008687907853269984665640564039457584007908834671663), [0,0,0,0,7]).
The problem is that I don't understand what the variable $d$ does in this function.
I tried different $d$ and found a quadratic twist with $d=3$ $E' : y^2 = x^3 + 12096 = x^3 + 7 \cdot (12)^3$ and tested that $12$ is square-free in $\mathbb{F}_q$, and two sextic twists with $d=3,7$: $E^{d_6}_1: y^2 = x^3 + 7\cdot 139968$ and $E^{d_6}_2: y^2 = x^3 + 7\cdot 326592$ with $139968$ and $326592$ square- and cube-free in $\mathbb{F}_q$.

But my method is rather brute-force, since I don't really understand the function, and I am also not sure how many different sextic twists sexp256k1 has (up to isomorphism). I think it is two, but I am not sure.

My next question is, if there is a way to calculate the cubic twist with a similar function?