Complete the onboarding exercise
Work from your copy of the UWHPC onboarding template. Read the problem statement completely before implementing either component.
Requirements
Section titled “Requirements”The checked-in build configuration requires:
- CMake 3.21 or newer
- Ninja
- A compiler with C++17 support
Permitted edit scope
Section titled “Permitted edit scope”Edit one file: src/submission.hpp. Both the Grid class and apply_stencil
go there.
Do not edit the benchmark harness (bench/main.cpp), CMakeLists.txt,
CMakePresets.json, or the GitHub Actions workflow. The evaluator depends on
the supplied interfaces and harness behavior.
Within that file, preserve the required Grid constructor and the mutable and
read-only element-access overloads. The template ships these declarations
without implementations, so the project will not link until you supply them.
The full contract is stated at the top of src/submission.hpp and in the
problem statement.
Configure and build
Section titled “Configure and build”Run these commands from the template repository root:
cmake --preset benchmarkcmake --build --preset benchmarkThe first command configures a Release build with the template’s benchmark
preset. The second builds the supplied benchmark target, which includes your
src/submission.hpp.
Run the correctness test
Section titled “Run the correctness test”ctest --preset benchmark --output-on-failureThis runs the benchmark binary’s --check mode. It steps your implementation
and an independent reference implementation forward in lockstep, then compares
the two final fields cell by cell, over three public cases:
| Case | Grid | Steps | Initial condition |
|---|---|---|---|
public/square-64 | 64 × 64 | 50 | Center block |
public/nonsquare-96x128 | 96 × 128 | 100 | Linear gradient |
public/square-200 | 200 × 200 | 150 | Center block |
A case passes when the largest absolute difference from the reference is at
most 1e-6. Note the non-square case: it will catch a layout that assumes
rows and columns are interchangeable.
The evaluator runs these same public cases plus private cases you cannot see here, so passing locally is necessary but not sufficient. Do not treat a successful compilation as completion.
Run the benchmark
Section titled “Run the benchmark”./build/benchmark/uwhpc_benchmarkWith no arguments, the binary benchmarks a 1024 × 1024 grid over 200 time steps and prints one line of JSON:
{ "runtime_ms": 148.404, "memory_mb": 16.777, "score": 1.293 }score is the harness’s reference time divided by yours, so a higher score is
a faster run. The reference is deliberately naive — treat it as a floor to
clear rather than a design to imitate. Local results vary by machine; the
submitted result is measured on team infrastructure.
Completion checklist
Section titled “Completion checklist”- Only
src/submission.hppwas changed. - The required
Gridinterface is preserved. - Grid values are zero-initialized as required by the problem statement.
- Interior values follow the specified five-point update.
- Boundary values remain unchanged.
- The preset build completes in Release, not Debug.
- All three public correctness cases pass, including the non-square one.
- The benchmark completes and emits its summary.
- You can explain your design decisions in your own words.
Source of truth
Section titled “Source of truth”The file scope, requirements, commands, correctness cases, and benchmark
interpretation come from the
template README,
src/submission.hpp,
bench/main.cpp,
CMakeLists.txt,
and
CMakePresets.json.