Jared Barnes Chris Jackson
Originally created to calculate pixel values Each core executes the same set of instructions Mario projected onto several 2D planes
Chip is designed and manufactured by NVIDIA and AMD Card bought by consumer is manufactured by various other companies
What does image processing try to accomplish? Edit an image Detect faces in an image Find object edges in an image Anything you can imagine Too computationally intensive for a CPU? Use a GPU!
Simple changes Crop an image Recolor an image Move an image Harder changes Scale an image Compress an image Filter an image
// Iterate over all pixels in the image for( int x = 0; x < image.width; x++ ) { for( int y = 0; y < image.height; y++ ) { // Get the value of the current pixel Pixel pixel = image.getPixel(x, y); // Check that Red is more intense than Green if( pixel.red > pixel.green ) { // Check that Red is more intense than Blue if( pixel.red > pixel.blue ) { pixel.red = 0; pixel.green = 0; pixel.blue = 255; }
// Use the ID of this thread to calculate which // pixel to operate on int x = thread.Id % image.width; int y = thread.Id / image.height; // Get the value of this thread’s pixel Pixel pixel = image.getPixel(x, y); // Check that Red is more intense than Green if( pixel.red > pixel.green ) { // Check that Red is more intense than Blue if( pixel.red > pixel.blue ) { pixel.red = 0; pixel.green = 0; pixel.blue = 255; }
Compute Unified Device Architecture GPU programming language developed by NVIDIA GPUs have CUDA cores more cores = more parallel performance
Have a graphics card with an NVIDIA GPU capable of running CUDA programs Install CUDA tools and compiler for Visual Studio 2008, 2010, or 2012 Create a new CUDA project in Visual Studio
1. Parallelize VectorAdd() 2. Allocate GPU memory & copy data to it 3. Modify call to VectorAdd() to launch on GPU