Run this for some combinations of trials and threads. Do timing for each combination.
Like we talked about in the Project Notes, run each experiment some number of tries,
NUMTIMES, and record just the peak performance.
Do a table and two graphs. The two graphs need to be:
1. Performance versus the number of Monte Carlo trials, with the colored lines
being the number of OpenMP threads.
2. Performance versus the number OpenMP threads, with the colored lines being
the number of Monte Carlo trials..
(See the Project Notes, Scripting, Graphing, and Pivot Tables to see an example of
this and how to get Excel to do most of the work for you.)
Chosing one of the runs (one of the ones with the maximum number of trials would be
good), tell me what you think the actual probability is.
Compute Fp, the Parallel Fraction, for this computation.
Does a Pin Fit?
d is the distance from the (x,y) pin center to the (x,y) hole center:
float d = Length( pinx-holex, piny-holey );
A pin fits into its hole if: d+pinRadius ≤ holeRadius
All three pins must fit into their respective holes for this trial to be deemed a success.
If even one pin does not fit, this trial is a failure.
The Program Flow
The code below is printed in the handout to make it easy to look at and discuss.
Note: if you are on Windows, take the ", stderr" out of the #pragma line!
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
// print debugging messages?
#ifndef DEBUG
#define DEBUG false
#endif
// setting the number of threads: