From: W. Trevor King Date: Tue, 14 Sep 2010 14:28:29 +0000 (-0400) Subject: Convert monte_carlo_integration.pdf assigment to XHTML. X-Git-Url: http://git.tremily.us/?p=parallel_computing.git;a=commitdiff_plain;h=30eb6da0863ade939180d919be2ebfa6098746c4 Convert monte_carlo_integration.pdf assigment to XHTML. --- diff --git a/assignments/archive/monte_carlo_integration.pdf/assigment.pdf b/assignments/archive/monte_carlo_integration.pdf/assigment.pdf deleted file mode 100644 index 93e1845..0000000 Binary files a/assignments/archive/monte_carlo_integration.pdf/assigment.pdf and /dev/null differ diff --git a/assignments/archive/monte_carlo_integration/index.shtml b/assignments/archive/monte_carlo_integration/index.shtml index df4eec4..e0ef591 100644 --- a/assignments/archive/monte_carlo_integration/index.shtml +++ b/assignments/archive/monte_carlo_integration/index.shtml @@ -1,67 +1,35 @@ -

Assignment #4

-

Due Friday, November 2, 2007

+

Assignment #5

+

Due Friday, October 30, 2009

Purpose

-

To learn how to implement truly parallel algorithms.

+

Learn how to implement a master-slave parallel algorithm.

-

Setup

+

Note: Please identify all your work.

-

This assignment consists in implementing a Monte Carlo integral in -parallel. The integral to perform is

+

This assignment consists in rewriting the code performing the +Monte-Carlo integral of the Gaussian function (see the web pages) in a +master-slave algorithm.

-$ I = \int dx \int dy (x^2+y^2) e^{ - (x^2+y^2) } $ +

Write the code so that the process 0 should only administer the +calculation (i.e., take charge of the interface with the user, decide +on the # random steps to be taken by each slave node, and perform the +final Monte-Carlo sums from the sub-sums). The slave processes, +processes 1 to size-1, should generate the +random walk steps and perform the Monte-Carlo sub-sums.

-

This integral was coded in a parallel Master-Slave model in the -course notes /content/Monte_Carlo/index.html#Guided">Guided -Monte Carlo Integral.

+

Make sure that your code:

-

You are now to code this integral in a balanced model in which you -will assign a pre-determined amount of work to each processor. In this -model, all nodes will scan an equal amount of random Monte Carlo steps -and perform local sums. Process 0 will wrap up the calculation, -thereby producing a slight load unbalance.

- -

To do

- -

Part A

- -

Build the code to do the integral. Start from the -program /content/Monte_Carlo/codes/Metropolis_Gaussian_Integral.c">Metropolis_Gaussian_Integral.c -as a guide to what is to be done. Your code should have the same -functionality as this skeleton serial code.

- -

Use a "stride" method to select which Monte Carlo steps to perform -on each node. Namely, generate the entire sequence of steps on each -nodes and use only the ones with a stride given by the rank of the -process. For instance, on a 4 processes run, process 0 will use steps -0, 4, 8, ...

- -

Use the programs /content/Monte_Carlo/codes/Metropolis_Gaussian_Parallel.c">Metropolis_Gaussian_Parallel.c -and /content/Monte_Carlo/codes/Metropolis_CS.c">Metropolis_CS.c -as examples of parallel codes for this problem.

- -

Part B

- -

The value of the integral should be independent of the initial -position used in generating the random walk. To achieve this it is -often suggested to thermalize the initial position of the -random walk. This implies run the code over few (often hundreds or -thousands) random steps for nothing, i.e., without -accumulating statistics, before accumulating the sums to calculate the -average of f(x) and its variance.

- -

Adapt your parallel code to perform this -thermalization of the initial conditions. Your code -should prompt the user for the number of thermalization -steps (could be 0!).

+ diff --git a/assignments/archive/monte_carlo_integration/index.shtml.2007.11.shtml b/assignments/archive/monte_carlo_integration/index.shtml.2007.11.shtml new file mode 100644 index 0000000..df4eec4 --- /dev/null +++ b/assignments/archive/monte_carlo_integration/index.shtml.2007.11.shtml @@ -0,0 +1,67 @@ + + +

Assignment #4

+

Due Friday, November 2, 2007

+ +

Purpose

+ +

To learn how to implement truly parallel algorithms.

+ +

Setup

+ +

This assignment consists in implementing a Monte Carlo integral in +parallel. The integral to perform is

+ +$ I = \int dx \int dy (x^2+y^2) e^{ - (x^2+y^2) } $ + +

This integral was coded in a parallel Master-Slave model in the +course notes /content/Monte_Carlo/index.html#Guided">Guided +Monte Carlo Integral.

+ +

You are now to code this integral in a balanced model in which you +will assign a pre-determined amount of work to each processor. In this +model, all nodes will scan an equal amount of random Monte Carlo steps +and perform local sums. Process 0 will wrap up the calculation, +thereby producing a slight load unbalance.

+ +

To do

+ +

Part A

+ +

Build the code to do the integral. Start from the +program /content/Monte_Carlo/codes/Metropolis_Gaussian_Integral.c">Metropolis_Gaussian_Integral.c +as a guide to what is to be done. Your code should have the same +functionality as this skeleton serial code.

+ +

Use a "stride" method to select which Monte Carlo steps to perform +on each node. Namely, generate the entire sequence of steps on each +nodes and use only the ones with a stride given by the rank of the +process. For instance, on a 4 processes run, process 0 will use steps +0, 4, 8, ...

+ +

Use the programs /content/Monte_Carlo/codes/Metropolis_Gaussian_Parallel.c">Metropolis_Gaussian_Parallel.c +and /content/Monte_Carlo/codes/Metropolis_CS.c">Metropolis_CS.c +as examples of parallel codes for this problem.

+ +

Part B

+ +

The value of the integral should be independent of the initial +position used in generating the random walk. To achieve this it is +often suggested to thermalize the initial position of the +random walk. This implies run the code over few (often hundreds or +thousands) random steps for nothing, i.e., without +accumulating statistics, before accumulating the sums to calculate the +average of f(x) and its variance.

+ +

Adapt your parallel code to perform this +thermalization of the initial conditions. Your code +should prompt the user for the number of thermalization +steps (could be 0!).

+ + diff --git a/assignments/current/5 b/assignments/current/5 index 659817b..802b16c 120000 --- a/assignments/current/5 +++ b/assignments/current/5 @@ -1 +1 @@ -../archive/monte_carlo_integration.pdf/ \ No newline at end of file +../archive/monte_carlo_integration/ \ No newline at end of file diff --git a/assignments/index.shtml b/assignments/index.shtml index 4d01dc3..eb057db 100644 --- a/assignments/index.shtml +++ b/assignments/index.shtml @@ -7,7 +7,7 @@
  • Assignment 2
  • Assignment 3
  • Assignment 4
  • -
  • Assignment 5
  • +
  • Assignment 5
  • Assignment 6
  • Assignment 7
  • Assignment 8