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

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

本站已经建立2590天!

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