[英]tensorflow gpu failed init from systemd service
我正在嘗試托管使用tensorflow庫的flask API。我安裝了帶有CUDA和cudnn庫的tensorflow gpu庫。我使用以下命令手動檢查了它是否正常。
/captcha/env/bin/gunicorn captcha:app -b 0.0.0.0:5124 -k gevent --worker-connections 1000
但是當我添加這個systemd服務時,我得到了一個tensorflow gpu錯誤
系統服務
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
PIDFile=/run/gunicorn/pid
User=root
Group=root
WorkingDirectory=/captcha/env
ExecStart=/captcha/env/bin/gunicorn captcha:app -b 0.0.0.0:5124 -k gevent --worker-connections 1000
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
日志文件中的錯誤文本:
無法加載本地TensorFlow運行時。
請參閱https://www.tensorflow.org/install/install_sources#common_installation_problems
出於某些常見原因和解決方案。 尋求幫助時,在此錯誤消息上方包括整個堆棧跟蹤。
誰能指出我做錯了什么?
Systemd似乎剝離了所有環境變量,而TensorFlow需要知道在哪里可以找到Cuda。 沒有LD_LIBRARY_PATH,它將失敗。
可能有幾種方法可以執行此操作,但這對我有用。
[Service]
Environment=LD_LIBRARY_PATH=/usr/local/cuda/lib64
ExecStart=/path/to/your/app
...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.