ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 13 Jun 2018 13:47:04 +0200@parallel Parallel Pollard-Rhohttps://ask.sagemath.org/question/42582/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!SoftyWed, 13 Jun 2018 13:47:04 +0200https://ask.sagemath.org/question/42582/@Parallel - how to use all CPUshttps://ask.sagemath.org/question/42439/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')<br/>
>sage: Parallelism() # random (depends on the computer)
I get back:
> Number of processes for parallelization:<br/>
> - 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? SoftySat, 26 May 2018 01:39:46 +0200https://ask.sagemath.org/question/42439/Modifying ncpus.py to detect processors on computational nodeshttps://ask.sagemath.org/question/8746/modifying-ncpuspy-to-detect-processors-on-computational-nodes/Recently we've been attempting to run Sage on a LittleFe cluster (littlefe.net if you're interested to read more), however, the ncpus function reads directly from system settings, thus it only reads the two slots on the head node of the cluster. In order to run other jobs outside of Sage using OpenMPI, we are able to input a machine file generated by a BCCD specific command as an argument for OpenMPI to detect and use the slots on the other nodes. I'm wondering if there is a way to either modify the existing check or if there is another way to detect the slots on the other nodes to fully utilize Sage's parallel capabilities.Evan F.Mon, 27 Feb 2012 14:30:13 +0100https://ask.sagemath.org/question/8746/Building Sage on the LittleFe Clusterhttps://ask.sagemath.org/question/8704/building-sage-on-the-littlefe-cluster/I've built Sage on the LittleFe teaching cluster, made of six Intel Atoms in a case I can carry from class to class (littlefe.net, if you're interested).
Sage works just fine on the head node, but won't detect the other nodes.
I ran import sage.parallel.ncpus and sage.parallel.ncpus.ncpus(), and just get 2, not the expected 12.
I tried putting "-machinefile ~/machines" into the argument of sage.parallel.ncpus.ncpus(), which is what I do with mpirun, but just got errors.
Suggestions?
Thanks,
Brad Brad BurkmanThu, 09 Feb 2012 13:10:05 +0100https://ask.sagemath.org/question/8704/