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

本站现有博文323篇,共被浏览795906

本站已经建立2493天!

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