Ask Programming Language Expert

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 ex:
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 ex, 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 exs page for CUDA exs related to the lectures, as well as ex code showing how to do timing on linux and gather command-line arguments.

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M980836

Have any Question?


Related Questions in Programming Language

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Assignment - proposal literature review research method1

Assignment - Proposal, Literature Review, Research Method 1. Abstract - Summary of the knowledge gap: problems of the existing research - Aim of the research, summary of what this project is to achieve - Summary of the a ...

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As