Skip to content

Instantly share code, notes, and snippets.

@lambdaknight
Last active Oct 6, 2021
Embed
What would you like to do?
Dumb CUDA
#include <cuda_runtime.h>
#include <chrono>
#include <thread>
int main()
{
using namespace std::chrono_literals;
cudaSetDevice(0);
std::size_t n = 1024ULL*1024ULL*1024ULL;
std::int64_t* foo;
cudaMalloc(reinterpret_cast<void**>(&foo), n);
std::this_thread::sleep_for(10s);
return 0;
}
Wed Oct 6 17:36:21 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 465.19.01 Driver Version: 465.19.01 CUDA Version: 11.3 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA Quadro R... Off | 00000000:1C:00.0 Off | Off |
| 33% 31C P2 40W / 230W | 1493MiB / 16114MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 1 NVIDIA Quadro R... Off | 00000000:1D:00.0 Off | Off |
| 33% 30C P8 10W / 230W | 1493MiB / 16117MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 2 NVIDIA Quadro R... Off | 00000000:3F:00.0 Off | Off |
| 33% 26C P8 9W / 230W | 1493MiB / 16117MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
| 3 NVIDIA Quadro R... Off | 00000000:40:00.0 Off | Off |
| 34% 26C P8 6W / 230W | 1493MiB / 16117MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| 0 N/A N/A 2441 G /usr/libexec/Xorg 183MiB |
| 0 N/A N/A 2669 G /usr/bin/gnome-shell 171MiB |
| 0 N/A N/A 27766 C ./a.out 1137MiB |
| 1 N/A N/A 2441 G /usr/libexec/Xorg 183MiB |
| 1 N/A N/A 2669 G /usr/bin/gnome-shell 171MiB |
| 1 N/A N/A 27766 C ./a.out 1137MiB |
| 2 N/A N/A 2441 G /usr/libexec/Xorg 183MiB |
| 2 N/A N/A 2669 G /usr/bin/gnome-shell 171MiB |
| 2 N/A N/A 27766 C ./a.out 1137MiB |
| 3 N/A N/A 2441 G /usr/libexec/Xorg 183MiB |
| 3 N/A N/A 2669 G /usr/bin/gnome-shell 171MiB |
| 3 N/A N/A 27766 C ./a.out 1137MiB |
+-----------------------------------------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment