lsgpu is a lightweight C++17 library for querying GPU information using Vulkan.
It provides a clean, cross-platform API without exposing Vulkan headers.
- Detects all GPUs on the system.
- Reports GPU properties:
- Name
- Device ID
- Vendor ID
- VRAM size
- Discrete vs integrated
- Vulkan API version
- Minimal dependencies:
- Only requires Vulkan, and <cstdint> (also <cstring> but it's in the library, not the header)
- C++ STL-free header
git clone https://github.com/iDontHaveTime/lsgpu-api.git
cd lsgpu-api
mkdir build
cmake -S . -B build
cmake --build build
./build/lsgpu- Create a system object to initialize Vulkan and query GPUs:
lsgpu::system sys;
if(!sys){
// error
}- You can then iterate through GPUs with a C++'s for range loop like this:
for(const lsgpu::gpu& gpu : sys.gpus()){
std::cout<<gpu.get_name()<<std::endl; // prints out the gpu's name
}This was tested on Arch Linux x86-64, this has not been tested on other platforms.