hw_3

Use breadth first search using example code provided in section to design a queue.

  • Each thread has a maximum chunk size, with chunk calculated based on a heuristic (prevents overdoing omp lock).
  • While private stack length not longer than, use endpoints to determine maximum value g(b)+g(a)+sba2g(b) + g(a) + s\frac{b-a}{2}
    • If not larger than M+εM+\varepsilon add to deletion stack
    • If larger, then divide the interval into two and add it to the continue stack
  • After processing the chunk
    • request deletion stack lock and prepend deletion stack
    • request continuation stack lock and prepend

Useful lemma: Suppose we have a global maximum M1 M_1 . If we wrap each thread's read of this value in an atomic clause, and we have a mutex-protected lock on writing M1=M2M_1=M_2 which ensures monotonicity (prove this in final code) then if we determine that on an interval [ai,bi][a_i, b_i] our function gg cannot be more than M1M_1, then we also know that it cannot be more than any Mi>M1M_i > M_1 determined during processing of the interval [ai,bi][a_i, b_i]. Therefore to keep MM consistent, we start the processing step by reading MM and at the end of this step we can call the thread-safe method to write MM.

Develop library of functions and test heuristics on this library of functions

Parent post: