Link to this document's Jupyter Notebook

In order to successfully complete this assignment you must do the required reading, watch the provided videos and complete all instructions. The embedded survey form must be entirely filled out and submitted on or before 11:59pm on Tuesday February 9. Students must come to class the next day prepared to discuss the material covered in this assignment.


Pre-Class Assignment: OpenMP Threads

Goals for today's pre-class assignment

  1. OpenMP Threads
  2. Assignment wrap up

1. OpenMP Threads

Lets continue the Intel OpenMP video series and learn about Threads.

DO THIS: Watch the following video on YouTube Intel Introduction to OpenMP: 05 Module 3

QUESTION: Do some research. What are pthreads and how do they relate to OpenMP?

Put your answer to the above question here.

In the above video there is a program to solve the following integral.

$$\int{\frac{4}{1+x^2}}dx = \pi$$

DO THIS: On the HPC create a C++ file with the following contents to estimate a solution to the above equation.

static long num_steps  = 100000;
double step;
int main()
{
    int i; double x,pi,sum=0.0;
    step = 1.0/(double) num_steps;
    for (i=0;i<num_steps;i++) 
    {
        x = (i + 0.5) * step;
        sum = sum+4.0/(1.0+x*x);
    }
    pi = step * sum;
}

DO THIS: Vary the number of steps (num_steps) and try to do a timing study to show how long the serial code will take. Have your study generate two plots:

  1. The first plot is the number of steps vs the estimation of pi. Maybe include a horizontal line of the true value of pi. Or subtract the true value of pi and just plot the error.
  2. The second plot is the number of steps vs the the execution time.

Bring your plots and plot generation code to class for discussion.

DO THIS: As per the video, try to make a parallel version of the pi estimation program using OpenMP and bring this program to class. Note: Use your time wisely, this is not a graded assignment. I do expect you to make an attempt so we have something to discuss in class but I don't want you spending too much time on this assignment.


2. Assignment wrap up

Please fill out the form that appears when you run the code below. You must completely fill this out in order to receive credits for the assignment!

Direct Link to Google Form

If you have trouble with the embedded form, please make sure you log on with your MSU google account at googleapps.msu.edu and then click on the direct link above.

Assignment-Specific QUESTION: Where you able to get the OMP Pi example working? If not, where did you get stuck?

Put your answer to the above question here

QUESTION: Summarize what you did in this assignment.

Put your answer to the above question here

QUESTION: What questions do you have, if any, about any of the topics discussed in this assignment after working through the jupyter notebook?

Put your answer to the above question here

QUESTION: How well do you feel this assignment helped you to achieve a better understanding of the above mentioned topic(s)?

Put your answer to the above question here

QUESTION: What was the most challenging part of this assignment for you?

Put your answer to the above question here

QUESTION: What was the least challenging part of this assignment for you?

Put your answer to the above question here

QUESTION: What kind of additional questions or support, if any, do you feel you need to have a better understanding of the content in this assignment?

Put your answer to the above question here

QUESTION: Do you have any further questions or comments about this material, or anything else that's going on in class?

Put your answer to the above question here

QUESTION: Approximately how long did this pre-class assignment take?

Put your answer to the above question here


Congratulations, we're done!

To get credit for this assignment you must fill out and submit the above survey from on or before the assignment due date.

Course Resources:

Written by Dr. Dirk Colbry, Michigan State University Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.