Package org.apfloat.samples
Class PiParallel
- java.lang.Object
-
- org.apfloat.samples.Pi
-
- org.apfloat.samples.PiParallel
-
- Direct Known Subclasses:
PiDistributed
public class PiParallel extends Pi
Calculates pi using multiple threads in parallel.Note that to get any performance gain from running many threads in parallel, the JVM must be executing native threads. If the JVM is running in green threads mode, there is no advantage of having multiple threads, as the JVM will in fact execute just one thread and divide its time to multiple simulated threads.
- Version:
- 1.14.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classPiParallel.ParallelBinarySplittingPiCalculatorParallel version of the binary splitting algorithm.static classPiParallel.ParallelChudnovskyPiCalculatorClass for calculating pi using the parallel Chudnovskys' binary splitting algorithm.static classPiParallel.ParallelRamanujanPiCalculatorClass for calculating pi using the parallel Ramanujan's binary splitting algorithm.protected static classPiParallel.ThreadLimitedOperation<T>Class to execute operations while settingApfloatContext.setNumberOfProcessors(int)to some value.-
Nested classes/interfaces inherited from class org.apfloat.samples.Pi
Pi.AbstractBinarySplittingSeries, Pi.BinarySplittingPiCalculator, Pi.BinarySplittingProgressIndicator, Pi.BinarySplittingSeries, Pi.BorweinPiCalculator, Pi.ChudnovskyBinarySplittingSeries, Pi.ChudnovskyPiCalculator, Pi.GaussLegendrePiCalculator, Pi.RamanujanBinarySplittingSeries, Pi.RamanujanPiCalculator
-
-
Constructor Summary
Constructors Constructor Description PiParallel()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] args)Command-line entry point.
-
-
-
Field Detail
-
DEBUG
private static final boolean DEBUG
- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.io.IOException, ApfloatRuntimeExceptionCommand-line entry point.- Parameters:
args- Command-line parameters.- Throws:
java.io.IOException- In case writing the output fails.ApfloatRuntimeException
-
-