CUDA on Tesla over Remote Desktop

Problem

Typically, CUDA programs cannot be executed over a Remote Desktop session. (For more on this problem, see here.) However, if the CUDA device is a Tesla and if it does not need to be the primary graphics device, then you are in luck! A typical setup for Tesla is to have another Quadro device handle the desktop graphics, while the Tesla device handles the computation. In such setups, CUDA programs can be executed on the Tesla device over Remote Desktop! πŸ™‚

Solution

To be able to successfully execute CUDA programs on a Tesla device, you need to use a Tesla Compute Cluster (TCC) driver and set the Tesla device to TCC mode.

1. Install TCC Driver

CUDA programs can execute on Tesla devices with the CUDA developer driver you might have downloaded off the CUDA webpage. However, the developer driver is not the same as the device specific driver. (For more on the difference, see here.) To be able to use the TCC mode of the Tesla device, the TCC driver specific to the Tesla device is needed.

To get the Tesla driver, use the NVIDIA Drivers webpage and choose the driver for your Tesla device. This is its TCC driver. Install it.

2. Switch to TCC Mode

By default, the Tesla device will be working in a Windows Display Driver Model (WDDM) mode. This is the mode used by most CUDA devices, since they might need to support desktop graphics. If the Tesla device is in the WDDM mode, then it will not be able to execute CUDA programs over Remote Desktop.

To switch the Tesla device to TCC mode, we can use the NVIDIA System Management Interface (SMI) tool. On Windows, this is provided as an executable file named nvidia-smi.exe. On my system, this was found in the C:\Program Files\NVIDIA Corporation\NVSMI directory. Open a Windows command prompt with elevated (Administrator) privileges and change to this directory. (One way to open an Administrator command prompt is described here.)

To list the available NVIDIA devices use the command:

nvidia-smi -q

To view the details of a specific device use the command:

nvidia-smi -q -i 0

The -i specifies the ID of the device. Device IDs begin from 0 upwards.

Finally, to flip the driver model of a device from WDDM to TCC mode:

nvidia-smi -dm 1 -i 0

The -dm parameter takes two values: 0 for WDDM and 1 for TCC.

Changing the driver model mode of the Tesla requires a restart of the system. After the restart, you should be able to execute CUDA programs remotely on the Tesla computer! πŸ™‚

Tried with: Tesla C2050 and Quadro 4000

CUDA and Remote Desktop

Problem

If you connect to a CUDA-capable Windows computer using Remote Desktop and run CUDA programs on it, they fail. That is, CUDA programs fail if they are executed under a Remote Desktop Protocol (RDP) session.

Explanation

In the RDP universe, the CUDA-capable computer is the RDP server and the computer connecting to it is the RDP client. When a Windows computer becomes a RDP server, its graphics driver (say, a NVIDIA driver) is replaced with a RDP graphics driver of Windows.

The RDP graphics driver converts display information into RDP packets and sends it to the client. This is why the display of the RDP server goes blank when it is involved in a RDP session.

At the RDP client, the data in these packets are interpreted as Windows Graphics Device Interface (GDI) information and used to draw the corresponding windows. Thus, RDP is somewhat similar to how X works in the Linux world. This is what gives RDP its speed, performance and other capabilities.

But, this is also why CUDA will not work over RDP. Windows replaces the CUDA-capable NVIDIA graphics driver with its RDP graphics driver. Thus, all CUDA programs fail.

Solution

Instead of RDP, pick any alternate solution that does not touch the graphics driver. That is, something that allows the graphics driver to render, and then captures and sends the desktop information as a bitmap to the other end. So, desktop sharing solutions like VNC or TeamViewer work fine with CUDA.

Reference: Remote Desktop Protocol at MSDN

Windows 7: 256 Colors in Remote Desktop Connection

Why?

Reducing the color depth used for a remote session is one way to speed up the Remote Desktop (RDP) session on a slow network connection. 15-bit is the lowest color depth allowed in the Remote Desktop Connection client (mstsc.exe) of Windows 7. But, the Remote Desktop client of Windows XP had allowed a lower color depth of 8-bit (256 colors). The remote session surely looks crappy with 256 colors, but it can be a lifesaver on a slow connection! πŸ™‚

How?

There is no direct way to choose 256 colors in the Remote Desktop of Windows 7. But, a remote session can be invoked with 256 colors:

  1. Set all the remote desktop settings for the connection and save it to a RDP (.rdp) file by choosing Save As in the General tab.
  2. Open this .rdp file in a text editor. Find the line that reads session bpp:i:16. The value here will read 15, 16, 24 or 32, depending on the color depth you had chosen while saving the file. Change this line to session bpp:i:8
  3. Use this .rdp file to open a RDP session to the remote computer. This can be done by either opening this file in the Remote Desktop Connection client or by double-clicking this file. The remote session will now use a 8-bit color depth.

 

Tried with: Remote Desktop Connection client (mstsc.exe) 6.1.7600.16385 on Windows 7

Windows: ClearType on RDP

ClearType is not turned on by default over Remote Desktop Protocol (RDP). Thus, if you connect to a computer using Remote Desktop Connection (RDC) you will notice aliased fonts, quite ugly in my opinion without ClearType enabled.

If you are connecting to a Vista or Windows 7 computer, enable Experience β†’ Font smoothing in the RDC dialog.

If you are connecting to a Windows XP computer, a bit more work is needed. Apply the following Registry entries on that computer:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations]
"AllowFontAntiAlias"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
"AllowFontAntiAlias"=dword:00000001

Or just place these lines in a file named CleartypeOnRDP.reg file and execute it.