Title: 2D Excitable Media Simulations on an MPI Cluster
12D Excitable Media Simulations on an MPI Cluster
- CMPT 495 / 585
- Group 3
- Sajid Gulzar
- Peter Proudfoot
- Andrew Gershman
2Initial Condition
- Initial Condition Initial condition for the
stimulation were produced by using two kinds of
rectangular patches. - Excited
- Refractory
- uv1
V1
U1
-
3Snapshot for Classic IC
4Code for the ClassisIC()
void classicIC() int i,j, Ndat-gtN, Mdat-gtM
Array udat-gtu, vdat-gtv //single classic
spiral (charge 1) for(i0iltN/2i)
for(j0jlt2M/3j) (u)(i,j)1.0
for(i0iltN/2i) for(j0jltM/3j)
(v)(i,j)1.0
5Random Patches
Shift 10 Side 30
6Snapshot for Random Patch
Snapshot with one patch and after 10 sec
7Snapshot for Ten Random Patches
Snapshot with ten patches and after 10 sec
8Snapshot for Ten Random Patches
Snapshot with ten patch and after 1min
9Snapshot for forty Random Patches
Snapshot with forty random patches and after 4
min
10Code for the randomPatches()
void randomPatches() int i,j, Ndat-gtN,
Mdat-gtM Array udat-gtu, vdat-gtv
srand(23) // seeds random number generator with
system time int side 30 int shift 10
for (int pp 0pplt20pp) int myI rand()
((N-side)-shift) int myJ rand()
((M-side)-shift) for(imyIiltmyIsidei)
for(jmyJjltmyJsidej) (u)(i,j)1.0
for(imyIshiftiltmyIsideshifti)
for(jmyJshiftjltmyJsideshiftj)
(v)(i,j)1.0
11Torus
12Boundary Conditions
Periodic (Torus)
No-Flux (Rectangle)
13Logic
- Rectangle
- 4 edges
- No-Flux waves terminate at edges
- Torus
- No edges
- Periodic waves continue to other side of screen
- Left to right, right to left
- Top to bottom, bottom to top
14Implementation (Right and Left)
// right and left Definitions, no-flux boundry
conditions if(lrank!1) leftltorlrank-1
else leftltorcsize if(lrank!csize)
rightltorlrank1 else rightltor1
Step 1 Redefine right and left
// right and left definations, Torus boundry
conditions if(lrank!1) leftltorlrank-1
else leftltorlrank3 if(lrank!csize)
rightltorlrank1 else
rightltorlrank-3
15Implementation (Right and Left)
- Step 2 Always send, always receive
//BOUNDRY CONDITIONS (Torus) //RIGHT SEND
MPI_Send((void)uu-gtGetColumnPtr(L_min_2),
N_plus_1, MPIFPTYPE, right,
11DiscrTime, MPICOMM_WORLD) //LEFT
RECEIVE MPI_Recv((void)uu-gtGetColumnPtr(
0), N_plus_1, MPIFPTYPE, left,
11DiscrTime, MPICOMM_WORLD, status)
//LEFT SEND MPI_Send((void)uu-gtGetColum
nPtr(1), N1, MPIFPTYPE, left,
33DiscrTime, MPICOMM_WORLD) //RIGHT
RECEIVE MPI_Recv((void)uu-gtGetColumnPtr(
L_min_1), N_plus_1, MPIFPTYPE, right,
33DiscrTime, MPICOMM_WORLD,
status)
16Implementation (Top and Bottom)
Step 1 Set u and v of (0,j) (N-1,j), for all j
Step 2 Set u and v of (1,j) (N,j), for all j
(0 , j)
(1 , j)
(N-1 , j)
(N, j)
17Implementation (Top and Bottom)
- //TOPBOTTOM (Torus)
- for(j0jltL_min_1j)
-
- (uu)(0,j) (u)(N-1,j)
- (v)(0,j) (v)(N-1,j)
- (uu)(N,j) (u)(1,j)
- (v)(N,j) (v)(1,j)
-
18Results
Single spiral / torus after 30 secs.
20 random patches / torus after 1 min.
10 random patches / torus after 3 mins.
40 random patches / torus after 3 mins.
19Probe Analysis
20Goal
- Insert a probe into the media, and find the
beat-to-beat time intervals (the time intervals
between consecutive wave fronts). - Extract probe data on test cases involving a
single spiral, multiple random patches, as well
as measuring observed complex dynamics on a torus.
21General Approach
- The beat-to-beat time intervals between wave
fronts were taken by maintaining a counter. - Each time a wave passes, the current value of the
counter is outputted (in model time units ?
counterdt), and reset to 0 for then next
interval timing. - An integer value for keeping track the of the
current wave to hit the probe was also
maintained, for added data clarity in output. - A boolean variable and conditional if statements
were used to control excess output, and maintain
data integrity. - Screen output was made possible by simply using
the C cout statement By default, the output
data was directed from the slave holding the
probe, to the master node.
22Implementation
- int currWave 1 // number of
waves that have passed the probe - int counter 0 // keeps
track of the beat-to-beat time intervals - bool hitByWave false // set if hit by
wave used for output control - // probe sensing work is done here
- if(lrank 3)
? probe sits in slave 3 -
- if((u)(L/2,M/2) lt 0.2 (uu)(L/2,M/2)
lt 0.2) ? waiting for wave front - increment counter
- hitByWave false
- counter
-
-
- if(((u)(L/2,M/2) gt 0.8)
((uu)(L/2,M/2) lt 0.2) !hitByWave)
? wave front hit probe - output beat-to-beat
time for - cout ltlt "Wave " ltlt currWave ltlt " " ltlt
counterdt ltlt endl current wave
reset time interval - counter 0 counter
increment wave count - currWave set
boolean control variable - hitByWave true
23Single Spiral / No Flux
Beat-to-Beat Time Interval
Wave
2410 Random Patches / No Flux
Beat-to-Beat Time Interval
Wave
2540 Random Patches / Torus
Beat-to-Beat Time Interval
Wave
26Difficulties
- The approach to measuring the beat-to-beat
intervals went through roughly three different
refinements, where the end of each refinement
brought to light an approach better than the
previous. - Initially, probe data was gathered in a straight
forward manner. If the current value of u (u)
was detected to be above 0.8, the current
discrete time step would be outputted to the
screen. In this iteration, I also decided to
include a counter to keep track of the current
wave to hit the probe. - In the second refinement, I revamped the
conditional if statement to respond to a window
(threshold) of change in the current value of u.
The window was set to check for a wave front by
detecting a value of (u) between 0.7 and 0.73.
Unfortunately, this method lacks accuracy, and
simply doesnt provide sound output. - In the last refinement, wave front detection via
a u-window was replaced by a coded interval
counter, and boolean control variable. Applying
these variables in cooperation with modification
of the conditional if statements, finally enabled
me to accurately record and output the
beat-to-beat intervals between wave fronts.
27Speedup Graph
? Parallelism yields increasing returns in
speedup, though diminishing returns sets in past
5 CPUs
- Runs were not performed in RI-105, thus there
was some factor of slowdown - due to high communication overhead (network
communication).
? A speedup factor of approximately 2 ½ was
recognized
28Scientific Findings
- Observation of the behavior associated with the
various combinations of scenarios, including runs
involving no-flux boundary conditions, torus
topology, randomly placed patches, and probe
data, might lead one to believe several things - On a domain of size NM, placement of a single
spiral (using the classic initial conditions ?
classicIC()) has a wave period which is fairly
regular a scatter plot of probe data in this
scenario yields a regression which is fairly
linear. - Random placement of several patches in a no-flux
boundary setting made for fairly interesting
spiral interaction, though lacked consistency
with triplet development. This scenario also
produced a set of spiral interactions, which took
longer to stabilize, than if the same setup was
used on a torus topology. - Using a torus topology by far created the most
interesting and varied results Triplets always
developed within the first minute of a run as
well. Initial probe data shows irregular
beat-to-beat intervals, though as the structure
begins to stabilize, the intervals become quite
regular. Structures stabilized sooner than
structures in a no-flux boundary setting.