CS/EE 217 Final Project: Agentic GPU Performance Optimization

Fall 2026 · Teams of one or two students · Due Wednesday, December 9, 2026, at 11:59 PM

In this project, you will take a working but slow CUDA program and make it as fast as you can without changing its results. Your team should pick one program, profile it to find where the time goes, and then optimize it with the help of a coding agent (e.g., Claude Code or Codex). Every night, we build, check, and time the code of every team on bender.engr.ucr.edu, and we publish a leaderboard per program so that you can follow your progress.

Repository Accept the assignment on Classroom 50
Leaderboard intra.engr.ucr.edu/~dwong/leaderboard.html
Machine bender.engr.ucr.edu (two NVIDIA A30 GPUs)

Please keep the following three rules in mind throughout the project:

  1. Keep the results correct. You should verify your program after every change, because a faster program that fails verification receives no performance credit.
  2. Do not use libraries. You should optimize plain CUDA code that you write yourselves. Do not add libraries, such as cuBLAS or cuDNN, to accelerate these programs (Section 4).
  3. Understand your code. Every team member should be able to explain each optimization in the repository, whether a person or an agent wrote it.

1. Deadline and Deliverables

The project is due: Wednesday, December 9, 2026, at 11:59 PM. To submit, you should push the following four deliverables to the default branch of your team repository.

Deliverable What to submit
Final code The latest commit on the default branch, which must pass verification.
Journal JOURNAL.md, with one entry per attempt (Appendix A).
Report REPORT.pdf (Appendix B). There is no page limit: your report should be long enough to convey everything that you want to say, and no longer. You do not need to add filler.
Presentation PRESENTATION.md, which contains a link to your pre-recorded video of about 10 minutes (Appendix C).

You should push early and often. The leaderboard is updated every night, so it tells you whether your code passes our hidden checks. However, the nightly run can time your program only when a GPU is free. Therefore, we recommend that you have an entry with the status "ok" at least one week before the deadline.

2. The Programs

Your repository contains five programs. All of them are correct, and all of them are deliberately slow. Each team should pick a single program to optimize. You are free to optimize more than one program if you want to; however, we do not expect it, and only one program is graded.

Directory What the program computes
nbody/ A gravitational N-body simulation over a fixed number of time steps.
imgpipe/ An image pipeline: grayscale conversion, blur, edge detection, and histogram equalization on a batch of frames.
spsolve/ A conjugate-gradient solver for a large sparse linear system with several right-hand sides.
graph/ Breadth-first search from several sources on a large graph.
cnn/ Inference with a small convolutional neural network on a batch of images.

To declare your choice, you should write the name of one directory into the file CODEBASE at the top of the repository. If you optimize more than one program, write one name per line, and your team will appear on the leaderboard of each program that you list. We recommend that you build and profile several programs before you decide, since the program that looks easiest is not always the one that you will enjoy optimizing. You can change your choice later; however, a late change leaves little time for optimization.

3. Getting Started

  1. Accept the Classroom 50 assignment. A team has one or two members. In a team of two, one member creates the team, and the other member joins it.
  2. Clone your team repository on Bender. You can then build and check a program as follows:

    cd nbody            # or another program
    make                # builds ./bench and ./verify
    ./bench <options> --output out.bin      # prints TIME_MS: <milliseconds>
    ./verify out.bin tests/<golden file>    # exits with 0 if the result is correct

    The README.md of each program lists the exact options.

  3. Once you have decided, set CODEBASE to your choice (one name per line if you list more than one program), commit, and push.
  4. Profile the program before you change it. You should use Nsight Compute (ncu), which reports the details of each kernel (e.g., its memory throughput and occupancy). These details can guide your agent better than run times alone. Working on Bender. The two GPUs are shared with your classmates and with other users, and Bender has no job scheduler. Before a measurement, you should check nvidia-smi and select a free GPU with CUDA_VISIBLE_DEVICES. Please do not leave long jobs running. A measured run time can be off by 2x when another job uses the same GPU. Therefore, you should repeat each measurement and use the median.

Building. You should always build through the provided Makefile, which adds the option -arch=sm_80. A program that is built without this option fails to start. This is because the CUDA toolkit on Bender is newer than its driver.

4. Rules

What you may change. Everything inside the src/ directory of your program is yours: you may edit, add, or rewrite files there, and you may set compile options in src/flags.mk. You should not edit the harness/ directory or the Makefile. The nightly run replaces them with our copies, so your changes to them have no effect.

Correctness. Each program has a verifier, and the README.md of the program states its rule (a tolerance or an exact match). You should make your program correct for any input, and not only for the public test case. This is because the nightly run uses hidden inputs with different seeds and sizes.

No libraries: optimize the CUDA code yourselves. The purpose of this project is for you to learn how to optimize CUDA code, and not how to call an optimized library. Therefore, you should write every kernel that performs the computation (e.g., the convolution, the sparse matrix-vector product, or the graph traversal) yourselves in plain CUDA. Do not add a library that does this work for you, even where a library is the usual choice in practice.

Not permitted Permitted
Any GPU or numerical library, whether it is linked, included as headers, or copied into src/. Examples: cuDNN, TensorRT, cuBLAS, cuSOLVER, cuSPARSE, cuGraph, Gunrock, NPP, cuFFT, Thrust, CUB. The CUDA runtime, the headers of CUDA itself (libcu++, cooperative groups, <cuda_fp16.h>, <mma.h>), NVTX, the C and C++ standard library, and OpenMP on the host.

If something is not named as permitted, you should assume that it is not permitted, and you can find the complete list in the README.md at the top of the repository. The nightly run checks this rule: a program that violates it receives the status "disallowed library" and is not ranked. Note that a coding agent may introduce a library without being asked when it is told to make a program faster. Therefore, you should state this rule in your agent instruction file (Section 5).

Academic integrity. You are welcome to discuss general ideas with other teams; however, you should not share code with them. You may use outside material (e.g., a paper or a public repository) if you cite it in the journal and the report.

5. Required Workflow

A large part of this project is learning how to work with a coding agent in a disciplined way. Therefore, we require and grade the following five practices.

  1. Verification first. Before your first optimization, you should write a script (or a make target) that builds, runs, and verifies the program. Every change should pass this script before you commit it, and you should instruct your agent to run the script after every change.
  2. Agent instruction file. You should keep a CLAUDE.md or AGENTS.md file in the repository. This file tells the agent how to build, measure, verify, and profile the program, and which rules apply. Update it as you learn what the agent needs to be told.
  3. Profile before you change. You should start each optimization from evidence (a profile or a timing breakdown) that shows where the time goes. A change that is made without evidence is a guess, even when it happens to work.
  4. One optimization per commit. Each commit should contain one change, and its message should state the measured effect. This practice lets you undo a change that turns out to be wrong.
  5. Journal. You should record every attempt in JOURNAL.md (Appendix A), including the attempts that failed. Do not hide your failures: a failed attempt that is well analyzed earns the same credit as a successful one.

6. The Leaderboard

For each team, the nightly run takes the latest commit on the default branch and restores our copies of the staff files. It then (1) checks the library rule, (2) builds the program, (3) verifies it on the hidden inputs, and (4) times it on a GPU that no other job is using. The score is the speedup, which is the run time of the original program divided by the run time of your program.

Status Meaning
ok The program was built, verified, and timed.
build failed The program did not compile with our Makefile.
incorrect The result failed verification on a hidden input.
timed out The program did not finish within the time limit.
disallowed library The program violated the library rule.
not measured No GPU was free. The nightly run tries again the next night.

If your latest commit fails, your last valid result stays on the leaderboard, and the failure is shown next to it. You should therefore read the status of your entry after each night and fix a failure promptly. The final standing uses the latest commit at the deadline.

7. Grading

Component Weight What we assess
Correctness 10% The final commit passes verification on the hidden inputs. If it fails, you earn neither this credit nor the performance credit.
Performance 20% The speedup that the nightly run measures, relative to the speedup of our reference solution for the same program (see below).
Journal and profiling evidence 20% Whether each change follows from evidence, whether the measurements are sound, and whether failed attempts are analyzed.
Final report 25% The correctness of the explanations, and the quality of the results and figures.
Presentation 15% How clearly the video explains your agentic workflow, your analysis of the program, and one or two of your optimizations.
Agent workflow and reflection 10% The verification script, the agent instruction file, the commit history, and the reflection on working with the agent.

Performance relative to our reference. We grade performance by comparing your speedup with the speedup of our own reference solution for the same program. We do not publish the reference speedups. A team that matches or exceeds the reference earns full credit, and a program that is no faster than the original earns none. Your credit therefore depends only on your own result, and the results of other teams cannot lower it. Each program has its own reference speedup, because the programs differ in how much they can be improved. You should still follow the leaderboard, since it shows how far other teams have come on the same program.

More than one program. If you list more than one program in CODEBASE, you should name the single program that we grade at the top of your report. The performance credit, the journal, the report, and the presentation are then assessed for this program only. Your results on the other programs still appear on their leaderboards, but they do not change your grade.

Teams of one and two are graded in the same way, however teams of two are expected to have more rounds of optimization or depth of optimization techniques. In either case, your journal should contain at least four substantive entries.

Excellent work. To earn full credit for the written and presented components, you should aim for the following four qualities.

  • Journal: Every change is motivated by a profile, is measured with repeated runs, and is explained in terms of the hardware.
  • Report: The explanations are correct and specific, the figures support the claims, and the limits of the measurements are stated.
  • Presentation: A classmate who has not seen your code can follow why each highlighted optimization works and how it benefits the program.
  • Agent workflow: The agent had a working verify-and-measure loop. The reflection describes specific cases in which the agent was wrong, and how you detected each case.

In contrast, you should avoid changes that appear without evidence, measurements that are single runs, a history that consists of a few large commits, and code that your team cannot explain.

Appendix A: Journal Entry Template

## Entry N: <short title>   (date, authors, commit hash)

**Evidence.** What did the profile or timing show? (Tool, command, numbers.)
**Hypothesis.** What is the cause, and what improvement do we expect?
**Change.** What was changed, and who proposed it (a team member or the agent)?
**Result.** Median time before and after. Did the verifier pass?
**Explanation.** Why did the result match or contradict the hypothesis?
**Agent notes.** What did the agent do well or badly, and how was its output verified?

Appendix B: Report Outline

  1. Summary. The program to be graded, the final speedup, and the three changes that mattered most.
  2. Initial profile. Where the original program spent its time, with evidence.
  3. Optimizations. For each major change: the evidence, the change, the measured effect, and the explanation. Include a figure of the cumulative speedup.
  4. What did not work. At least two attempts that failed, and the reason.
  5. Verification. How correctness was protected, and any error that the verification caught.
  6. Working with a coding agent. How the agent was instructed and supervised, specific cases in which it was wrong, and what you would do differently.
  7. Contributions. A table that states the share of each team member in every major task, as in the following example. A team of one may omit this table.

    Task Breakdown
    Profiling and analysis Tommy Trojan - 60%, Joe Bruin - 40%
    Implementation of Optimization 1 Tommy Trojan - 100%, Joe Bruin - 0%
    Implementation of Optimization 2 Tommy Trojan - 20%, Joe Bruin - 80%
    Journal Tommy Trojan - 50%, Joe Bruin - 50%
    Project Report Tommy Trojan - 50%, Joe Bruin - 50%

Appendix C: Presentation

You should record a presentation of your project and submit it as a video. The video should be about 10 minutes long. This length is not a hard requirement, so you do not need to make the video longer if you have covered everything.

Your presentation should cover the following three points:

  1. Agentic workflow. How you instructed and supervised the coding agent, and how you verified its work.
  2. Analysis. What the workload does, where its bottlenecks were, and which optimization approaches you considered.
  3. One or two optimizations. For each optimization that you highlight, you should explain how and why it works, and how it benefits the workload.

To submit, you should upload the video to a service that we can open with a link (e.g., YuJa, Google Drive, or an unlisted YouTube video), and write the link into PRESENTATION.md at the top of your repository. Please check that the link opens without your own login before the deadline.