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

本站现有博文334篇,共被浏览933068

本站已经建立2642天!

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