Parallel Raytracer Assignment - CSE231 Wiki Parallel Raytracer Assignment From CSE231 Wiki Jump to: navigation, search Contents 1 Code To Investigate 1.1 RayTraceContext 1.2 Scheduler 1.3 Section 2 Code To Implement 2.1 SplitFourWayRayTracer 2.1.1 rayTrace 2.2 LoopRayTracer 2.2.1 constructor 2.2.2 sectionsCreator 2.2.3 rayTrace 2.3 DivideAndConquerRayTracer 2.3.1 constructor 2.3.2 thresholdPredicate 2.3.3 rayTrace 3 Checking Your Solution 3.1 Visualization 3.2 Correctness Code To Investigate RayTraceContext public interface RayTraceContext {
int width();
int height();
void mark(int xMin, int yMin, int xMaxExclusive, int yMaxExclusive);
void markAndRender(int xMin, int yMin, int xMaxExclusive, int yMaxExclusive);
}
Scheduler public interface Scheduler {
void void_fork(Runnable runnable);
}
Section public final class Section {
private final int xMin;
private final int yMin;
private final int xMaxExclusive;
private final int yMaxExclusive;
public Section(int xMin, int yMin, int xMaxExclusive, int yMaxExclusive) {
this.xMin = xMin;
this.yMin = yMin;
this.xMaxExclusive = xMaxExclusive;
this.yMaxExclusive = yMaxExclusive;
}
public int xMin() {
return xMin;
}
public int yMin() {
return yMin;
}
public int xMaxExclusive() {
return xMaxExclusive;
}
public int yMaxExclusive() {
return yMaxExclusive;
}
}
Code To Implement SplitFourWayRayTracer class: SplitFourWayRayTracer.java methods: rayTrace package: raytrace.exercise source folder: src/main/java rayTrace method: public void rayTrace(RayTraceContext context, Scheduler scheduler) (parallel implementation required) LoopRayTracer class: LoopRayTracer.java methods: constructor sectionsCreator rayTrace package: raytrace.exercise source folder: src/main/java constructor method: public LoopRayTracer(Function> sectionsCreator) (sequential implementation only) Hang onto the sectionsCreator in an instance variable. You will need it. Refer to Function Interface documentation if you are unfamiliar with Function. sectionsCreator method: Function> sectionsCreator() (sequential implementation only) Return the sectionsCreator you stored in an instance variable. rayTrace method: public void rayTrace(RayTraceContext context, Scheduler scheduler) (parallel implementation required) Use the sectionsCreator to create a list of Sections. List sections = sectionsCreator.apply(context);
Then create a markAndRender task for each section. DivideAndConquerRayTracer class: DivideAndConquerRayTracer.java methods: constructor thresholdPredicate rayTraceKernel package: raytrace.exercise source folder: src/main/java constructor method: public DivideAndConquerRayTracer(BiPredicate thresholdPredicate) (sequential implementation only) Hang onto the thresholdPredicate in an instance variable. You will need it. thresholdPredicate determines the threshold for division. If thresholdPredicate.test() is true, then the section is still large enough for more division of work. thresholdPredicate method: public BiPredicate thresholdPredicate() (sequential implementation only) Return the thresholdPredicate you stored in an instance variable. rayTrace method: public void rayTrace(RayTraceContext context, Scheduler scheduler) (parallel implementation required) Checking Your Solution Visualization class: RayTracerViz.java VIZ package: raytrace.viz source folder: src/main/java Correctness class: _SequentialRayTracerTestSuite.java package: raytrace.group source folder: src/test/java Retrieved from "https://classes.engineering.wustl.edu/cse231/core/index.php?title=Parallel_Raytracer_Assignment&oldid=3825" Navigation menu Personal tools English Log in Namespaces Page Discussion Variants Views Read View source View history More Search Navigation Main page Recent changes Random page Help General Initial Setup Office Hours Reference Fork Join Rosetta Stone Eclipse Tips Exercises and Warmups * Half & Half Nucleobase Count * Race Condition - Translation DoubleDeltaRange * Powers Of 2 Iterable * Ranges * Coarsening (N-Way Split) Nucleobase Count * Matrix Multiply +++ Matrix Multiply Divide and Conquer * Divide and Conquer Nucleobase Count Comparator Insertion Sort * Merge Sort +++ Merge Sort Parallel Combiner * Floodfill * Fibonacci * Thread and Executor Service * Higher Order Function: Filter * Hashtable * Int Sum MR Apps Card Only Sequential Map Reduce Framework * Reducer Word Count Only Parallel Map Reduce Framework * MutualFriends MR App * Bottleneck MapReduce Framework * Matrix MapReduce Framework * Cholera MR App * Windbag MR App * N-Queens * Sudoku * Centralized Work Queue Raytracer * Image Filters +++ Sudoku Advanced Constraint Propagation +++ Connect Four * Scan * Pack * Quicksort +++ Blelloch Scan * Atomicity Races * All Or Nothing Locks * Ordered Locks String Map K-Mer * K-mer Counting * ConcurrentHashTable * Iterative Averaging Fuzzy Iterative Averaging * Legged Races * Iced Cakes Pipeline Tools What links here Related changes Special pages Printable version Permanent link Page information Cite this page This page was last modified on 29 April 2022, at 13:58. Privacy policy About CSE231 Wiki Disclaimers