CMPUT 481 CMPUT 681 Assignment 1 Shared Memory
There are three parts to this assignment: implementation, experimentation, and exposition.
1. Implement Parallel Sorting by Regular Sampling (PSRS) using C/C++ and shared-memory pthreads (POSIX threads) library on any Linux or
Copyright By PowCoder代写 加微信 powcoder
Unix-based system of your choice.
2. Experiment with the basic algorithm. For example, I recommend that you try sorting an array of integers of at least 32M keys or larger
(possibly much larger, depending on the speed of your cores).
3. Describe your implementations and experiments in a 3-page report (excluding any graphs, diagrams, or source code listings). The goal is
to present a concise, coherent, and insightful description of the lessons learned from your experimentation; do not exceed 3 pages on
the report.
NOTE: Please do not put your code on a public git repository. This assignment is largely the same as the one given to my class in previous
ears. I have complete confidence that you will not seek out a solution from a previous student of the course. Please do not compromise this
learning opportunity (and commit an Academic Offense) by not doing the work by yourself!
Details on Implementation:
Again, you should implement PSRS using shared-memorv othreads.
When debugging your programs, you will likely create a lot of runaway processes. Learn about ps! Be sure to clean up your threads and
processes, since they will interfere with your benchmarking, or interfere with other users (if any).
If you search hard enough, you will likely be able to find existing implementations of PSRS on the Internet. Please do the implementation yourself
in order to get the hands-on experience.
HINT: You may find the pthread setconcurrency () function to be useful to achieve maximum speedup.
HINT: Use command-line arguments to parameterize the number of threads used (e.g., p) and the number of keys to sort (e.g., n). This will
make experimentation much easier.
Details on Experimentation:
1. When testing your code, do not use input files for test data. Instead, randomly generate the data within the program
If you use the same seed value (i.e., srandom ( )) for each run, then random() will deterministically generate the exact same sequence
of pseudo-random numbers. Notice that random () returns a value of type long int. NOTE: Do NOT use srand() and rand). The
range of values generated is considerably lower than from random () and random ().
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com