CUDA/C++20 cmake starter with google test and google benchmark

May 4, 2026 ยท View on GitHub

License: MIT

A cross-platform CUDA/C++20 starter project with google test (1.12.1) and google benchmark (v1.7.1) support. See this project for a similar template without CUDA support.

Requires CUDA 12.8+.

Build

On Linux/Unix, to build and make the test:

$ mkdir build && cd $_
$ cmake ..
$ make

CUDA can be strict about compiler version, on UNIX, cmake will honor the CXX variable, so for example to use gcc 15 you can write (before calling cmake):

$ export CC=gcc-15
$ export CXX=g++-15

or

$ CC=gcc-15 CXX=g++-15 cmake ..

By default, the makefiles will build the library, executable, tests, and benchmarks. The commands

$ ./test/test_deepgreen
$ ./bench/bench_deepgreen

...will run the tests and benchmarks.

On Windows, you can use cmake to generate Visual Studio build files with the same 'cmake ..' command.

See the CMakeLists.txt file to see all the options.

License

MIT