Random values of x can be used to compute an approximation of a definite integral according to the following formula.
This procedure efficiently calculates a one-variable integral using the above formula where r is a random input to .
A sample run using 1000 data points shows how this works:
This can be computed exactly in Maple to show the above approximation is rough, but close enough for some applications.
A parallel implementation adds the following code to split the problem over all available nodes and send the partial results back to node 0. Note that here the head node, 0, performs the calculation and then accumulates the results from the other nodes.
Integrate over the range, lim, using N samples. Use as many nodes as are available in your cluster.
Note: In the following command, replace "MyGridServer" with the name of the head node of your Grid Cluster.
Execution times are summarized as follows. Computations were executed on a 3-blade cluster with 6 quad-core AMD Opteron 2378/2.4GHz processors and 8GB of memory per pair of CPUs, running Windows HPC Server 2008.
Number of Compute Nodes
|
Real Time to Compute Solution
|
Performance
|
1 (using serialized code)
|
356.25 s
|
The speedup is a measure of
where is the execution time of the sequential algorithm and is the execution time of the parallel algorithm using p processes.
|
1 (using Grid)
|
|
2
|
|
3
|
|
|
|
|
|
|
|
7
|
|
|
|
9
|
|
|
|
|
|
12
|
|
13
|
|
14
|
24.90
|
15
|
23.38
|
16
|
21.93
|
17
|
20.92
|
|
|
19
|
18.41
|
20
|
17.85
|
21
|
16.71
|
|
|
23
|
|
|
|
The compute time in Maple without using MapleGrid is the first number in the table -- ~6 minutes. The rest of the times were using MapleGrid with a varying number of cores. The graph shows that adding cores scales linearly. When 23 cores are dedicated to the same example, it takes only 15.3 seconds to complete.