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

本站现有博文311篇,共被浏览742205

本站已经建立2381天!

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