================================
Platform setup with Amazon Linux
================================

Amazon Linux EC2 GPU Instance
=============================

These steps have been tested using the AMI available for download here: `Amazon Linux AMI with NVIDIA GRID GPU Driver <https://aws.amazon.com/marketplace/pp/B00FYCDDTE>`_.

After spawning a copy of the AMI, issue the following commands to configure the environment::

	# Update available packages:
	sudo yum update

	# Install openGL required libraries:
	sudo yum groupinstall "Development Tools" "Development Libraries"  "X Software Development"
	sudo yum install libGL
	sudo yum install libGLU
	sudo yum install glx-utils

	# Download NVIDIA Linux Driver: 
	wget http://us.download.nvidia.com/XFree86/Linux-x86_64/346.35/NVIDIA-Linux-x86_64-346.35.run

	# Make the Driver Executable Runnable
	chmod +x NVIDIA-Linux-x86_64-346.35.run

	# Install The NVIDIA Driver
	sudo ./NVIDIA-Linux-x86_64-346.35.run
	# Accept License terms and answer yes to all prompts

	# Generate custom nvidia x config file for use on this platform
	sudo nvidia-xconfig -a --use-display-device=None --virtual=1280x1024

	# Get bus id of the GPU device. and confirm that it is "0:3:0"
	# string will be something similar to: 00:03.0 VGA compatible controller [0300]: NVIDIA Corporation GK104GL [GRID K520] [10de:118a] (rev a1)
	lspci -nn | grep VGA 

	# locate a "Device" Section with BoardName set to "GRID K520"
	# add the BusId parameter to it eg: 
	# BusID          "0:3:0"
	sudo nano /etc/X11/xorg.conf

	# start x server
	sudo /usr/bin/X :0 &

	# set the DISPLAY environment variable
	export DISPLAY=:0.0

Sample x.org configuration file: `xorg-ubuntu-server-sample.conf <../../_assets/files/xorg-ubuntu-server-sample.conf>`_.
