Skip to content

Instantly share code, notes, and snippets.

@maludwig
Created September 13, 2025 18:55
Show Gist options
  • Select an option

  • Save maludwig/b162ee812f36163afac649dd81036a0c to your computer and use it in GitHub Desktop.

Select an option

Save maludwig/b162ee812f36163afac649dd81036a0c to your computer and use it in GitHub Desktop.
nvidia compilation test
#include <cuda_runtime.h>
#include <cudnn.h> // Add cuDNN header
#include <iostream>
int main() {
cudaDeviceProp prop;
int device;
cudaGetDevice(&device); // Get the current device ID
cudaGetDeviceProperties(&prop, device); // Get device properties
size_t free_mem, total_mem;
cudaMemGetInfo(&free_mem, &total_mem); // Get VRAM usage
std::cout << "> GPU Name: " << prop.name << std::endl;
std::cout << "> Compute Capability: " << prop.major << "." << prop.minor << std::endl;
std::cout << "> VRAM Usage: " << (total_mem - free_mem) / (1024 * 1024) << " MB / " << total_mem / (1024 * 1024) << " MB" << std::endl;
// Print cuDNN version
std::cout << "> cuDNN Version: "
<< CUDNN_MAJOR << "."
<< CUDNN_MINOR << "."
<< CUDNN_PATCHLEVEL
<< std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment