07/03/2016 Stijn Van Renterghem

How to use AWS EC2 – GPU Instances

How to use AWS EC2 – GPU Instances 0n Windows

 

Content Table

About GPU Instances

When would you use a GPU instance
G2 family
NVIDIA GRID
Which Remote Desktop solution is recommended?
G2 In Action

 

Let’s get started

Use an existing AMI
Create your own Instance
Connect to the desktop
Use your 3D application or streaming application

Game Setup

 

 

 

About GPU Instances

When would you use a GPU instance

Do you want to build fast, 3D applications that run in the cloud and deliver high performance 3D graphics to mobile devices, TV sets, and desktop computers?

If you require high parallel processing capability, you’ll benefit from using GPU instances, which provide access to NVIDIA GPUs with up to 1,536 CUDA cores and 4 GB of video memory. You can use GPU instances to accelerate many scientific, engineering, and rendering applications by leveraging the Compute Unified Device Architecture (CUDA) or OpenCL parallel computing frameworks. You can also use them for graphics applications, including game streaming, 3-D application streaming, and other graphics workloads.

 

G2 family

Features:

  • High Frequency Intel Xeon E5-2670 (Sandy Bridge) Processors
  • High-performance NVIDIA GPUs, each with 1,536 CUDA cores and 4GB of video memory
  • Each GPU features an on-board hardware video encoder designed to support up to eight real-time HD video streams (720p@30fps) or up to four real-time full HD video streams (1080p@30fps)
  • Support for low-latency frame capture and encoding for either the full operating system or select render targets, enabling high-quality interactive streaming experiences
Model GPUs vCPU Mem (GiB) SSD Storage (GB)
g2.2xlarge 1 8 15 1 x 60
g2.8xlarge 4 32 60 2 x 120

For more information: http://aws.amazon.com/ec2/instance-types/
https://aws.amazon.com/blogs/aws/build-3d-streaming-applications-with-ec2s-new-g2-instance-type/

 

 

NVIDIA GRID

What is NVIDIA GRID

NVIDIA GRID takes key technologies from gaming, workstation graphics, and supercomputing, and enables high performance Applications and Games to run on the Cloud, with pixels streamed over IP networks to remote users. The GRID SDK enables developers to efficiently render, capture and encode on a server, while decoding the stream on a client. NVIDIA incorporates a lot of the functionality within the GPU driver, enabling high performance graphics to be rendered to a remote client with minimal latency.

g2_gpu_model

 

OpenGL and DirectX

You have access to a very wide variety of 3D rendering technologies when you use the g2 instances. Your application does its drawing using OpenGL or DirectX. If you would like to make use of low-level frame grabbing and video encoding, you can make use of the NVIDIA GRID SDK.

 

What is NVIDIA GRID SDK

The GRID SDK enables fast capture and compression of the desktop display or render targets from NVIDIA GRID cloud gaming graphics boards. You will need to register in order to download the GRID SDK. Registration is free, and the download page can be found here:  https://developer.nvidia.com/grid-app-game-streaming.

The GRID SDK consists of two component software APIs: NvFBC and NvIFR.
a) NvFBC captures (and optionally H.264 encodes) the entire visible desktop. In this model you generate one video stream per instance.
b) NvIFR captures (and optionally H.264 encodes) from a specific render target. You can generate multiple streams per instance.

For more information: https://developer.nvidia.com/sites/default/files/akamai/gamedev/grid/grid22/grid-sdk-faq.pdf

 

When should NvFBC and NvIFR be used?

NvFBC is better for remote desktop applications.
NvIFR is the preferred solution to capture the video output of one specific application.

 

 

What is the NVIDIA Video Codec SDK – NVENC

The NVIDIA Video Codec SDK is a complete set of high-performance NVIDIA Video Codecs tools, samples and documentation for hardware encode API (NVENC API) and hardware decode API (NVCUVID API) on Windows and Linux OS platforms. This SDK consists of two hardware API interfaces: NVENC for video encode acceleration and NVCUVID for video decode acceleration with NVIDIA’s Kepler and Maxwell generations of GPUs

 

Download NVIDIA NVENC – Video Codec SDK

The latest NVIDIA Video Codec SDK version available is 6.0, which requires NVIDIA GPU driver R358 or above for Windows and R358 or above for Linux.
You can download the required drivers here Windows,Linux

 

How do I enable NvFBC?

Windows: NvFBC needs to be enabled after a clean installation.

{Installation Directory} \bin> NvFBCEnable.exe -enable
Use the NvFBCH264 SDK sample to capture the desktop to a H.264 file.

Linux: For the NvFBC GRID API functions, please refer to the flag

NVFBC_CREATE_CAPTURE_SESSION_PARAMS.bWithCursor

 

What are the optimal encoder settings for desktop applications streaming?

With the preset setting LOW_LATENCY_HP , a single GPU can encode 6-8 streams (exact number depends on other settings such as RC mode). LOW_LATENCY_HQ preset will give 4-6 streams (exact number depends on other settings such as RC mode).

The HQ preset will give you slightly better quality, but the performance will be lower than that of HP. To get the ideal performance for each preset, you can use PerfMSNEC sample application in the SDK.

GRID SDK exposes 3 video encoder presets (LOW_LATENCY_HQ, LOW_LATENCY_HP and LOW_LATENCY_DEFAULT). As the names suggest, these presets are meant for encoding for low-latency applications such as remote streaming, cloud gaming etc. Please refer to the API reference for more details on each parameter.

 

Which Remote Desktop solution is recommended?

For setup, debugging, and configuration for these servers, it is recommended to use TeamViewer. This software allows a remote client to connect any one desktop window at a time. In comparison, VNC will also capture and stream with the NVIDIA GPU accelerated driver, but for baremetal systems, it will capture all desktop windows. This adds additional overhead and results in reduced performance when streaming. The overhead for capturing one desktop window in TeamViewer is significantly less vs capturing all windows desktops with the VNC solution.

Note: TeamViewer uses a proprietary compression format for remote streaming. The NVENC H.264 hardware engine is not used by TeamViewer.

For streaming applications and games (not using H.264 for compression), TeamViewer is the recommended solution for streaming the desktop.
For the best experience on GRID, use NVENC with H.264 compression for the best remote streaming experience.

How to install Teamviewer

 

Can I use Microsoft Windows Remote Desktop?

While it is more efficient in terms of bitrate and performance of remote graphics in comparison to VNC, Microsoft Remote Desktop uses a proprietary software based graphics driver that does not support all of the NVIDIA GPU accelerated capabilities, and does not enable the NVIDIA GRID driver. Any applications running under Microsoft Remote Desktop will not be using the NVIDIA driver and will not have full benefits of GPU acceleration.

 

 

G2 In Action

Amazon has been working with technology providers to lay the groundwork for the G2 instances. Here’s what they have to offer:

  • Autodesk Inventor, Revit, Maya, and 3ds Max 3D design tools can now be accessed from a web browser. Developers can now access full-fledged 3D design, engineering, and entertainment work without the need for a top-end desktop computer (this is an industry first!).
  • OTOY’s ORBX.js is a pure JavaScript framework that allows you to stream 3D application to thin clients and to any HTML5 browser without plug-ins, codecs, or client-side software installation.
  • The Agawi True Cloud application streaming platform now takes advantage of the g2 instance type. It can be used to stream graphically rich, interactive applications to mobile devices.
  • The Playcast Media AAA cloud gaming service has been deployed to a fleet of g2 instances and will soon be used to stream video games for consumer-facing media brands.
  • The Calgary Scientific ResolutionMD application for visualization of medical imaging data can now be run on g2 instances.  The PureWeb SDK can be used to build applications that run on g2 instances and render on any mobile device.

Here are some Marketplace products to get you started:

 

 

 

Let’s get started

Use an existing AMI

To simplify the startup process, NVidia has put together AMIs for Windows and Amazon Linux and has made them available in the AWS Marketplace:

or

Create your own Instance

View your current drivers version

When you launched a new G2 Instance, the GPU drivers are not installed by default.

Download GLview, to view the current version.

              opengl01

Microsoft Windows ships by default with OpenGL v1.1 drivers.
https://www.opengl.org/documentation/implementations/

 

 

Install latest NVIDIA drivers

Go to the NVIDIA website to download the latest drivers:
http://www.nvidia.com/Download/index.aspx

 

Choose option 2:

image5

image6

image7

 

There is no Current Version:
image8

image9

Reboot windows
image10

 

Disable the build in Adapter

Open ‘Computer Management’ and disable the ‘Microsoft Basic Display Adapter’.
Computermanagement

Reboot the server.

 

Install  Features

Media Foundation Package and Quality Windows Audio Video Experience

Media Foundation components in Windows Server 2012 need to be installed.
Start the Server Manager, then click the Add roles and features link in the Welcome Tile. If you closed the Welcome Tile, make it visible again via the View menu or in the left panel navigate to Local Server. In the right panel scroll all the way down to Roles and Features, click the Tasks dropdown and choose Add Roles and Features.

qWave is a QoS software modules for running on qWave-enabled devices for Audio/Video Streaming over networks. Designed for handling Audio and Video, you can find out more details about this module by clicking here. Click on Start, open a console window and then type inside the window.

Features

Reboot the server.

 

Connect trough RDP

When you connect trough RDP and start GLview, you will see the same driver version v1.1, as before the installation of the drivers.
Any applications running under Microsoft Remote Desktop will not be using the NVIDIA driver

Also when you try to start the NVIDIA Control Panel, you receive an error.

image11

 

 

Connect to the desktop

We have to use another Remote Desktop Tool to use the NVIDIA GRID.
There are many Remote connection tools, but for best performance we will install Teamviewer.

Which Remote Desktop solution is recommended?

 

Check the local firewall to allow Teamviewer

Teamviewer will add items by default to your windows firewall, but if you use other software, check the local windows firewall to allow the incoming connection.

image13

 

Check the AWS Inbound Security Group to allow Teamviewer

Check your Security Group for Inbound connections, to allow the port where your service is running on.

For example, Teamviewer will try to connect on port 80 or 443 or 5938

SecurityGroup

 

Setup Teamviewer

Login with an RDP session. Download Teamviewer and start the installation.

Be sure to select the unattended option.

teamviewer-02

teamviewer-03b

You have to create an account if you would like to access your server unattended.

teamviewer-04b

teamviewer-05

Because we installed Teamviewer with the unattended option, the ‘Start Teamviewer with Windows’ is selected.
To access your server with Teamviewer as a service, assign this server to your account.

teamviewer-10

Now you see that the computer name and not the ID is visible on your other computer.

teamviewer-12    teamviewer-13

 

 

 

Connect to the desktop with Teamviewer

teamviewer-11

Now you can open the NVIDIA Control Panel from Teamviewer.
Computermanagement2

And you can see the correct Renderer:
image15

 

Use your 3D application or streaming application

Now your application can make use of the NVIDIA compute capability.

 

 

Game Setup

Enable H.264 video encoding

The GRID cards can offload the H.264 video encoding to the GPU. Sign up for a developer account with NVidia. Download and extract the GRID SDK. In the bin directory run the following: NvFBCEnable.exe -enable -noreset

and reboot.

NvFBCEnable

 

Enable Audio

Start the Windows Audio Service and set the startup type to Automatic.

audio

 

Install virtual soundcard

You can install Razer Surround to get a virtual soundcard.

razersurround

 

Play your Game

Try a game on the virtual server or stream it to your desktop, laptop, other.

 

Game Benchmark

I have tried the Unigine Heaven Benchmark

benchmark01

benchmark03

benchmark02

You can find other free Benchmarks here:
http://www.ozone3d.net/index_softwares.php

benchmark04

 

 

 

 

Automatic login for Windows Server 2012 R2

Option 1: netplwiz.exe

Use the netplwiz.exe app that comes standard with 2012. Search for the app through the start menu, or travel to C:\Windows\System32 to find it.
The password is not stored in clear text in the registry when you do it this way.

Untitled

 

Option 2: sysinternals autologon

https://technet.microsoft.com/en-us/sysinternals/autologon

Autologin

 

Option 3: Registry or GPO

Enable AutoLogon

Key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Value: AutoAdminLogon (REG_SZ)
Data: 1 (Enabled)

Default Domain Name

Key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Value: DefaultDomainName (REG_SZ)
Data: DOMAINNAME

Default User Name

Key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Value: DefaultUserName (REG_SZ)
Data: USERNAME

Default Password

Key: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
Value: DefaultPassword (REG_SZ)
Data: PASSWORD

Warning: In option 2 and 3, be sure to also block the regedit tool onto this computer as anyone logged on the computer will be able to see the account password stored in the registry as clear text

Comments (2)

  1. When connected through TeamViewer, DxDiag reports no graphics cards.
    When Connected through Microsoft Remote Desktop. DxDiag correctly reports the GRID card.

    Do you see this behavior as well?

    • Stijn Van Renterghem

      Hi Dave,

      I have configured a new setup and when I’m connected through RDP (with or without admin session) the GRID card is not displayed. When I connect with Teamviewer or TightVNC the GRID card is visible.

      Regards,
      Stijn

Leave a Reply

Your email address will not be published. Required fields are marked *