Engineering Lab

UCT CSC2002 / 2023

Searching terrain in parallel

Split random terrain searches into fork/join tasks and reduce local minima into a shared result.

JavaForkJoinPoolRecursiveTaskMonte Carlo

UCT / COURSE CONTEXT / 2023

CSC2002S · Computer Science 2002

Concurrent programming, computer architecture and interface design, with Java and assembler practicals.

Science handbook · 2023
SEQUENTIALPARTITION / WORK / REDUCE

Conceptual task lanes based on fork/join terrain search. Equal-length blocks are explanatory, not measured runtimes or a promised speedup. Shared visited-state contention and unseeded historical inputs limit direct comparisons.

ENGINEERING PERSPECTIVE

Inside the work

Explore when splitting independent searches is worth the overhead of parallel tasks. The terrain problem makes task granularity, result reduction and shared-state correctness tangible.

Java ForkJoinPool / RecursiveTask
Fork a left task, compute the right, join and reduce local minima.
Terrain/search framework
Supplied serial search and terrain/cache code support the individual parallel extension.
STEP 1 / 3

Partition searches

Halve the work array above the cutoff; execute smaller leaves sequentially.

Source-derived walkthrough

How it works

RecursiveTask divides the search array at its midpoint, forks the left half, computes the right and joins the two minima. A sequential cutoff of 1,000 bounds task overhead. Searches access a shared terrain cache and visitation state.

Results & recovery

  • Serial and parallel programs compiled and completed a 100x100, density-0.2 smoke workload.
  • Both fresh runs reported minimum -44841. Different random searches and visited counts make their 12 ms / 10 ms timings unsuitable as a speedup claim.

Technical limitations

A matching minimum in one random run is not proof of equivalence. Original benchmark tables are retained privately; shared-state races, workload variation and timing boundaries require review.

What I would improve now

Use identical seeded starting points, establish cache/visitation safety, warm up the JVM and repeat controlled measurements.

NEXT IN THE ARCHIVEFrom virtual address to physical frame