CSE 5441 Programming Assignment 2 – PThreads

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (3 votes)

Assignment Using your implementation of a model scientific computing problem from programming assignment 1, investigate threading this application with posix threads. Part One – Disposable Threads Implement a pthread parallel version of your sequential program using a disposable threads model which meets the following requirements: • create / destroy your threads within the convergence loop, creating new threads for each loop iteration. • implement the number of threads as the third program parameter. Your program should now execute similar to: disposable < infile • Name this program: __disposable.cc (or “.c” if using the C programming language) (for example: jones_jeffrey_disposable.cc < testgrid_400_12206). • In other respects, conform to the requirements for assignment 1. Part Two – Persistent Threads Implement a pthread parallel version of your sequential program using a persistent threads model which meets the following requirements: • Move thread creation outside of the convergence loop, and add a barrier or barriers as necessary within your program to properly synchronize the threads. • Destroy all threads only one time. • Name this program: __persistent.cc (or “.c” if using the C programming language) (for example: jones_jeffrey_persistent.cc < testgrid_400_12206). • Your program should now execute similar to: persistent < infile • In other respects, conform to the requirements for part one above. The Ohio State University CSE 5441 – Dr. J. S. Jones Autumn 2016 Testing and Submission Instructions • Provide a single make file which will build both program versions, naming the executables “disposable” and “persistent”, as appropriate. Your makefile should execute with the command “make,” with no parameters. • Compile your programs, as with assignment 1, with optimizer level3 (-O3) and (-lrt) option. • Instrument your programs as with assignment 1. • Collect timing results for both versions of your program using 2, 4, 8, 16, 24 and 36 threads and test input file testgrid_400_12206, using the values for epsilon and affect _rate you developed in lab 1. • All timing tests should be done on the stdlinux accounts • Other than execution times, your parallel program should achieve the same results (final convergence values, number of iterations required) as your serial program. • Ensure the program can be compiled with “make”, before submitting. • Create a directory “cse5441_lab2”. Within this directory, place: – all program files (.c or .cc files); – makefile – report in .pdf format • If you are in 12:45 session use command: “submit c5441aa lab2 cse5441_lab2” to submit • If you are in 2:20 session use command: “submit c5441ab lab2 cse5441_lab2” to submit • do not include other files (executables, etc), and do not create any sub-directories. • Ensure that your submission files all have group read permissions. Report Requirements • Present your program output and timing results for the testgrid_400_12206 test file from your sequential program as well as both versions of your pthreads parallel program (for all requested numbers of threads). • Summarize timing results, being sure to answer the following questions (at a minimum). – Did this program perform better sequentially or in parallel? – Which number of threads was most effective? – Which parallel version was most effective? – How did your results match or conflict with your expectations? – Were there any unexpected anomalies in the timing information collected? – Which timing methods seem best for parallel programs? How does this compare with your expectations? • If your parallel program produces results which differ from your serial version, point this out and explain. • Submit all reports in .pdf format.