Title: Acceleration of a MonteCarlo Simulation by parallelisation
1Acceleration of a Monte-Carlo Simulation by
parallelisation
- LPDS SZTAKI HU
- NUCLEAR LAB OF TU BUDAPEST
2THE ORIGINAL PROGRAM
- Objective To simulate the scattering of Gamma
rays on a certain type of detector II(x) - Method Calculate the interactions ( Compton,
photoelectric and pair production effects) along
the traversal of a big number of randomly
generated rays. - Implementation In FORTRAN
3ReStructuring of the original program
- Initialisation Read the physical
parameters Read the number of rays to be
simulated Clear the array representing
the distribution integer
distribution(1024) - Loop over the next free process
Clear the local array of distribution
Loop over the local number of rays
Calculate a random ray. Investigate
the interactions. If the result X is
in the defined normalised range,
book the hit in the sampled range of
the target i 1024 X
localdistribution(i) localdistribution(i)
1 Add localdistribution to distribution - Print the results do i 1, 1024
write() i, distribution(i)
4Restructuring of the original program
- Initialisation Read the physical
parameters Read the number of rays to be
simulated Clear the array representing
the distribution integer
distribution(1024) - Loop over the next free process
Clear the local array of distribution
Loop over the local number of rays
Calculate a random ray. Investigate
the interactions. If the result X is
in the defined normalised range
book the hit in the sampled range of
the target i 1024 X
localdistribution(i) localdistribution(i)
1 Add localdistribution to distribution - Print the results do i 1, 1024
write() i, distribution(i)
MAIN
SLAVE
MAIN
5MAIN
- Read Initialise
- Produce seeds for random generators
- Start Slave processes
- Gather results
SLAVEn
SLAVE1
SLAVE2
- Report ready to run
- Read data from Main
- Execute the loop of calculation
- Submit partial results
- Report ready to run
- Read data from Main
- Execute the loop of calculation
- Submit partial results
- Report ready to run
- Read data from Main
- Execute the loop of calculation
- Submit partial results
6(No Transcript)
7MAIN
8SLAVE
9(No Transcript)
10(No Transcript)
11Slave executes the job, and returns its value
12Slave reports its existence, but there is no new
job to do Main terminates Slavei and waits for
the termination of other active Slaves
13Monitor Full( 100 000 000 rays, 11 processors)
14MONITOR START
15MONITOR MIDDLE
16MONITOR END
17Monitor Full( 100 000 000 rays, 11 processors)
18Monitor Full( 100 000 000 rays, 21 processors)
19Monitor Full( 100 000 000 rays, 41 processors)
20Monitor Full(1000 000 000 rays, 41 processors)
21Monitor Full( 1000 000 000 rays, 81 processors)
22Scalability Timesec/Processes
23Speed
24Histogramm of the result
0
1023
Distribution of hits after 2000 million rounds
25RESUMEE
- 1300 line of original FORTRAN code
- Parallelisation effort 2 work days
- Fairly good, almost linear scalability