A minimal, production-ready CUDA C++ starter project for learning and testing GPU kernels in Windows + WSL2 environments.
Designed for reproducible builds, clean debugging, and automated testing.
- CUDA C++ example:
src/thrust_intro.cu - Cross-platform build via CMake
- GPU architecture targeting (Compute Capability 8.9, RTX 4070 SUPER)
.vscode/launch.jsonfor GDB debuggingCTestintegration for regression testingcheck_cuda_starter_status.shfor device info + benchmark
cuda-starter-windows-wsl/
├── src/
│ └── thrust_intro.cu
├── build/ # Auto-generated by CMake
├── .vscode/ # VS Code launch configuration
├── .gitignore
├── CMakeLists.txt
├── check_cuda_starter_status.sh
└── README.md
From project root:
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
./build/thrust_introYou should see output similar to:
Success! All 1,048,576 elements added correctly.
Run the integrated test target:
cd build
ctestExpected:
Test project /path/to/build
Start 1: thrust_intro_run
1/1 Test #1: thrust_intro_run ... Passed
100% tests passed, 0 tests failed out of 1
A helper script validates your CUDA environment and runs a quick benchmark.
./check_cuda_starter_status.shTypical output:
GPU: NVIDIA GeForce RTX 4070 SUPER (Compute Capability 8.9)
Driver Version: 560.xx, CUDA 12.8
Vector Add completed in 0.5 ms
| Component | Recommended Version |
|---|---|
| CUDA Toolkit | 12.8+ |
| CMake | ≥ 3.24 |
| Compiler | g++ or nvcc |
| GPU | RTX 4070 SUPER (SM 8.9) |
| OS | Windows 11 + WSL2 (Ubuntu 22.04) |
Launch configuration is in .vscode/launch.json:
{
"name": "Run thrust_intro",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/thrust_intro",
"cwd": "${workspaceFolder}",
"MIMode": "gdb"
}Run or debug directly with F5 inside VS Code.
- CUDA by Example — Sanders & Kandrot
- NVIDIA CUDA Toolkit Docs
- CMake + CUDA Language Guide
© 2025 Samuel Huang — Toronto, ON
Clean CUDA template maintained for learning and professional use.