EADST

Jetson Check GPU Memory Usage with C++

Jetson Check GPU Memory Usage with C++

#include < iostream>
#include < unistd.h>
#include "cuda.h"

int main()
{
    // show memory usage of GPU
    size_t free_byte ;
    size_t total_byte ;

    while (true )
    {
        cudaError_t cuda_status = cudaMemGetInfo( &free_byte, &total_byte ) ;

        if ( cudaSuccess != cuda_status ){
            std::cout << "Error: cudaMemGetInfo fails, " << cudaGetErrorString(cuda_status) << std::endl;
            exit(1);
        }

        double free_db = (double)free_byte ;
        double total_db = (double)total_byte ;
        double used_db = total_db - free_db ;

        std::cout << "GPU memory usage: used = " << used_db/1024.0/1024.0 << ", free = "
                  << free_db/1024.0/1024.0 << " MB, total = " << total_db/1024.0/1024.0 << " MB" << std::endl;
        sleep(1);
    }

    return 0;
}

Reference

Nvidia Forums

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Color llama.cpp GIT WebCrawler 多线程 Jupyter Agent Quantization icon Dataset ChatGPT HaggingFace Crawler Template ModelScope Plate CTC Pytorch NameSilo transformers LaTeX VGG-16 JSON Bitcoin RGB Statistics Windows Animate Nginx Rebuttal XGBoost OCR Review 公式 PyCharm Python Datetime Jetson QWEN Land Vim tar v2ray CEIR 证件照 FastAPI Algorithm 音频 uwsgi Linux Search git-lfs 云服务器 Tiktoken Miniforge mmap LLAMA Diagram Permission Tracking UI API网关 Domain Hilton CLAP BTC Pillow Food Streamlit Tensor SQLite 签证 Docker FP16 NLTK Attention Baidu 关于博主 EXCEL MD5 COCO ResNet-50 GGML GPTQ PyTorch DeepStream 递归学习法 BeautifulSoup 算法题 ms-swift Google DeepSeek CSV Qwen2 搞笑 Firewall v0.dev CV RL SPIE Claude FP32 Gemma PDB Pickle Base64 Transformers Video Hotel Paddle TSV AI Use tqdm Qwen Zip Card Safetensors Qwen2.5 FP8 Sklearn GPT4 VPN CUDA logger 论文 Image2Text SAM Distillation hf Interview CAM Quantize 阿里云 Excel Paper HuggingFace RAR BF16 Shortcut 图标 Cloudreve Ptyhon Website WAN 飞书 CC Conda Freesound Plotly Clash Mixtral Input ONNX 净利润 FlashAttention Proxy Bipartite FP64 第一性原理 TTS PDF Anaconda VSCode NLP torchinfo 域名 Llama Michelin Pandas Magnet printf 论文速读 Hungarian C++ Breakpoint Logo OpenAI uWSGI 强化学习 Knowledge Data Web Django Heatmap SQL Disk Numpy IndexTTS2 Github 财报 XML GoogLeNet SVR InvalidArgumentError 多进程 Vmess 图形思考法 Password OpenCV Math LLM Augmentation News 腾讯云 Jev API Harness PIP Bin Random Git Bert 报税 YOLO LeetCode Translation LoRA TensorFlow 继承 Markdown git 顶会 TensorRT scipy 版权 diffusers Ubuntu UNIX
站点统计

本站现有博文337篇,共被浏览961570次

本站已经建立2673天!

热门文章
文章归档
回到顶部