GPU開啟持久化模式

yuhaohao發表於2024-06-12

GPU開啟持久化模式

GPU驅動記憶體常駐模式,也稱為GPU驅動持久模式。linux 系統下,在 persistence 模式是 enabled 狀態時, GPU 驅動一直處於載入狀態, 減少執行程式時驅動載入的延遲。 不開啟該模式時,在程式每次呼叫完 GPU 後, GPU 驅動都會被解除安裝,下次呼叫時再重新載入, 驅動頻繁解除安裝載入, GPU 頻繁被初始化,會導致 GPU 當機, CPU 訪問 PCIe config registers時間過長導致 softlock, 最終造成 GPU 掉卡、溫度監測異常等情況。建議開啟GPU驅動記憶體常駐模式並配置開機自啟動。

[root@host ~]# cat /usr/lib/systemd/system/nvidia-persistenced.service
# NVIDIA Persistence Daemon Init Script
#
# Copyright (c) 2013 NVIDIA Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# This is a sample systemd service file, designed to show how the NVIDIA
# Persistence Daemon can be started.
#

[Unit]
Description=NVIDIA Persistence Daemon
Wants=syslog.target

[Service]
Type=forking
ExecStart=/usr/bin/nvidia-persistenced --user nvidia-persistenced
ExecStopPost=/bin/rm -rf /var/run/nvidia-persistenced

[Install]
WantedBy=multi-user.target

開啟成功後效果:

相關文章