Created
September 13, 2025 18:55
-
-
Save maludwig/b162ee812f36163afac649dd81036a0c to your computer and use it in GitHub Desktop.
nvidia compilation test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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