關於遠程桌面鏈接下調用顯卡加速科學運算


最近由於項目需要,准備購置圖形工作站進行CUDA運算,面臨一個問題:假設工作站操作系統是windows server 2016,局域網遠程連接后能否正常調用顯卡做CUDA科學運算?通常認為:既然程序是在工作站上跑,自然可以識別顯卡並調用CUDA。但是在遠程連接這種情況下,就完全相反了,微軟自帶的遠程連接工具RDP並不是把工作站直接映射到客戶機這邊而是將信息渲染打包后發送過來,在本地解包,具體可以參見微軟官方解釋如下

On the server, RDP uses its own video driver to render display output by constructing the rendering information into network packets by using RDP protocol and sending them over the network to the client. On the client, RDP receives rendering data and interprets the packets into corresponding Microsoft Windows graphics device interface (GDI) API calls.

這就帶來一個問題:將信息打包過程中完全忽略了必要的硬件,造成遠程連接下運行軟件無法獲取真實的硬件相關信息,許多依托於GPU的軟件無法正常使用,可以這樣理解:看似我們連接到了工作站,實際卻是一個半虛擬的桌面環境。微軟這樣做也只是為了傳輸起來無需耗費大量帶寬,自帶的工具只是為了遠程維護而不是作為遠程運行軟件的管道。
那么,有什么方法可以實現這個功能嗎?找了好久,linux下解決方案比較多,windows較少。
對於linux來說,非常簡單,因為可以借助ssh命令行遠程登陸,許多可以通過命令行運行的軟件沒有任何問題,比如linux版的matlab。多用戶也很容易實現。但是對於windows就稍微麻煩點了,對於一部分軟件來說,可以先在服務器端跑起來,然后遠程連接,或者,通過QQ遠程協助打開軟件然后遠程連接也可以解決部分問題。
回到本文最開始的目的,想要遠程做科學運算(windows下)英偉達給出下面幾種方法:
(1)購買tesla品牌的顯卡,它獨特的TCC驅動下能為您完美的解決此問題。
(2)使用VNC連接。
(3)使用其他軟件,例如teamviewer連接。
其實teamviewer不是一個單純的遠程管理軟件,他最大的特點在於除了傳送指令,所有關於GUI的部分全部以視頻流的形式傳送給客戶機,因而teamviewer也是一個視頻會議軟件。自然,它也不用將數據打包發送。
需要說明一下,如果你將teamviewer當成遠程連接工具,那么遠程服務器需要至少有一塊亮機卡。
2018年補充:上述所說的諸多問題已經找到佐證,英偉達在其官方文檔中說明了這個問題(參看2.4節)節選如下;

On Windows 7 and later, the operating system provides two driver models under which the NVIDIA Driver may operate: ‣ The WDDM driver model is used for display devices. ‣ The Tesla Compute Cluster (TCC) mode of the NVIDIA Driver is available for nondisplay devices such as NVIDIA Tesla GPUs; it uses the Windows WDM driver model. The TCC driver mode provides a number of advantages for CUDA applications on GPUs that support this mode. For example: ‣ TCC eliminates the timeouts that can occur when running under WDDM due to the Windows Timeout Detection and Recovery mechanism for display devices. ‣ TCC allows the use of CUDA with Windows Remote Desktop, which is not possible for WDDM devices. ‣ TCC allows the use of CUDA from within processes running as Windows services, which is not possible for WDDM devices. ‣ TCC reduces the latency of CUDA kernel launches. TCC is enabled by default on most recent NVIDIA Tesla GPUs. To check which driver mode is in use and/or to switch driver modes, use the nvidia-smi tool that is included with the NVIDIA Driver installation(see nvidia-smi -h for details).


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM