({{, (RefLink[ParallelSum, paclet:ref/ParallelSum])[expr,{i,(Subscript[i, max])}]
evaluates in parallel the sum (∑_(i=1)^(Subscript[i, max]))expr.}, {, (RefLink[ParallelSum, paclet:ref/ParallelSum])[expr,{i,(Subscript[i, min]),(Subscript[i, max])}]
starts with i=(Subscript[i, min]).}, {, (RefLink[ParallelSum, paclet:ref/ParallelSum])[expr,{i,(Subscript[i, min]),(Subscript[i, max]),di}]
uses steps di.}, {, (RefLink[ParallelSum, paclet:ref/ParallelSum])[expr,{i,{(Subscript[i, 1]),(Subscript[i, 2]),…}}] 
uses successive values (Subscript[i, 1]), (Subscript[i, 2]), …..}, {, (RefLink[ParallelSum, paclet:ref/ParallelSum])[expr,{i,(Subscript[i, min]),(Subscript[i, max])},{j,(Subscript[j, min]),(Subscript[j, max])},…]
evaluates in parallel the multiple sum (∑_(i=(Subscript[i, min]))^(Subscript[i, max]))(∑_(j=(Subscript[j, min]))^(Subscript[j, max]))… expr.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[ParallelSum, paclet:ref/ParallelSum]) is a parallel version of (RefLink[Sum, paclet:ref/Sum]), which automatically distributes partial summations among different kernels and processors.

(RefLink[ParallelSum, paclet:ref/ParallelSum]) will give the same results as (RefLink[Sum, paclet:ref/Sum]), except for side effects during the computation.

(RefLink[Parallelize, paclet:ref/Parallelize])[(RefLink[Sum, paclet:ref/Sum])[expr,iter,…]] is equivalent to (RefLink[ParallelSum, paclet:ref/ParallelSum])[expr,iter,…].

If an instance of (RefLink[ParallelSum, paclet:ref/ParallelSum]) cannot be parallelized it is evaluated using (RefLink[Sum, paclet:ref/Sum]).

(RefLink[ParallelSum, paclet:ref/ParallelSum]) takes the same (RefLink[Method, paclet:ref/Method]) option as (RefLink[Parallelize, paclet:ref/Parallelize]).

(RefLink[ParallelSum, paclet:ref/ParallelSum]) takes the same (RefLink[DistributedContexts, paclet:ref/DistributedContexts]) option as (RefLink[ParallelTable, paclet:ref/ParallelTable]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (10)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

ParallelSum[i^2,{i,1000}]

ParallelSum[EulerPhi[i],{i,10^6}]

OpenersExampleSection1(Spacer1)Options  (7)

OpenersExampleSubsection0(Spacer1)Method  (2)

Calculations with vastly differing runtimes should be parallelized as finely as possible:

ParallelSum[N[Fibonacci[i]],{i,1,1000},Method->"FinestGrained"]

A large number of simple calculations should be distributed into as few batches as possible:

ParallelSum[N[i*Pi],{i,10^6},Method->"CoarsestGrained"]

OpenersExampleSubsection1(Spacer1)DistributedContexts  (5)

By default, definitions in the current context are distributed automatically:

remote[x_]:={$KernelID,x^3}

ParallelSum[remote[i],{i,4}]

Do not distribute any definitions of functions:

local[x_]:={$KernelID,x^2}

ParallelSum[local[i],{i,4},DistributedContexts->None]

Distribute definitions for all symbols in all contexts appearing in a parallel computation:

a`f[x_]:={$KernelID,x}

ParallelSum[a`f[i],{i,4},DistributedContexts->Automatic]

Distribute only definitions in the given contexts:

b`g[x_]:={$KernelID,-x}

ParallelSum[b`g[i],{i,4},DistributedContexts->{"a`"}]

Restore the value of the (RefLink[DistributedContexts, paclet:ref/DistributedContexts]) option to its default:

SetOptions[ParallelSum,DistributedContexts:>$DistributedContexts]

OpenersExampleSection2(Spacer1)Possible Issues  (2)

Sums with trivial terms may be slower in parallel than sequentially:

AbsoluteTiming[ParallelSum[N[i],{i,10^6}]]

AbsoluteTiming[Sum[N[i],{i,10^6}]]

Splitting the computation into as few pieces as possible decreases the parallel overhead:

AbsoluteTiming[ParallelSum[N[i],{i,10^6},Method->"CoarsestGrained"]]

(RefLink[Sum, paclet:ref/Sum]) may employ symbolic methods that are faster than an iterative addition of all terms:

AbsoluteTiming[ParallelSum[i,{i,10^7}]]

AbsoluteTiming[Sum[i,{i,10^7}]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Sum, paclet:ref/Sum])  ▪  (RefLink[Parallelize, paclet:ref/Parallelize])  ▪  (RefLink[ParallelTable, paclet:ref/ParallelTable])  ▪  (RefLink[ParallelCombine, paclet:ref/ParallelCombine])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Parallel Computing, paclet:guide/ParallelComputing])}, {▪(RefLinkPlain[Data Parallelism, paclet:guide/DataParallelism])}})}})