Nvtop - 在Linux即時監控GPU使用率

3490 단어 nvt
  • 訂閱patreon即可看到更多文章https://www.patreon.com/wade3c
  • Youtube頻道





  • 동시간대 엔비디아 AMD의 GPU

    설치



    적절한




    sudo apt update
    sudo apt install nvtop
    


    도커파일




    FROM nvidia/cuda
    
    RUN apt-get update && \
        apt-get install -y cmake libncurses5-dev libncursesw5-dev git && \
        rm -rf /var/lib/apt/lists/*
    
    RUN ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/stubs/libnvidia-ml.so /usr/local/lib/libnvidia-ml.so && \
        ln -s /usr/local/cuda-10.1/targets/x86_64-linux/lib/stubs/libnvidia-ml.so /usr/local/lib/libnvidia-ml.so.1 && \
        cd /tmp && \
        git clone https://github.com/Syllo/nvtop.git && \
        mkdir -p nvtop/build && cd nvtop/build && \
        cmake .. && \
        make && \
        make install && \
        cd / && \
        rm -r /tmp/nvtop && \
        rm /usr/local/lib/libnvidia-ml.so && \
        rm /usr/local/lib/libnvidia-ml.so.1
    
    ENTRYPOINT ["/usr/local/bin/nvtop"]
    


    這裡cuda 用是10.2 可能得視自身情況修改 (ex: RTX30不支援)

    nvtop repo內的Dockerfile

    자주하는 질문


  • ### 패키지를 찾을 수 없음

  • 소스 목록 업데이트



    有可能是清單內沒有可以下載的網址,比較常發生在debian,可以去source list設定non-free

    sudo vim /etc/apt/sources.list
    


    在每行的結尾加上空格與non-free(這個做法不適用於Ubuntu)

    수동 컴파일



    有些OS並沒有提供已經編譯好的套件供安裝,這裡就得自己compile了

    撰寫文章時只支援Ubuntu 20.04/ 20.10,而18.04已經裝不了



    先裝必要的套件

    sudo apt install cmake libncurses5-dev libncursesw5-dev git
    



    git clone https://github.com/Syllo/nvtop.git
    mkdir -p nvtop/build && cd nvtop/build
    cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=ON
    make
    
    # Install globally on the system
    sudo make install
    
    # Alternatively, install without privileges at a location of your choosing
    # make DESTDIR="/your/install/path" install
    



    참조



    GitHub - Syllo/nvtop: AMD and NVIDIA GPUs htop like monitoring tool

    Wrap NVTOP in docker (Impossible to initialize nvidia nvml) · Issue #42 · Syllo/nvtop

    nvtop not found in Debian Buster repositories · Issue #46 · Syllo/nvtop

    좋은 웹페이지 즐겨찾기