Parallelization of Histogram Calculaton using OpenMP

In this assignment, you will calculating an histogram for a given array of numbers and for a given histogram interval. First generate an array of 20,000 integer numbers between 1 and 20 as an input array. Have another array, called the histogram array, whose size will be equal 20/(histogram_interval). For example, if the histogram interval is 4, then the histogram array will be a 5-element array: the count of the input numbers between 1-4 will be stored in histogram_array[0], the count of the input numbers between 5-8 will be stored in histogram_array[1], and so on. Write a sequential program for creating the histogram array.

Parallelize the program using OpenMP where different threads process different elements of the input array. Both the input array and the output histogram array are shared among the threads. An OpenMP thread, when processing an element in the input array, increments the count of the corresponding element in the histogram_array. The main thread finally prints the counts of the histogram array.

Check the correctnesss of your parallel program by comparing the output with that of the sequential program. Show the timings of the sequential and the OpenMP version for different number of OpenMP threads (2, 4, 8, 16, 32) and for histogram intervals, namely, 1, 2, 4, 5 and 10. For each experiment with a fixed number of threads, and for the sequential program, run 5 times, and obtain the average execution time across these 5 runs.

Prepare a report containing: