Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Project - OpenCL Array Multiply, Multiply-Add, and Multiply-Reduce

Introduction

There are many problems in scientific computing where you want to do arithmetic on multiple arrays of numbers (matrix manipulation, Fourier transformation, convolution, etc.). This project is in two parts:

1. Multiply two arrays together using OpenCL: D[gid] = A[gid]*B[gid];
Benchmark it against both input array size (i.e., the global work size) and the local work size (i.e., number of work-items per work-group).

2. Multiply two arrays together and add a third using OpenCL: D[gid] = A[gid]*B[gid] + C[gid];
Benchmark it against both input array size (i.e., the global work size) and the local work size (i.e., number of work-items per work-group).

3. Perform the same array multiply as in #1, but this time with a reduction: Sum = summation{ A[:]*B[:] };
Benchmark that against input array size (i.e., the global work size). You can pick a local work size and hold that constant.

Requirements:

First, work on the Array Multiply and the Array Multiply-Add portions:

1. Start with the first.cpp and first.cl files. That code already does array multiplication for one particular combination of global work size and local work size.

2. Helpful Hint: The Array Multiply and the Array Multiply-Add can really be the same program. Write one program that creates the 4 arrays. Pass A, B, and C into OpenCL, and return D. Then all you have to do between the Multiply and Multiply-Add tests is change one line in the .cl file.

3. Make this all work for global work sizes in (at least) the range 1K to 8M, and local work sizes in (at least) the range 8 to 512, or up to the maximum work-group size allowed by your system. How you do this is up to you. Use enough values in those ranges to make good graphs.

4. Use performance units that make sense. Jane Parallel used "MegaMultiplies Per Second" and "MegaMultiply-Adds Per Second".

5. Make two graphs:

  1. Multiply and Multiply-Add performance versus Global Work Size, with a series of colored Constant-Local-Work-Size curves
  2. Multiply and Multiply-Add performance versus Local Work Size, with a series of colored Constant-Global-Work-Size curves

6. Your commentary PDF should tell:

  1. What machine you ran this on
  2. Show the tables and graphs
  3. What patterns are you seeing in the performance curves?
  4. Why do you think the patterns look this way?
  5. What is the performance difference between doing a Multiply and doing a Multiply-Add?
  6. What does that mean for the proper use of GPU parallel computing?

Then, write another version of the code that turns it into a Multiply+Reduce application.

7. Note that this will ultimately compute just a single floating point scalar value.

8. Produce the product array on the GPU, and then do the reduction on it from the same kernel.

9. Return an array, the same size as the number of work-groups. Each element of the array will have the sum from all the items in one work-group. Add up the elements of the array yourself.

10. Try at last 3 different local work sizes, more if you want. Make it no smaller than 32. Make it no larger than 256.

11. Vary the size of the input array from 1K to 8M.

12. Plot another graph showing Multiply-reduction performance versus Input Array Size.

13. Use performance units that make sense. Jane Parallel used "MegaMultiply-Reductions Per Second".

14. To your PDF write-up add:

  1. Show this table and graph
  2. What pattern are you seeing in this performance curve?
  3. Why do you think the pattern looks this way?
  4. What does that mean for the proper use of GPU parallel computing?

Running OpenCL in Visual Studio

First, you will need the following files:

1. cl.h
2. cl_platform.h
3. OpenCL32.lib or OpenCL64.lib

To enable OpenMP, which you need for timing:
Project → Properties → Configuration Properties → C/C++ → Language and then change OpenMP support to "Yes (/openmp)"

To link the library:
Project → Properties → Configuration Properties → Linker → Additional Dependencies →

and then type either OpenCL32.lib or OpenCL64.lib in the box.

To make this easier, an entire Visual Studio solution has been zipped up in the file First.zip

Running OpenCL in Linux

First, you will need the following files:

1. cl.h
2. cl_platform.h
3. libOpenCL.so

If you are on rabbit, compile and link like this:
icpc -o first first.cpp -no-vec /scratch/cuda-7.0/lib64/libOpenCL.so -lm - openmp
or
g++ -o first first.cpp /scratch/cuda-7.0/lib64/libOpenCL.so -lm -fopenmp

If you are on your own system, change the library reference to whatever path your system has the library in.

Attachment:- Prog.rar

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M92314849
  • Price:- $35

Priced at Now at $35, Verified Solution

Have any Question?


Related Questions in Programming Language

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 ...

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 ...

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 ...

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 ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

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 ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

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 ...

  • 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