Information

Author(s) Erik-Jan Lingen, Matthias Möller
Deadline Geen deadline
Submission limit No limitation

Sign in

[OpenMP] Solution 6 : Histogram

This material is part of the course Practical Introduction to Parallel Programming and meant for educational purposes only.


Task

Write a program that generates a sequence of random numbers between \(0\) and \(N\) and counts how many times the integer part of that number equals \(0, 1, \dots, N\). This process is known as generating a histogram.

Implement two version, one with atomic the other with critical section, and compare the performance of both implementations for different \(N\) and a large number of sampling points.


Question 1: Histogram
Question 2: OpenMP environment variables

Specify the OpenMP environment variables that should be used for running your program (export OMP_NUM_THREADS=1 ...). Use semicolons to separate multiple variables

Question 3: Command Line Argument

Specify the command line arguments that should be passed to your program when it is run. Arguments must be given in quotes and separated by commas. Leave this filed empty if you do not want to specify command line arguments.

Example: "1","int","arg=2" is interpreted as three arguments 1, int, and arg=2.