$24
• 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:
2
zk+1 = zk + c
when zk+1 is the (k + 1) th iteration of the complex number z = a + bi and is a complex number giving
the position of the point in the complex plan. (For example, in a image of height and width ,
x−height /2
y−width /2
c = height/4
+ width/4 × i. You can also scale the to obtain a different output).
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 = √ 2 + 2
2
Computing the complex function zk+1 = zk + c is simplfied by recognizing that:
z2 = 2 + 2abi + b 2 = 2 − 2 + 2abi
Therefore, real part is the 2 − 2 while the imaginary part is . The next iteration values can be
produced by computing:
2 2
• real = zreal − zimag + real zimag = 2zreal zimag + imag
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).
• 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.
fle:///Users/apple/Desktop/courses/Submit 4180/assign2.html 1/2
2021/10/15 上午11:27 assign2.md
• 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.
• 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.)
• You should start your homework as soon as possible, do not try to finish it in the last two days before
the deadline.
• 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.
• Late submission penalty, 5 points deduction for each 12 hours after the deadline.
• Due:
23 59,11/1/2021
fle:///Users/apple/Desktop/courses/Submit 4180/assign2.html 2/2