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

本站现有博文330篇,共被浏览860926

本站已经建立2569天!

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