关于远程桌面链接下调用显卡加速科学运算

最近由于项目需要,准备购置图形工作站进行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).

转载于:https://www.cnblogs.com/liuke-note/p/10077916.html

你可能感兴趣的:(关于远程桌面链接下调用显卡加速科学运算)