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

本站现有博文332篇,共被浏览875628

本站已经建立2583天!

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