Skip to content

Complete the onboarding exercise

Work from your copy of the UWHPC onboarding template. Read the problem statement completely before implementing either component.

The checked-in build configuration requires:

  • CMake 3.21 or newer
  • Ninja
  • A compiler with C++17 support

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.

Run these commands from the template repository root:

Terminal window
cmake --preset benchmark
cmake --build --preset benchmark

The 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.

Terminal window
ctest --preset benchmark --output-on-failure

This 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:

CaseGridStepsInitial condition
public/square-6464 × 6450Center block
public/nonsquare-96x12896 × 128100Linear gradient
public/square-200200 × 200150Center 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.

Terminal window
./build/benchmark/uwhpc_benchmark

With 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.

  • Only src/submission.hpp was changed.
  • The required Grid interface 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.

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.