/GPU_Course-assignment

In total, there are 3 assignments for this course. The first assignment is writing a CUDA program containing a kernel “arradd”, that adds a number X to all elements of a one-dimensional array A. The elements of A and X should be single precision floating-point numbers (float). The elements of A should be initialized so that A[i] = i / 3.0f; Have your program vary the number of elements in A from 1 Million to MIN(maximum number that can be supported by single invocation of a GPU kernel, 256 Million) in power of two steps, i.e., 1M, 2M, 4M, 8M, 16M, etc. For every different array size, have your program print three time measurements: the time required to copy A from the CPU to the GPU, the time taken by the kernel, and the time required to copy the data from the GPU to the CPU. Use the event timer calls to measure these intervals. The second assignment is writing a CUDA program that finds the maximum or the minimum among the elements of an array of N integers, and try to optimize the program for speed as much as possible. The third assignment is writing a filter for a BMP image. The image will be provided as a two dimensional array of bytes. Each pixel is represented by three consecutive bytes for three color channels (Red, Green, Blue), each with a value from 0 to 255. To get the blur effect the value of each output pixel will be determined by the corresponding input pixel value plus all neighboring pixel values. The neighboring pixels are the ones that locate within a fixed RADIUS of the target pixel. For example, if we want to calculate the output value for a pixel when RADIUS is 2, we need a 5x5 block of pixels of the image with the target pixel in center. Following shows a sample 5x5 block of pixels that are required to compute the final value for the center pixel (pixel with values [46,47,48]). Note that representing a pixel by "[x,y,z]" means that the pixel has a value of x, y, and z for its red, green, and blue channels, respectively.

Primary LanguageCuda

Stargazers