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

本站现有博文324篇,共被浏览810172

本站已经建立2513天!

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