Build and Install latest OpenCV with CUDA 6.5 on an AWS GPU instance with Ubuntu 14.04

Directions for installing Cuda 6.5 on AWS GPU Instance is here: http://tleyden.github.io/blog/2014/10/25/cuda-6-dot-5-on-aws-gpu-instance-running-ubuntu-14-dot-04/

Install all the necessary packages to build opencv:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential git cmake cmake-curses-gui zlib1g-dev libeigen3-dev

sudo apt-get install checkinstall pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils

Make the necessary source and build folders:
(I assume you are using bash here)
export todaysdate=`date "+%Y%m%d"`
mkdir opencvsrc$todaysdate
mkdir opencvbld$todaysdate

Download the opencv source:
cd opencvsrc$todaysdate
git clone https://github.com/Itseez/opencv.git

Go into the build directory and use ccmake to configure your build.
cd ../opencvbld$todaysdate
ccmake ../opencvsrc$todaysdate/opencv

Hit ‘c’ to configure and then change these variables by moving to that line and hitting Enter.

BUILD_EXAMPLES ON
INSTALL_C_EXAMPLES ON
INSTALL_TESTS ON
WITH_NVCUVID ON

Hit ‘c’ to configure
Hit ‘g’ to generate

Now build and install opencv.
make
sudo make install

For getting test data and running tests on that data do this:
cd
git clone git://github.com/Itseez/opencv_extra.git
export OPENCV_TEST_DATA_PATH=/home/ubuntu/opencv_extra/testdata/
/usr/local/bin/opencv_test_video

Lots of tests are in /usr/local/bin

If you just want to use my public AMI with the OpenCV source from March 25,2015 it is here (for US-East): ami-fa200b92