Cuda programming environment and c language


The purpose of this programming assignment is to familiarize yourself with some of the features of the CUDA programming environment and C language extensions that were presented in class, through a small parallel programming assignment. You may use grendel.csep.umflint.edu or other machines (having CUDA devices) that you may have access to. However, the program will be tested on grendel. You may upload the completed program on my web site, or you can simply leave it on grendel for it to be checked.

General Requirements

The specific program is actually two programs: first, a sequential version that only runs on the CPU; second, a GPU version that does as much as possible in parallel using one or more CUDA kernels or device functions. This is mainly done for comparison's sake, although you should also be able to use the CPU-only version in developing the GPU version. Insert timing functions to determine the amount of (non-file-read) time taken by each version of the program.

The function of either program is to compute some statistics on a large data set (as with program 6), which is to be read from a file. Data files for testing are provided in a zip or tar.gz file (linked in with program 6 on the programs page and also available to directly copy on grendel). The programs must compute the following values: mean, maximum, minimum, variance, and standard deviation, which should be printed out at the end of your program run. Note that the operations involved in calculating these all require at least one reduction, and the variance also requires some parallel computations suitable for a GPU.

Specific Requirements

Specific program requirements are as follows (in no particular order of importance):

Your program will accept one command-line argument specifying the name of the input file. 

Your program will output the statistics, one per line, with suitable labels. For example:
Maximum: 43,221.2
Minimum: 0.5
Mean: 1234.5
Variance: 4
Std Dev: 2


Use a "modest" number of threads and blocks so that for large data sets, there should be many more data elements than total threads. The grid dimension and block size can/should be one-dimensional. The point is that when computing something (e.g. the differences from mean for each value while computing variance), each thread should iterate through multiple data points. 

There will be up to 10 extra points awarded if you develop and use a reduction operation on the data set when computing certain values, such as maximum, minimum, mean, etc. Depending on the computation involved, it may require several reduction-type of operations. (e.g. variance). Some of these should (obviously?) be easier than others; for example, maximum and minimum are pretty much one single reduction operation each. Note that there are resources (including from NVidia) on how to program reductions in CUDA. 

Use __syncthreads() where appropriate. 

It should go without saying that standard deviation, being the square root of variance, isn't really a parallel operation. It's really just there for completeness. 

Don't assume that the the number of elements in a data set is a precise power of 2. In fact, assume it's not. 

Other Requirements

Submit a typed one-page summary of comparisons of timing of the two programs for the same input sets.

Name your main program prog07.cu. You can leave it in your home directory, where I will examine it. Otherwise, you can upload a copy of the program in a zip file, if you wish.

In your comment block to begin your main program, other than the function of the program and the variable dictionary, include a set of comments of the following format. It is very important for you to include your name, the compiler you used, the due date, and the program identity:

// Name: Joe M. Student
// Program: CSC 478/578 Program 7

Your program should follow "reasonable" rules of style, with appropriate indentation and commenting.

Other Notes

As mentioned above, data files are linked on the page along with this assignment.

Look on the code examples page for CUDA examples related to the lectures, as well as example code showing how to do timing on linux and gather command-line arguments.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Cuda programming environment and c language
Reference No:- TGS080836

Expected delivery within 24 Hours