Package org.apfloat.samples
Class PiDistributed.DistributedBinarySplittingPiCalculator
java.lang.Object
org.apfloat.samples.Pi.BinarySplittingPiCalculator
org.apfloat.samples.PiParallel.ParallelBinarySplittingPiCalculator
org.apfloat.samples.PiDistributed.DistributedBinarySplittingPiCalculator
- All Implemented Interfaces:
Serializable
- Enclosing class:
PiDistributed
protected static class PiDistributed.DistributedBinarySplittingPiCalculator
extends PiParallel.ParallelBinarySplittingPiCalculator
Distributed version of the binary splitting algorithm.
Uses multiple computers to calculate pi in parallel.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a distributed pi calculator with the specified precision and radix. -
Method Summary
Modifier and TypeMethodDescriptiongetNodes()
Get the available set of operation executor nodes.void
r
(long n1, long n2, ApfloatHolder T, ApfloatHolder Q, ApfloatHolder P, ApfloatHolder F, PiDistributed.Node[] nodes) Entry point for the distributed binary splitting algorithm.recombineNodes
(PiDistributed.Node[] nodes, int numberNeeded) Attempt to combine or split nodes to form the needed number of nodes.Methods inherited from class org.apfloat.samples.PiParallel.ParallelBinarySplittingPiCalculator
r
-
Constructor Details
-
DistributedBinarySplittingPiCalculator
Construct a distributed pi calculator with the specified precision and radix.- Parameters:
series
- The binary splitting series to be used.
-
-
Method Details
-
r
public void r(long n1, long n2, ApfloatHolder T, ApfloatHolder Q, ApfloatHolder P, ApfloatHolder F, PiDistributed.Node[] nodes) throws ApfloatRuntimeException Entry point for the distributed binary splitting algorithm.- Parameters:
n1
- Start term.n2
- End term.T
- Algorithm parameter.Q
- Algorithm parameter.P
- Algorithm parameter.F
- Pointer to inverse square root parameter.nodes
- The operation executors to be used for the calculation.- Throws:
ApfloatRuntimeException
-
getNodes
Get the available set of operation executor nodes. This implementation returnsRemoteOperationExecutor
s, which execute operations on the cluster's nodes.- Returns:
- The nodes of the cluster.
-
recombineNodes
Attempt to combine or split nodes to form the needed number of nodes. The returned number of nodes is something between the number of nodes input and the number of nodes requested. The requested number of nodes can be less than or greater than the number of input nodes.- Parameters:
nodes
- The nodes to recombine.numberNeeded
- The requested number of nodes.- Returns:
- The set of recombined nodes.
-