GPU computing assignments and projects for graduate students. The repository uses CMake to build CUDA examples, standalone assignments, and a reusable set of CPU, GPU, and OpenGL support modules.
.
├── base/ Shared CPU, GPU, and graphics modules
├── examples/ Standalone CUDA examples
├── projects/ Course assignments and larger projects
└── cmake/ Submission-package helpers
The base/ directory is intentionally not a standalone CMake target. Each
project lists the shared files it uses in its own CMakeLists.txt, so
dependencies remain explicit and submission packages can include only the
required files.
- CMake 3.25 or newer
- A C++20 compiler
- CUDA Toolkit with
nvccand the CUDA runtime development files - A CUDA-capable GPU and a compatible driver for running CUDA targets
- vcpkg, or equivalent pre-installed packages, when building targets that use third-party libraries
The recommended setup is to clone vcpkg into the repository root:
git clone https://github.com/microsoft/vcpkg.git vcpkgBootstrap vcpkg once:
# Windows PowerShell
.\vcpkg\bootstrap-vcpkg.bat
# Linux/macOS
./vcpkg/bootstrap-vcpkg.shThen edit CMakeUserPresets.json.example. Replace each
$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake with
${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake, and copy the result to
CMakeUserPresets.json:
cp CMakeUserPresets.json.example CMakeUserPresets.jsonChoose a *-vcpkg configure/build preset afterwards. CMake uses the
repository's vcpkg.json in manifest mode and installs the declared packages
automatically for the selected triplet.
The committed CMakePresets.json contains provider-neutral presets for Visual
Studio, GCC, and Clang. After following the vcpkg setup above, use one of the
*-vcpkg presets.
On Windows, the recommended workflow is to open the repository directory
directly in Visual Studio. In the CMake configuration selector, choose either
windows-vs-debug-vcpkg or windows-vs-release-vcpkg, then build the desired
target from Visual Studio.
From Developer PowerShell for VS in Windows Terminal, run the equivalent Windows commands:
cmake --preset windows-vs-release-vcpkg
cmake --build --preset windows-vs-release-vcpkgOn Linux, use the corresponding preset directly from a terminal:
# GCC release
cmake --preset linux-gcc-release-vcpkg
cmake --build --preset linux-gcc-release-vcpkgFor debug builds, replace release with debug in the preset name.
If dependencies are already installed and visible to CMake, use a
provider-neutral preset such as linux-gcc-release instead:
cmake --preset linux-gcc-release
cmake --build --preset linux-gcc-releaseEvery project under projects/ provides a submit_<project-name> target. For
example, to package project1:
On Windows, run the following command from Developer PowerShell for VS in Windows Terminal:
cmake --build --preset windows-vs-release-vcpkg --target submit_project1On Linux:
cmake --build --preset linux-gcc-release-vcpkg --target submit_project1The resulting archive is written below the selected preset's binary directory:
out/build/<preset>/projects/<project-name>/submission/<project-name>.zip.
projects/project0 uses the CUDA Runtime and Driver APIs, along with NVML,
to report properties and capabilities for every detected CUDA device. CUDA
Core counts use NVML when available and otherwise fall back to an architecture
table. The program also checks peer access between devices when multiple GPUs
are available.
projects/project1 is a Mandelbrot renderer with interactive OpenGL and
one-shot offline PNG modes. It supports high-precision center/zoom values,
configurable resolution, and 1x1 or 2x2 sampling. The
PROJECT1_OFFLINE_ONLY CMake option builds it without the online OpenGL
dependencies. See the project1 README for
usage, command-line options, controls, and offline-build details.
projects/project2 renders three Lucy models, a ground sphere, a randomized
sphere field, and a skybox with OptiX. It provides a progressive OpenGL viewer
and offline PNG rendering. Offline mode has configurable sample count and
denoising; the viewer has a denoiser toggle. The PROJECT2_OFFLINE_ONLY CMake
option removes the viewer's OpenGL and GLFW dependencies. Project 2 requires a
compatible NVIDIA GPU, CUDA, and OptiX 9.1. See the
project2 README for
usage, command-line options, controls, and offline-build details.
projects/project3 performs AlexNet batch inference with CUDA. It provides
benchmarking on synthetic images and CPU/GPU prediction validation on real
images, with configurable batch size and stream count. Students use Nsight
Systems and Nsight Compute to analyze the pipeline, overlap transfers and
computation with CUDA streams, and optimize convolution and fully connected
kernels. Pretrained weights and validation images are included; retrieving
the weights requires Git LFS. See the
project3 README for dependencies, build
instructions and command-line options.