Skip to main content
SciNet
  • Home
  • All Courses
  • Calendar
  • Certificates
  • SciNet
    Main Site Documentation my.SciNet
  • CCDB
  • More
Close
Toggle search input
English
English Français
You are currently using guest access
Log in
SciNet
Home All Courses Calendar Certificates SciNet Collapse Expand
Main Site Documentation my.SciNet
CCDB
Expand all Collapse all
  1. Dashboard
  2. PHY1610 - Winter 2021
  3. 9. Parallelize traffic model using OpenMP

9. Parallelize traffic model using OpenMP

Completion requirements
Opened: Friday, 26 March 2021, 12:00 AM
Due: Friday, 2 April 2021, 11:55 PM

You are going to parallelize the Nagel-Schreckenberg model, which you implemented in the last assignment. For fairness, since the submitted implementations were rather divergent in completeness and approach, for this assignment, start from the reference solution which can be git-cloned on the Teach cluster with

$ git clone /scinet/course/phy1610/traffic
You should note that this is an 'agent-based' implementation, i.e., an implementation that keeps track of the positions and velocities of the N cars as (two) vectors of length N. An alternative representation, the 'grid' representation, which assigns a value to every point on the road of length L (used by some of you in your solution to assignment 8), is here only used in the netcdf output routines.

You will see that the default parameters in params.ini are larger than they were in assignment 8. This makes the simulation take longer and will show the effects of parallization better.

In addition, there's a new parameter per in params.ini, which controls how often output is done. In params.ini, per is set to 100, which means the cars positions and velocities are only output once every 100 time steps.

Your task is as follows:

  1. Speed up this code using shared-memory parallelism, by adding OpenMP directives and thread-safe mechanisms for the pseudo-random number generator as discussed in class. Remember to always use default(none) in pragma omp parallel directives.
  2. You should parallelize as much as possible, but you do not have to parallelize the netcdf output routines.
  3. In addition to parallelizing the code, you should write one or more job scripts that can be submitted to the SLURM scheduler on the Teach cluster, and that would run the applications for values of the number of threads ranging from 1 to 16 and record the timings.
  4. Make a plot of the speedups, and, assuming Amdahl's law holds, try to estimate the serial fraction f by fitting to Amdahl's law.
  5. Write a one-paragraph report on the outcomes of the scaling analysis.

Add the plots and report to the git repo, and submit its git2zip-ed version. Submission deadline is April 2, 2021 at 11:55 PM. The usual penalty for late submissions applies.


  • traffic.zip traffic.zip
    14 August 2023, 4:29 PM
Contact site support
You are currently using guest access (Log in)
Data retention summary


All content on this website is made available under the Creative Commons Attribution 4.0 International licence, with the exception of all videos which are released under the Creative Commons Attribution-NoDerivatives 4.0 International licence.
Powered by Moodle