Seminar 2: Efficient Algorithms for Molecular Dynamics Simulations and Other Dynamic Spatial Join Queries - PowerPoint PPT Presentation

About This Presentation
Title:

Seminar 2: Efficient Algorithms for Molecular Dynamics Simulations and Other Dynamic Spatial Join Queries

Description:

Seminar 2: Efficient Algorithms for Molecular Dynamics Simulations and Other Dynamic Spatial Join Queries Andrew Noske Thesis & code is available at: – PowerPoint PPT presentation

Number of Views:113
Avg rating:3.0/5.0
Slides: 57
Provided by: AndrewN151
Category:

less

Transcript and Presenter's Notes

Title: Seminar 2: Efficient Algorithms for Molecular Dynamics Simulations and Other Dynamic Spatial Join Queries


1
Seminar 2Efficient Algorithms for Molecular
Dynamics Simulations and Other Dynamic Spatial
Join Queries
  • Andrew Noske

Thesis code is available at gtgt
http//manning.it.jcu.edu.au/jc130551/thesis/ ltlt
2
About the Project
  • Build an engine layer for particle simulations
    part of TOMSK (Towards Molecular Structure
    Kinetics) Project
  • Molecular Dynamics (MD) integrates equations of
    motion of atoms each timestep.
  • Cannot predict precisely what will happen
    generates statistical prediction

3
Definitions
Single Range Query
  • Range Query Find all points (neighbour atoms)
    within cutoff radius of each other
  • Self-spatial join query Execute range query for
    all points (to determine complete list of
    neighbour atoms)

Ignore
Cutoff radius (Rc)
Spatial join query
4
Methods Used in Testing
  • Lennard-JonesPotential Pair
  • I have used this to simulateatoms in a stable
    liquid.
  • NOTE Final code allows you to extend system
    class implement any interaction model
    statistical analysis functions you choose.

5
Methods Used in Testing
  • To simulate bulk liquidHave used Periodic
    Bounding Condition ? (boundaries wrap around)

Surface particle have less neighbours
Range search on box with PBC
Microscopic droplet (finite particles)
PBC on 2D box
6
Spatial Data Structure Fixed Grid
  • Fixed grid
  • Most effective for uniform particle distribution.
  • Time to build (placeall pointsinto index)
    O(N)

Fixed grid
NOTE cells per side (CPS)5
boxLen
Cutoff radius (rc)
Original cell list technique
cellLen
7
Simulation Steps
  • Set-up
  • 1) Setup grid structure
  • 2) Setup atoms in offset lattice
  • 3) Assign random velocities.
  • Iterate
  • 1) Build grid (assign all atoms to cells).
  • 2) Build neighbor list (for each atom in each
    cell find neighbors). ? take up to 95 of time
  • 3) Calculate force and move atoms ? implements
    interaction model (can change).
  • 4) Wrap atoms back into cell boundaries.
  • 5) Increment timestep.

8
Scientific Process
  • Used MS Visual C console application.
  • Testing process
  • Run a series of simulations in batch
  • Output results to CSV including
  • grid parameters,
  • clock tics elapsed, ? main focus
  • distance calculates,
  • more
  • Analyze/graph CSV using Excel.
  • Was time consuming! ?

9
Atom List vs. Cell List
Cell list approach Predetermine which cells are
within rc of each cell
Atom list approach For each atom check which
cells are within rc of atom
Original (cubic) cell list
Minimum cell list
Cubic atom list
  • NOTE Volume sphere 52 of its bounding cube

10
Loaded vs. Unloaded Cell List
(?3 min)
(?2 mins)
(?1 min)
11
Half-Range Search Technique
Normal approach Search sphere
Faster approach Search upper hemi-sphere
i
HALF minimum cell list
minimum cell list
j
Range search
i
HALF-range search
j
12
Size of Various Cell Lists
13
Size of Various Cell Lists
14
Half-Range Search Technique
15
Half-Range Search Technique
16
Atom List vs. Cell Lists
17
Improving Cache Hits through Spatial Locality
  • Spatial locality principle objects close to
    referred ones are more likely to be requested in
    the future.
  • Unsorted atoms ? many cache misses.
  • Space-filling curve A line passing through every
    point in grid, in some order.

4
5
2
3
6
1
Z-ordering
Row-wise
Hilbert curve
Gray curve
18
Improving Spatial Locality with Space-Filling
Curve
  • Improvements for small number of atoms were crap.
  • However improvements for 200,000 atoms were
    significant ? virtual paging

Less than 3 performance improvements ?
19
Finding Optimal Cells Per Side
for a cell list
20
Finding Optimal Cells Per Side
21
Finding Optimal Cells Per Side
EXTRA SLIDE
22
Verlet Neighbour List Technique
  • Choose a verlet radius greater than rc.
  • Build the verlet neighbor list using verlet
    radius (use the fixed grid)
  • Next few iterations update list by recalculating
    distances flag neighbour pairs inside rc.

23
Verlet Neighbour List
24
Verlet Neighbour List
25
Finding Optimal Verlet Radius
26
Selective Checking of Verlet List Using Atom
Displacement
  • Dont update distances between verlet neighbours
    outside cut-off radius each iteration calculate
    safeDistance for these neighbours decrement
    that by the displacement of both atoms each
    iteration.

27
Selective Checking of Verlet List Using Atom
Displacement
28
Summary of Results Contribution
  • Results for proposed techniques
  • Minimum cell list ? better than traditional cell
    list (?)
  • Half-range search ? great results! (????)
  • Using MBRs in cells ? not effective for evenly
    spread particles, but has potential for skewed
    data sets
  • Sub-grid cell list template guide ? refines of
    cells in loaded cell list you must check for each
    atom results successful, but only when avg.
    of atoms per cell were high.
  • Early elimination of non-neighbours ? good idea,
    yet made performance worse (?).
  • Selective checking of verlet list using atom
    displacement ? makes verlet list cheaper to
    update (especially if verlet radius big) (???)

Interesting ideas results, but insufficient
time to cover here
29
Summary of Results Contribution
  • Other findings
  • Space-filling curves ? if simulation fits in
    memory gives negligible improvement, if not curve
    can up-to double performance! Hilbert curve
    best curve. (?)
  • Argued half-cubic atom list best choice (most
    dynamic)
  • Investigated optimal of cells per side verlet
    radius
  • Proposed algorithms to find optimal values above
    worked quite well (??)
  • Investigated performance vs. accuracy
    relationship for MD simulation
  • Thesis code is guideline to implementing/optimiz
    ing spatial join simulations

Interesting results, but insufficient time to
cover
30
Future Work
  • Much opportunity to further investigate
    optimization techniques including those proposed.
  • Some suggestions
  • Test techniques for much larger simulations
    (cant in memory).
  • Investigate other optimal value finding
    algorithms find optimal verlet radius cells
    per side simultaneously!
  • Try different compilers/languages platforms.
  • Test techniques for skewed data sets.
  • and many more little technical suggestions
    more intelligent ways to decide which cells to
    check.
  • Work may be carried out by future TOMSK students.

31
DEMONSTRATION OF CODE
gtgt http//manning.it.jcu.edu.au/jc130551/thesis/
ltlt
32
QUESTION TIME
gtgt http//manning.it.jcu.edu.au/jc130551/thesis/
ltlt
33
QUESTION TIME
Dont tell anyone, but I fell asleep after the
first slide
QUESTION TIME OVER
Thank you for listening,and thanks again to
those who helped with my thesis. ?
gtgt http//manning.it.jcu.edu.au/jc130551/thesis/
ltlt
34
(No Transcript)
35
THESIS first half
  • Im not going to the next slide until everyone
    has finished reading up to here

36
OTHER TECHNIQUES
37
Sub-Grid Cell List Template Guide
  • Sub-grid break each cell into (imaginary)
    sub-grid.
  • When considering an atom, check with sub-cell it
    belongs to, that sub-cell will refine which cells
    in the cell list to search.

Minimum cell list representation
(-1,1), (0,1), (1,1), (-1,0), (0,0), (1,0),
Corresponding cell list template guide (for this
sub-cell only)
(false), (false), (false), (true), (true),
(false)
38
Sub-Grid Cell List Template Guide
39
Sub-Grid Cell List Template Guide
40
Sub-Grid Cell List Template Guide
41
Use of MBRs in Cells
  • For each cell, maintain a Minimum Bounding
    Rectangle (MBR) around its atoms.
  • For any cell JUST tipped by rc, check atom is
    inside rc of MBR before considering atoms
    exhaustively.

This cell is just tipped, but MBR is out of range
MBR
42
Use of MBRs in Cells
43
Early Elimination Technique
EXTRA SLIDE
  • Early elimination if distancebetween atoms along
    anydimension gt cutoffRadius.
  • Dont calculate sqrt
  • Lennard-Jones can be doneusing dist2
  • NOTE if (dist2 lt cutoffRadius2)
    ? is in range
  • Determine optimal of cells per size.
  • Is cell length cutoff radius optimal?

j
i
44
Early Elimination Technique
EXTRA SLIDE
45
ADDITIONAL RESULTS
46
Linear Growth
EXTRA SLIDE
47
Linear Growth
EXTRA SLIDE
  • O(N) ? where N is number of neighbors

48
Performance vs. Accuracy
  • Some techniques that will improve performance,
    but decrease accuracy
  • Increasing timestep
  • Decreasing cutoff radius
  • I collected results for these by comparing all
    simulations with control simulations

small timestep
larger timestep
large rc
smaller rc
49
Optimal choice of cell length
EXTRA SLIDE
50
Average Atoms per Cell
EXTRA SLIDE
51
Performance Breakdown
EXTRA SLIDE
52
(No Transcript)
53
Adjacency List Savings
EXTRA SLIDE
54
Chosen Solution
Single Range Query
  • Chosen approach chose cutoff radius, and ignore
    particles beyond this.
  • Involves moving self-spatial join query (many
    range queries) ? has numerous applications
  • GIS, Computer graphics, etc.

Ignore
Cutoff radius (Rc)
Spatial join query
Symmetrical attractive/ repulsive forces
O--
NOTEDirection forces!

H

H
Permanent dipole
Argon atom (inert)
Water molecule




55
Improving Cache Hits through Spatial Locality
  • Spatial locality principle objects close to
    referred ones will probably be requested again in
    the future.
  • Unsorted atoms ? means many cache misses.

4
5
2
3
6
1
56
Space Filling Curves
  • Space-filling curve A line passing through every
    point in a space, in some order (according to
    some algorithm).
  • Resort atom periodically (group by cells order
    using curve).
  • Improves CPU performance gt50 in 2D moving point
    query ? worth trying.

Z-ordering
Row-wise
Hilbert curve
Gray curve
Write a Comment
User Comments (0)
About PowerShow.com