Consider a unit positive quadrant and use a random number generator to create points [x, y] such that both
x and y are in the range 0 to 1.
Determine whether the random point is within the unit circle x*x + y*y <= 1 and keep a count of the points within this circle.
The ratio of points within to total number of points created in pi/4
The architecture generates a number of instances of a data object that contains a property that indicates the number of iterations to undertaken for that object. These objects are then sent to a Farm where the calculations are undertaken and subsequently collected.
Various versions have been created, first, where each data object is passed to the Collector process with the counts updated
within the object and secondly where a local worker class is used in each of the Workers in the Farm and they record the sums, which
are then passed once to the Collector process for final processing.
Author, Licence and Copyright statement
author Jon Kerridge
School of Computing
Edinburgh Napier University
Merchiston Campus,
Colinton Road
Edinburgh EH10 5DT
Author contact: j.kerridge (at) napier.ac.uk
Copyright Jon Kerridge Edinburgh Napier University *
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Class | Description |
---|---|
MCpiData | MCpiData is the object that is written to the Farm to tell the processes the operation they are to undertake. |
MCpiFeedback | |
MCpiPartData | |
MCpiPartResults | |
MCpiPartWorker | |
MCpiResults | MCpiResults is used to create the final totals of the number of iterations and the number of points within the unit circle. |
RunFeedbackPi | |
RunMCpiDataParallelPattern | |
RunMCpiSplitDataParallelPattern | |
SeqMCpi | |
SeqMCpiUnrolled |