Open main menu

CDOT Wiki β

Changes

SPO600 Algorithm Selection Lab

865 bytes added, 09:50, 27 September 2019
no edit summary
[[Category:SPO600 Labs]]{{Admon/lab|Purpose of this Lab|In this lab, you will investigate the impact of different algorithms which produce the same effect. You will test and select one of three algorithms for adjusting the volume of PCM audio samples based on benchmarking.}}
{{Admon/tip|Non-Decimal Notation|In this lab, the number prefix 0x indicates a hexadecimal number, and 0b indicates a binary number, in harmony with the C language.}}
{{Admon/tip|Time and Memory Usage of a Program|You can get basic timing information for a program by running <code>time ''programName''</code> -- the output will show the total time taken (real), the amount of CPU time used to run the application (user), and the amount of CPU time used by the operating system on behalf of the application (system).
Another version of the <code>time</code> command, located in <code>/bin/time</code>, gives slightly different information, including maximum resident memory usage: <code>/bin/time ''programName''</code>}}
== Lab 4 ==
# Unpack the archive <code>/public/spo600-algorithm-selection-lab.tgz</code>
# Examine the <code>vol1.c</code> source code. This program:
## Creates 5005,000,000 random "sound samples" in an input array (the number of samples is set in the <code>vol.h</code> file).
## Scales those samples by the volume factor 0.75 and stores them in an output array.
## Sums the output array and prints the sum.
# Build and test this file.
#* Does it produce the same output each time?
# Test the performance of this program. '''Adjust the number of samples as necessaryto get measurable results'''.#* How long does it take to run the scaling?#* How much time is spent scaling the sound samples? Be sure to eliminate the time taken for the non-scaling part of the program (e.g., random sample generation).#* '''(How much time is spent scaling the sound sampleswill you do this?)'''#* Do multiple runs take the same time? How much variation do you observe? What is the likely cause of this variation?
#* Is there any difference in the results produced by the various algorithms?