Alan Kaminsky Department of Computer Science Rochester Institute of Technology 4571 + 2426 = 6997
Home Page

OOPP:
Object Oriented Parallel Programming with Java and M2MI

Prof. Alan Kaminsky
Rochester Institute of Technology -- Department of Computer Science

Many-to-Many Invocation (M2MI)
Particles: An Example Parallel Program
Source Code
Timing Measurements


Many-to-Many Invocation (M2MI)

Publications

Presentations

M2MI Library

Latest release -- 02-Jul-2002

A new release of the M2MI Library, including substantial enhancements and bug fixes for parallel programming, is in preparation and should be released in March 2004.


Particles: An Example Parallel Program

The program simulates a number of charged particles moving in a two-dimensional plane. Each particle experiences a repulsive force from every other particle that is inversely proportional to the square of the distance between the particles. Each particle also experiences an attractive force towards the origin that is directly proportional to the particle's distance from the origin, as though the particle were attached to the origin by an invisible spring.

The program maintains each particle's position and velocity. The program calculates the positions and velocities as a function of time by doing a series of discrete time steps. At each time step, the program calculates the total force on each particle, updates the velocity based on the force, and updates the position based on the velocity:
 
V = V + F Δt
 
P = P + V Δt
 
where F is the vector force on the particle, V is the particle's vector velocity, P is the particle's vector position, and Δt is the time step.


Source Code

The Particles program uses the latest not-yet-released version of the M2MI Library.

Package edu.rit.parallel.particles Package edu.rit.parallel.util
Class Main1
Class Main2
Class Main3
Class ParticleComputation
Class ParticlePanel
Interface DoubleMatrixBackend
Interface DoubleMatrixComputation
Interface Slice
 
Class DoubleMatrix
Class DoubleMatrixSlice
Class Slices


Timing Measurements

The Particles program's running time was measured on the paradise.cs.rit.edu shared memory multiprocessor computer. Three different problem sizes were studied: 100, 400, and 1600 particles. The number of simulated time steps for each problem size was 10000, 1000, and 100, respectively. The average time to perform one time step was measured when the program was run with 1, 2, 3, and 4 parallel processors.

Running Time (msec)
  Processors
Particles 1 2 3 4
100 5.22 3.00 2.59 2.92
400 79.1 39.6 28.2 35.6
1600 1370. 690. 468. 434.
Speedup
  Processors
Particles 1 2 3 4
100 1.00 1.74 2.02 1.78
400 1.00 2.00 2.80 2.22
1600 1.00 1.99 2.94 3.17

Alan Kaminsky Department of Computer Science Rochester Institute of Technology 4571 + 2426 = 6997
Home Page
Copyright © 2004 Alan Kaminsky. All rights reserved. Last updated 10-Feb-2004. Please send comments to ark­@­cs.rit.edu.