The purpose of this lab is to implement an efficient histogramming algorithm for an input array of integers within a given range. Each integer will map into a single bin, so the values will range from 0 to (NUM_BINS - 1). The histogram bins will use unsigned 32-bit counters that must be saturated at 127 (i.e. no roll back to 0 allowed). The input length can be assumed to be less than 2^32. NUM_BINS is fixed at 4096 for this lab.
This can be split into two kernels: one that does a histogram without saturation, and a final kernel that cleans up the bins if they are too large. These two stages can also be combined into a single kernel.
Before starting this lab, make sure that:
Edit the code in the code tab to perform the following:
Instructions about where to place each part of the code is demarcated
by the //@@
comment lines.
The most recent version of source code for this lab along with the build-scripts can be found on the Bitbucket repository. A description on how to use the CMake tool in along with how to build the labs for local development found in the README document in the root of the repository.
The executable generated as a result of compiling the lab can be run using the following command:
./Histogram_Template -e <expected.raw> \
-i <input.raw> -o <output.raw> -t integral_vector
where <expected.raw>
is the expected output,
<input.raw>
is the input dataset, and
<output.raw>
is an optional path to store the
results. The datasets can be generated using the dataset generator built
as part of the compilation process.