Alan Kaminsky Department of Computer Science Rochester Institute of Technology 4486 + 2220 = 6706
Home Page
Parallel Computing II 4003-532-70/4005-736-70 Spring Quarter 2007
Course Page

4003-532/4005-736 Parallel Computing II
Random Walk

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


Random Walk

A three-dimensional random walk is defined as follows. A particle is initially positioned at (0,0,0) in the X-Y-Z coordinate space. The particle does a sequence of N steps. At each step, the particle chooses one of the six directions left, right, ahead, back, up or down at random, then moves one unit in that direction. Specifically, if the particle is at (x,y,z):

  • With probability 1/6 the particle moves left to (x-1,y,z);
  • With probability 1/6 the particle moves right to (x+1,y,z);
  • With probability 1/6 the particle moves back to (x,y-1,z);
  • With probability 1/6 the particle moves ahead to (x,y+1,z);
  • With probability 1/6 the particle moves down to (x,y,z-1);
  • With probability 1/6 the particle moves up to (x,y,z+1).

It's easy to write a sequential program to calculate the particle's final position. The program's command line arguments are the number of steps N and a seed for a pseudorandom number generator. The program prints the particle's final position (x,y,z) as well as the distance of the particle from the origin.

We would like to write a parallel version of the program and get a speedup by running the program on a parallel computer.

Parallel Computing II 4003-532-70/4005-736-70 Spring Quarter 2007
Course Page
Alan Kaminsky Department of Computer Science Rochester Institute of Technology 4486 + 2220 = 6706
Home Page
Copyright © 2007 Alan Kaminsky. All rights reserved. Last updated 18-Mar-2007. Please send comments to ark­@­cs.rit.edu.