AMSC 662 / CMSC 662 Fall 2013

Frequently Asked Questions for Homework 4

Question: 10/08/13 When should I start this homework?

Answer: October 8. Seriously, like Homework 3, this is not a good one to leave to the last minute. The next homework will be easier.

Hint: 10/09/13 How do we make sure we don't have a race condition when enqueuing multiple messages?

In particular, I want to make sure that if a thread wants to enqueue the 4 messages (6, a, c), (7, fa, f(c)), (8, c, b), (9, f(c), fb), then the 4 messages should appear consecutively on the message queue for thread 0. This way the code for thread 0 is much easier to write.

Answer: OpenMP "queue locks" can be used to make sure only one thread has access to a queue at a time. See the main() function from queue_lk.c for examples on how to lock and unlock the queues with OpenMP.

Question: 10/16/13 How should I submit my homework?

Answer: Send email to Tyler with four attachments:

  • mpAllSolve.c,
  • queue_lk.c (with your modifications clearly documented and the original author clearly credited),
  • queue_lk.h
  • Your discussion in either a .txt file or a .pdf file.
  • Question: 10/21/13 For number 2(b), we're supposed to run our code on f(x) = sin(5x), on interval [0.1, 3.3], what should we use as tolerance? And should we use 1 for L?

    Answer: Use tol = 1.e-3.

    L is an upper bound on the abs. val of the derivative of f(x) on the interval. 1 would be incorrect. Use L = max |f'(x)| over the interval 0 <= x <= pi.