Back
Uncategorized

Julia Set using Parallel Programming Techniques

Julia Set using Parallel Programming Techniques.

Description Creating the Julia Set using Parallel Programming Techniques ( Visual Studio 2017) 3 sets of codes to show the Julia Set using Visual Studio 2017 (no other versions) has to be 2017. A report no more than 1800 words. A well written, functional serial version of the implementation is also given. A detailed test plan and discussion are given in the report, with an excellent in-depth analysis of the results obtained and scalability of the given solution. In this you are supposed to choose one of the Julia set shapes from the website below. https://en.wikipedia.org/wiki/Julia_set You are required to develop 3 implementations of the Julia Set (i) a sequential version, (ii) a version using Intel’s Threading Building Blocks (TBB) library and (iii) a version using OpenCL. Your implementation should generate a 2D image of the Julia Set. 2.1. Background The colour of each pixel is determined by the simple equation zk+1 = zk 2 + C where Z and C are like 2D points, both with (x, y) values. The value of C is constant for all pixels but each pixel is given a different initial value for Z based on the pixel’s position in the image. The above equation is calculated for every pixel within a loop. In each iteration of the loop, Z is updated according to the above equation. This creates a sequence of values for Z called the orbit, or dwell of Z. For example, for a given pixel we start with a value of Z = z0 then the next 4 values of Z are calculated as follows… z0 (Initial value of Z) z1 = z0 2 + C (Z now equals z1 after 1st iteration) z2 = z1 2 + C (Z now equals z2 after 2nd iteration) z3 = z2 2 + C (Z now equals z3 after 3rd iteration) z4 = z3 2 + C (Z now equals z4 after 4th iteration) For each new value of Z, we calculate its length. If this is greater than 2.0 then we exit the loop and use the number of iterations from the loop to calculate the colour of the pixel. This can be done by accessing an array of colour values for example. If the length of Z is never greater than 2.0 (it has a ‘stable’ orbit) then the loop could go on forever, so the loop has a pre-defined maximum number of iterations. If the loop exits by reaching this maximum number of iterations, then we colour the pixel black. This process is summed up in the following pseudo-code… Calculate initial value for Z based on position of current pixel C is a given constant value For k = 0 to MAX_ITERATIONS { Z = Z * Z + C; If (length(Z) > 2.0) Break out of loop } If (k < MAX_ITERATIONS) Pixel Colour = Colours[k] Else Pixel Colour = Black The image plane (x, y) is actually a complex plane and Z and C are complex numbers. Complex numbers are like 2D points (with x and y values as noted above, but we refer to x as the real value and y as the imaginary value), but the rules for multiplying complex numbers are different. Multiplying “real” numbers (as you’ve done in maths before) simply scales the number along the “number line”, that is, the real axis. However, multiplying complex numbers (2D points on the plane) actually rotates the points in the plane as well as scales their position. For this assignment you need to make use of three complex operators – addition, multiplication and length. For complex numbers A = (A.x, A.y) and B = (B.x, B.y) the addition, multiplication and length functions are defined as… Addition: A + B = (A.x + B.x, A.y + B.y) Multiplication: A * B = (A.x * B.x – A.y * B.y, A.y* B.x + A.x* B.y) Length: length(A) = ||A|| = sqrt(A.x * A.x + A.y * A.y) Hint: You can substitute A and B in the above examples for Z and C in the main code. 2.2. Tasks 1. Implement a sequential version of the Julia Set as described above. 2. Using Intel’s Threading Building Blocks create a version of the Julia Set as described above. As part of your implementation you are required to setup the relevant resources and implement the above pseudo-code as a TBB kernel. 3. Using OpenCL, create a version of the Julia Set as described above. As part of your implementation you are required to setup the relevant resources and implement the above pseudo-code as an OpenCL kernel. 4. Write a report documenting a test plan and the results obtained. For your test plan, consider the different variables that can be changed and test against these. As part of your report, test both the sequential, TBB and OpenCL versions as well as the scalability of your solution. The report should be word processed and no longer than 1800 words. References and citations to material you research should be included where relevant.

Julia Set using Parallel Programming Techniques