What patterns are you seeing in the performance

Assignment Help Programming Languages
Reference no: EM131481465

Project - False Sharing

Introduction

Cache issues can be insidious. As we discussed in class, False Sharing is a way that multicore programs can significantly lose performance even though it looks like you've done nothing wrong.

In False Sharing, two (or more) cores are writing to variables that live in the same cache line. As soon as each one writes to the cache line, it invalidates the contents of the other, requiring a time-consuming re- load.

Requirements

- You have the following multicore application:

#include <stdlib.h>

struct s
{


float value;
int pad[NUMPAD];

} Array[4];

. . .

omp_set_num_threads( NUMT );

const int SomeBigNumber = 100000000; // keep < 2B

#pragma omp parallel for for( int i = 0; i < 4; i++ )
{

unsigned int seed = 0; // automatically private for( unsigned int j = 0; j < SomeBigNumber; j++ )
{
Array[ i ].value = Array[ i ].value + (float)rand_r( &seed );
}
}

- Apply Fix #1 from the notes, i.e., pad the rest of the structure with a certain number, NUMPAD, of integers. Set NUMPAD to 0, 1, 2, 3, ..., 15 (and more if you want).

- Use a variety of numbers of threads. At least use 1, 2, and 4. You can use more if you'd like.

- If you are doing this from a script, note that: int pad[NUMPAD]; is a legal C statement, even when NUMPAD is #define'd as 0 (at least in g++). It works like you think it should, i.e., it allocates zero array elements..

- Use OpenMP's timer calls to time the length of execution. As always, change that elapsed time into a sensible unit of performance.

- After you are done with all the Fix #1 combinations, then apply Fix #2 from the notes, i.e., accumulate the sum in a variable that is private to each thread.

- Plot, on the same set of axes, Performance vs. NUMPAD for 1 thread, 2 threads, etc.

- Plot, also on that same set of axes, horizontal lines showing what performance resulted from Fix #2. These can each just be single horizontal lines because the performance won't depend on NUMPAD.

- Your commentary write-up (turned in as a PDF file) should include:

1. Tell what machine you ran this on

2. Create a table with your results.

3. Draw a graph. The X axis will be NUMPAD, i.e., the amount of integers used to pad the structure. The Y axis will be the performance in whatever units you sensibly choose. There should be at least 6 curves shown together on those axes:
   1-3: Using padding with 1, 2, and 4 threads. (Fix #1)
   4-6: Using a private variable with 1, 2, and 4 threads. (Fix #2)

4. What patterns are you seeing in the performance?

5. Why do you think it is behaving this way?

Warning!

Turn all compiler optimization flags off. We don't want the compiler to figure out we are doing busy- work, and optimize the entire loop away.

Verified Expert

In this project, I have implemented the two fixes that are applied to False Sharing problem encountered in multi-processor environment for parallel program. The implementation is done in C++ programming language using open mp library as it provides API to set number of threads to parallelize the code. To demonstrate False Sharing I have created an array of structure variable and computed summed the array value with a random number over large number of iterations. Further to apply the fix to problem, I have padded the structure with value ranging from 0,1,2 to 15 and computed the execution time of program with these pad values with the thread count set with 1,2 and 4. From execution time, I computed the speed of execution and saved the results in table and plotted graph for it,

Reference no: EM131481465

Questions Cloud

What types of strategic choices do managers have : How can the HR department and line manager collaborate to develop an authentic environment built on trust for a virtual and global workforce?
A solution to a problem has n possible outcomes : A solution to a problem has n possible outcomes. An Algorithm to solve the problem uses a k-way decision tree of depth d.
What should be the elements of a zero-policy ethics policy : What should be the elements of a zero-policy ethics policy? What if any are missing from Siemens Global.
Loyalty and reward programs are becoming more : Loyalty/reward programs are becoming more and more prevalent. With the onset of more loyalty programs,
What patterns are you seeing in the performance : Plot, also on that same set of axes, horizontal lines showing what performance resulted from Fix #2. These can each just be single horizontal lines
Describe the long-run aggregate supply : Describe whether the following changes cause the long-run aggregate supply to increase, decrease, or neither. a. The price level increases.
Analyze the organizational structure and culture of company : Determine three (3) best practices organizational leaders can use to motivate employees and discuss their potential benefits.
Discuss the research methods one would recommend to tencent : Discuss the research methods one would recommend to Tencent, the world's largest mobile game company, to better understand US gamers and their habits.
What financial statements are impacted and how : Discuss one ACA provision and describe how it will impact healthcare finance. Specifically, what financial statements are impacted and how?

Reviews

inf1481465

5/19/2017 5:49:58 AM

I simply got a mail from my professor. I got an "A" for the work. The project I did likewise got me an A so I have An evaluation for the subject. Much thanks for all the help, your direction has helped me a considerable measure.

Write a Review

Programming Languages Questions & Answers

  Write a haskell program to calculates a balanced partition

Write a program in Haskell which calculates a balanced partition of N items where each item has a value between 0 and K such that the difference b/w the sum of the values of first partition,

  Create an application to run in the amazon ec2 service

In this project you will create an application to run in the Amazon EC2 service and you will also create a client that can run on local machine and access your application.

  Explain the process to develop a web page locally

Explain the process to develop a Web page locally

  Write functions

These 14 questions covers java class, Array, link list , generic class.

  Programming assignment

If the user wants to read the input from a file, then the output will also go into a different file . If the user wants to read the input interactively, then the output will go to the screen .

  Write a prolog program using swi proglog

Write a Prolog program using swi proglog

  Create a custom application using eclipse

Create a custom Application Using Eclipse Android Development

  Create a application using the mvc architecture

create a application using the MVC architecture. No scripting elements are allowed in JSP pages.

  Develops bespoke solutions for the rubber industry

Develops bespoke solutions for the rubber industry

  Design a program that models the worms behavior

Design a program that models the worm's behavior.

  Writing a class

Build a class for a type called Fraction

  Design a program that assigns seats on an airplane

Write a program that allows an instructor to keep a grade book and also design and implement a program that assigns seats on an airplane.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd