Server environments and C++ AMP
We have received questions about using C++ AMP on server systems and here are some common ones:
- Do I need to connect my display to the GPU for C++ AMP to work?
- Does C++ AMP work on headless servers?
- Can I use remote desktop for running C++ AMP apps?
- Does C++ AMP work under session 0 or in a service?
In this blog post, we will answer these questions and arm you with knowledge to answer related questions on your own.
To start with, you can run this tool to list all the accelerators that support C++ AMP. If you see the message “No accelerators found that are compatible with C++ AMP”, it means none of the devices in your system are capable of running C++ AMP apps.
If you already checked that your graphics device is DirectX 11 capable and are still seeing this message, it means for some reason your hardware is not being detected as a valid accelerator. So let’s start troubleshooting your configuration!
Do I need to connect my display to the GPU for C++ AMP to work?
You don’t need to connect the display cable to your DirectX 11 card in order for it to be detected as a C++ AMP accelerator. Since C++ AMP is built on top of DirectX, the only thing needed is for your device to be detected as a DirectX 11 capable device.
Do I need to remove devices that don’t support DirectX 11? (aka XDDM is not your friend)
This configuration commonly occurs on servers which come with an Integrated VGA that is only DirectX 9 capable (or not DirectX capable at all). Let’s assume that you have such a machine running Windows Server 2008 R2. Now if you plug in a discrete card which is DirectX 11 capable on such a server and check if your new card supports C++ AMP, you will see the message above saying no accelerators were found. What is happening here? Why is C++ AMP not detecting your DirectX 11 hardware?
The answer lies in driver model loaded by the integrated VGA. Some integrated VGA adapters only have drivers based on the XP driver model (XDDM) which is the driver model used by Windows XP and Windows 2000. The discrete DirectX11 card uses drivers based on the new Windows Display Driver Model (WDDM) which is supported from Windows Vista onwards. The key fact is that these driver models cannot be used together. This means if we load an XDDM driver, then a WDDM driver cannot be loaded.
This limitation has been addressed in Windows 8 (and Windows Server 2012) so your DirectX 11 device will be detected by default without any changes to the hardware or to the BIOS. Starting with Windows 8, XDDM drivers are no longer needed or supported. Instead, a WDDM-based Microsoft Basic Display Adapter is provided as a replacement for today’s in-box XDDM Standard VGA driver. If a WDDM driver cannot be located for the on board VGA, the Microsoft Basic Display Adapter is automatically used to provide basic display functionality and software-based 2D and 3D rendering. This means on Windows 8 and Windows Server 2012, your, C++ AMP code will just work!
On early versions of Windows, to enable WDDM instead of XDDM you will need to remove (or disable) the DirectX 9 card. If it is an integrated VGA, you can disable it in your BIOS by setting the DirectX 11 card as your primary graphics adapter. The location and name of the BIOS entry varies between vendors. On my machine, I found this entry under BIOS –> Advanced –> PCI/PnP Settings and called “Boots Graphic Adapter Priority” .
Does C++ AMP work on headless servers?
Another configuration of interest is true headless servers. A true headless system does not require a keyboard, mouse, or a graphics adapter during operation. This is of interest to C++ AMP users who want to configure their system with compute resources only, with hardware that offers a DirectX11 driver but that does not offer a display connector. This is hardware that does not advertise itself to Windows as a display device (at writing there is only one such model on the market).
The new WDDM v1.2 driver model in Windows 8 has many enhancements to support headless servers. A stub display which is part of the Microsoft Basic Display Driver is used to boot when no graphics hardware is available. This means you can configure true headless GPU servers with Windows 8 (and Windows Server 2012) and the compute resources will be detected as C++ AMP accelerators.
For Windows 7 (and Windows Server 2008 R2), you need to have hardware that can support a display even if there is nothing connected to the display port.
Can I use remote desktop for running C++ AMP apps?
The question that typically follows headless server configuration is whether C++ AMP works through remote desktop, and the short answer is “yes”. If the machine has WDDM enabled, remote desktop will also continue to see the WDDM devices enabled. This means your C++ AMP accelerators are detected in the same way regardless of whether you access the machine directly or by using remote desktop.
Does C++ AMP work under session 0 or in a service?
On Windows 8 and Windows Server 2012, C++ AMP code works under Session 0.
For Windows 7/Windows Server 2008 R2, running C++ AMP under session 0 is not officially supported, but it may work for you. We know of many customers who are successfully using DirectCompute under session 0. The fact that it is not supported means that it hasn’t been tested, so there may be bugs or some DirectX APIs that fail and we will be unable to help you if you run into them. On Windows 7, the supported way for the session 0 limitations is to refactor your code so that it uses a component that runs under an interactive session, and have that component use the GPU.
That’s all for this blog post, if you have additional questions, please ask them below or in our MSDN forum.