Starting from:

$24.99

CSC4005 Assignment 2- Mandelbrot Set Computation Solution


Assignment2: Mandelbrot Set Computation
1 description
Set of points in a complex plane that are quasi-stable (will increase and decrease, but not exceed some limt) when computed by iterating the function:
zk+1 = z2k + c
when zk+1 is the (k + 1) th iteration of the complex number z = a + bi and c is a complex number giving the position of the point in the complex plan. (For example, in a image of height H and width W,
x− height /2 y− width /2 c = + × i. You can also scale the c to obtain a different output).
height/4 width/4
The initial value for z0 is zero. The iterations continued until the magnitude of z𝕜 is greater than a threshold or the maximum number of iterations have been achieved. For zk = a + bi. The magnitude of zk is defined below:
zk
Computing the complex function zk+1 = z2k + c is simplfied by recognizing that:
z2 = a2 + 2abi + bi2 = a2 − b2 + 2abi
Therefore, real part is the a2 − b2 while the imaginary part is 2abi. The next iteration values can be produced by computing:
zreal = z2real − z2imag + creal zimag = 2zreal zimag + cimag
You need to design your own method to partition the image and assign pixels to different threads or processes.
For visualizing the Mandelbrot Set on an image, compute z𝕜 for each pixel, if z𝕜 is quasi-stable, draw this pixel on the display using Imgui(for windows users where template is uploaded to bb) or Xlib(for mac or windows users where template is uploaded to http://www.cs.nthu.edu.tw/~ychung/homework/para_programming/seq_mandelbrot_c.htm).
2 requirement
• You need to implement two versions of the tasks, which are MPI version and a Pthread version. And hand in the codes for these two versions in two seperate code files.
• In your submit code, it should display an image with size of 800 × 800.
• Include the results in your report.
• You need to specify the command line about how to compile and run your program.
• You need to compare the performance of different implementation and configurations in your report. – The number of processes or threads used in the program
– MPI vs Sequential vs Pthread
– Size of the output images (three different sizes ranging from small, medium to large) – More if you have
• You need to include two figures describing the structure of your MPI program and Pthread program.
• The report should be in appropriate format, with a title page, introduction session to introduce the basic problem and task, method session to describe your parallel implementation, result session to compare performance under different configurations, and a conclusion session which concludes your experiment results. 3 Tips
• When measuring the running time of the program, make sure only measure the computation time. (Because Imguiʼs or xlib's drawing are time consuming.)
• Debug your program on the VM that is built on the image centos. Make sure the program is OK, only after then measure the running time of the program on the server.
• Make sure use ‘sbatchʼ command to submit your jobs onto the master machine, do not directly run your program on the master machine.
• Try to limit your program running time within 60 seconds. If your program is running slow, try to improve your code or reduce the imageʼs size.
4 Where and What to Turn in Your Homework
• Please turn in a zip file includes
– Report – codes
• zip your source codes and paper in a zip file, and name it studentID.zip, then submit it on Black board.
file:///Users/apple/Desktop/courses/Submit 4180/assign2.html 2/2

More products