SEF9 - 57 Programming Concepts Lesson 06 (Simple parallel programming in C)

This C-program is a parallel program that uses the Message Passing Interface (MPI) library. It computes the value of PI based on the area of a quardant of the unit circle. Area of circle = pi*radius*radius. If radius = 1, then area of circle = pi. The area of a quadrant of the circle is pi/4. If we can calculate the area of a quadrant for a unit circle, then we can get the value of pi, which is just the area of the quadrant multiplied by 4. Ha ha ha.

============================================
Tutorial Learning points and Discussions
============================================

(1) All calculations using floating point representation of real numbers are approximate, because real numbers cannot be exactly represented in floating point representations. The real numbers are rounded up or rounded down to their closest floating point representations.

(2) Floating point computations accumulate their approximation errors. We have to minimize computations by seeking the minimum number of mathematical operations needed to achieve the same computation, because each mathematical operation will introduce an approximation error.

(3) Think of the "Python programming” (Decimal data type) for obvious reasons of course. And even in python, to avoid errors in numerical computations, do not forget to do “Error Trappings”. There is no overflow using Decimal datatype in Python.

(4) Know exactly what you are doing, what you are calculating. Know what input ranges you intend to run in your program, trap anything outside these ranges. Know the intermediate calculated ranges that you are expecting for correct operations, again trap anything outside these expected ranges. Know the output results that you expect in your program, again trap anything outside these expected output ranges.

(5) Parallel computing allows many computations to be conducted simultaneously. It provides speedup, i.e. give results faster. However, the considerations are different between serial programs and parallel programs, and are to be handled differently.


--
WASSALAM
wruslan.hahaha

Attached is the c-program lesson-06.c for MPI.

Attachments:
SEF-Example-parallel-programming-in-C-using-MPI.pdf
lesson-06.c

Full Version with Microsoft Word Version and Attachments
Return to Software Engineering Fundamentals (SEF9MMUWRY)
Previous Topic: 56 Programming Concepts Lesson 05 (Avoiding overflow using Python Decimal datatype)
Next Topic: 58 Software Quality (Process, Product and Coding Standards)

0 comments:

Post a Comment