# Revision history [back]

### when/how to use parallel?

So I've scouted around some of the questions posed here that involve the terms parallel or the decorator @parallel and I want to know: is there any documentation out there that introduces novices to parallel computing (in sage)?

At present (i.e. with the parallel? documentation being what it is), I don't really know how (or even when) to take advantage of @parallel.

If I have a dual-core CPU, should I be trying to decorate every function with @parallel? Can someone educate this fool?

Thanks,

Steven

### when/how to use parallel?

So I've scouted around some of the questions posed here that involve the terms parallel or the decorator @parallel and I want to know: is there any documentation out there that introduces novices to parallel computing (in sage)?

At present (i.e. with the parallel? documentation being what it is), I don't really know how (or even when) to take advantage of @parallel.

If I have a dual-core CPU, should I be trying to decorate every function with @parallel? Can someone educate this fool?

Thanks,

Steven

## EDIT:

I suppose the best answer here would give an example of situations where @parallel can be of use, and where it cannot. I'm going to throw two examples out there, someone let me know if this is correct. Feel free to add you own, if my examples are two superficial.

1. Computing arc-length of a (smooth) curve defined from $[0,2\pi]$

var('t') def calcArcLength(gamma): speed_gamma = sqrt( sum( [ component.diff(t)^2 for component in gamma ])) return numerical_integral(speed_gamma, 0, 2*pi)

2. Calculating the arc-lengths of a list of smooth curves

@parallel def makeList(length=1): li = [] for i in range(length-1): li.append(generateRandomCurve()) return li

@parallel def processList(list_of_curves): arclength_of_curve = [] for curve in list_of_curves: arclength_of_curve.append(calcArcLength(curve)) return arclength_of_curve

Is it fair to say that @parallel should speed up the time to make and process list_of_curves? Where as it won't speed up the function numerical_integral?

### when/how to use parallel?

So I've scouted around some of the questions posed here that involve the terms parallel or the decorator @parallel and I want to know: is there any documentation out there that introduces novices to parallel computing (in sage)?

At present (i.e. with the parallel? documentation being what it is), I don't really know how (or even when) to take advantage of @parallel.

If I have a dual-core CPU, should I be trying to decorate every function with @parallel? Can someone educate this fool?

Thanks,

Steven

## EDIT:

I suppose the best answer here would give an example of situations where @parallel can be of use, and where it cannot. I'm going to throw two examples out there, someone let me know if this is correct. Feel free to add you own, if my examples are two superficial.

1. Computing arc-length of a (smooth) curve defined fromparametrized by $[0,2\pi]$

$t \in [0,2\pi]$

 var('t')
def calcArcLength(gamma):
speed_gamma = sqrt( sum( [ component.diff(t)^2 for component in gamma ]))
return numerical_integral(speed_gamma, 0, 2*pi) 2*pi)

2. Calculating the arc-lengths of a list of smooth curves

@parallel
def makeList(length=1):
li = []
for i in range(length-1):
li.append(generateRandomCurve())
return li li

@parallel
def processList(list_of_curves):
arclength_of_curve = []
for curve in list_of_curves:
arclength_of_curve.append(calcArcLength(curve))
return arclength_of_curvearclength_of_curve


Is it fair to say that @parallel should speed up the time to make and process list_of_curves? Where as it won't speed up the function numerical_integral?numerical_integral? 2pi)2pi)2*pi)