Workshare Process of Thread Programming and MPI Model on Multicore Architecture

Comparison between OpenMP for thread programming model and MPI for message passing programming model will be conducted on multicore shared memory machine architectures in order to find which has a better performance in terms of speed and throughput. Application used to assess the scalability of the evaluated parallel programming solutions is matrix multiplication with customizable matrix dimension. Many research done on a large scale parallel computing which using high scale benchmark such as NSA Parallel Benchmark (NPB) for their testing standardization [2]. This research will be conducted on a small scale parallel computing that emphasize more on the performance evaluation between MPI and OpenMP parallel programming model using self created benchmark. It also describes how workshare processes done on different parallel programming model. It gives comparative result between message passing and shared memory programming model in runtime and amount of throughput. Testing methodology also simple and has high usability on the available resources. Keywords-MPI; OpenMP; SMP; Multicore; Multithreading.


INTRODUCTION
The growth of multicore processors has increased the need for parallel programs on the largest to the smallest of systems (clusters to laptops).There are many ways to express parallelism in a program.In HPC (High Performance Computing), the MPI (Message Passing Interface) has been the main tool for parallel message passing programming model of most programmers [1,3].
A multi-core processor looks the same as a multi-socket single-core server to the operating system.(i.e.before multicore, dual socket servers provided two processors like today's dual core processors) Programming in this environment is essentially a mater of using POSIX threads.Thread programming can be difficult and error prone.OpenMP was developed to give programmers a higher level of abstraction and make thread programming easier.Accordance to multicore trend growth, parallel programming using OpenMP gains popularity between HPC developers.Together with the growth of thread programming model on shared memory machines, MPI which has been intended for parallel distributed systems since MPI-1, also has improved to support shared memory systems.The principal MPI-1 model has no shared memory concept, and MPI-2 has only a limited distributed shared memory concept.Nonetheless, MPI programs are regularly run on shared memory computers.MPI performance for shared memory systems will be tested on cluster of shared memory machines.OpenMP will be used as a reference on the same multicore systems with MPI clusters (both MPI and OpenMP will have an equal amount of core workes) [2].
Application used as a testing is N×N rectangular matrix multiplication with adjustable matrix dimension N ranging from 10 to 2000.For OpenMP, a single multicore machine with two worker cores will be used to calculate the matrix.For the MPI, two multicore machines with three worker cores will be used (one as a master process who decompose the matrix to sub -matrix and distribute it to two other worker process and compose the final result matrix from the sub -matrix multiplication done by its two worker process).
Parameter results which can be obtained from this test are amount of floating point operation per second (FLOPS) which in this case is matrix multiplication, Program Running Time, and Speedup.For MPI, two machines are used for testing having quite similar performance (Memory and CPU performance).MPI testing is done via LAN cable medium transmission to achieve best run time performance and minimizing time communication between processes.
There is already related research topic in this area.One of them did the testing by using certain parallel benchmark such as NAS Parallel benchmark (NPB) to standardize the evaluation on large clusters and ten to hundreds of CPU cores [2], which can produce large speedup and throughput.This research is simpler compared than the previous research which uses tens or hundreds machine resources and complicated benchmark.This research focused on how does different parallel programming model can affect the program performance.Testing in this research done by using a self created benchmark which counts the program running time and matrix multiplication operation per second.This research describes how workshare processes done on different parallel programming model.This research gives comparative result between message passing and shared memory programming model in runtime and amount of throughput.Testing methodology also simple and has high usability on the available resources.

Problem covered in this research are:
 How does different parallel programming model influence parallel performance on different memory architecture?www.ijacsa.thesai.org How does workshare construct differ between shared and distributed shared memory systems?
Objectives of this research are:  Evaluating parallel performance between thread and message passing programming model.
 Evaluating parallel algorithm workshare between threads and message passing programming model.
Testing experiment conducted on a single multicore shared memory machine which consist of two cores for thread programming model (OpenMP).And two identical multicore shared memory machines with two cores on each machine for message passing programming model without expressing thread safety level.Matrix Multiplication Program used for testing also has a limited dimension which is 2000, because of the machine power limitation.Testing parameters generated are amount of floating point operation per second (FLOPS) which in this case is matrix multiplication, Program Running Time, and Speedup.

II. FUNDAMENTAL THEORY
Parallel computing is a form of computation in which many calculations are carried out simultaneously, operating on the principle that large problems can often be divided into smaller ones, which are then solved concurrently ("in parallel").Parallel computing is done by a certain amount of parallel computers.Each of parallel computer may has different CPU core and memory architecture Parallel computers can be roughly classified according to the level at which the hardware supports parallelism.Currently there are three types which are shared memory (which usually has multiple core processor), distributed memory (clusters, MPPs, and grids), and Distributed shared memory (cluster of Shared memory systems).

A. Shared Memory Systems
In computer hardware, shared memory refers to a (typically) large block of random access memory that can be accessed by several different central processing units (CPUs) in a multiple-processor computer system.A shared-memory parallel computer whose individual processors share memory (and I/O) in such a way that each of them can access any memory location with the same speed; that is, they have a uniform memory access (UMA) time.Each of individual processor in shared memory system has a small and fast private cache memory.Cache memory used to supply each core processor with data and instruction at high rates.This is because fetching data done from processor to main memory directly is slower than fetching it from cache memory.
The issue with shared memory systems is that many CPUs need fast access to memory and will likely cache memory [4], which has two complications:  CPU-to-memory connection becomes a bottleneck.
Shared memory computers cannot scale very well.Most of them have ten or fewer processors.
 Cache coherence: Whenever one cache is updated with information that may be used by other processors, the change needs to be reflected to the other processors; otherwise the different processors will be working with incoherent data.Such coherence protocols can, when they work well, provide extremely high-performance access to shared information between multiple processors.On the other hand they can sometimes become overloaded and become a bottleneck to performance.
However, to avoid memory inconsistency as already mentioned above, there is a cache memory which can be shared to all processor.Shared cache memory can be used for each core processor to write and read data.

B. Distributed Memory
In computer science, distributed memory refers to a multiple-processor computer system in which each processor has its own private memory.In other words each processor will resides on different computer machine.Computational tasks can only operate on local data, and if remote data is required, the computational task must communicate with one or more remote processors [5].In a distributed memory system there is typically a processor, a memory, and some form of interconnection that allows programs on each processor to interact with each other.The interconnection can be organized with point to point links or separate hardware can provide a switching network.The network topology is a key factor in determining how the multi-processor machine scales.The links between nodes can be implemented using some standard network protocol (for example Ethernet), etc. Figure .2shows distributed memory systems architecture.
In contrast, a shared memory multi processor offers a single memory space used by all processors.Processors do not have to be aware where data resides, except that there may be performance penalties, and that race conditions are to be avoided.www.ijacsa.thesai.org

C. Distributed Shared Memory
Distributed Shared Memory (DSM), also known as a distributed global address space (DGAS), is a term in computer science that refers to a wide class of software and hardware implementations, in which each node of a cluster has access to shared memory in addition to each node's non-shared private memory.The shared memory component is usually a cache coherent SMP machine.Processors on a given SMP can address that machine's memory as global.The distributed memory component is the networking of multiple SMPs.The SMPs know only about their own memory -not the memory on another SMP.Therefore, network communications are required to move data from one SMP to another.Figure .3describes about distributed shared memory.

D. Parallel Programming Models
All of those parallel hardware classifications need programming language which has a capability to share or divided the work among processors.Concurrent programming languages, libraries, APIs, and parallel programming models have been created for programming parallel computers.These can generally be divided into classes based on the assumptions they make about the underlying memory architecture which are shared memory, distributed memory, or shared distributed memory [6].A parallel programming model is a set of software technologies to express parallel algorithms and match applications with the underlying parallel systems.It encloses the areas of applications, programming languages, compilers, libraries, communications systems, and parallel I/O.
Parallel models are implemented in several ways: as libraries invoked from traditional sequential languages, as language extensions, or complete new execution models.They are also roughly categorized for two kinds of systems: sharedmemory system and distributed-memory system, though the lines between them are largely blurred nowadays.
Shared memory programming languages communicate by manipulating shared memory variables through threads.Threads used as subtasks which carry instruction process to one / more core processor.However, one thread only can carry one instructions process at a certain time.In other words, multiple threads can carry multiple instruction process Distributed memory uses message passing.POSIX Threads and OpenMP are two of most widely used shared memory APIs, whereas Message Passing Interface (MPI) is the most widely used message-passing system API.Shared memory systems use threads whereas distributed memory systems use message passing task and communication carried out by message passing over network transmission.A programming model is usually judged by its expressibility and simplicity, which are by all means conflicting factors.The ultimate goal is to improve productivity of programming.

1) OpenMP
OpenMP (Open Multi-Processing) is an application programming interface (API) that supports multi-platform shared memory multiprocessing programming in C, C++ and FORTRAN on much architecture, including UNIX and Microsoft Windows platforms.It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior [7].OpenMP is an implementation of multithreading, a method of parallelization whereby the master "thread" (a series of instructions executed consecutively) "forks" a specified number of slave "threads" and a task is divided among them.The threads then run concurrently, with the runtime environment allocating threads to different processors.Hence, OpenMP is one of thread based parallel programming which will be used in this research.OpenMP uses pragma directives to express parallelism in the code block.Parts of the program that are not enclosed by a parallel construct will be executed serially.When a thread encounters this construct, a team of threads is created to execute the associated parallel region, which is the code dynamically contained within the parallel construct.But although this construct ensures that computations are performed in parallel, it does not distribute the work of the region among the threads in a team.In fact, if the programmer www.ijacsa.thesai.orgdoes not use the appropriate syntax to specify this action, the work will be replicated.At the end of a parallel region, there is an implied barrier that forces all threads to wait until the work inside the region has been completed.Only the initial thread continues execution after the end of the parallel region [8].
The thread that encounters the parallel construct becomes the master of the new team.Each thread in the team is assigned a unique thread number (also referred to as the "thread id") to identify it.They range from zero (for master thread) up to one less than the number of threads within the team, and they can be accessed by the programmer.

2) MPI
Message Passing Interface (MPI) is an API specification that allows computers to communicate with one another.It is used in computer clusters and supercomputers.MPI is a language-independent communications protocol used to program parallel computers.Both point-to-point and collective communication are supported.MPI is a message-passing application programmer interface, together with protocol and semantic specifications for how its features must behave in any implementation.MPI's goals are high performance, scalability, and portability [9].MPI is not sanctioned by any major standards body; nevertheless, it has become a de facto standard for communication among process that model a parallel program running on a distributed memory system.Actual distributed memory supercomputers such as computer clusters often run such programs.The principal MPI-1 model has no shared memory concept, and MPI-2 has only a limited distributed shared memory concept.Nonetheless, MPI programs are regularly run on shared memory computers.
The MPI interface is meant to provide essential virtual topology, synchronization, and communication functionality between a set of processes (that have been mapped to nodes/servers/computer instances) in a language-independent way, with language-specific syntax (bindings), plus a few language-specific features.MPI programs always work with processes, but programmers commonly refer to the processes as processors.Typically, for maximum performance, each CPU (or core in a multi-core machine) will be assigned just a single process.This assignment happens at runtime through the agent that starts the MPI program (i.e.MPI daemon), normally called mpirun or mpiexec.Computer machine that initiates MPI ring daemon will have process manager in its core CPU.Process manager identified with ID 0 and all of his worker have ID greater than 0.
The initial implementation of the MPI 1.x standard was MPICH, from Argonne National Laboratory (ANL) and Mississippi State University.ANL has continued developing MPICH for over a decade, and now offers MPICH 2, implementing the MPI-2.1 standard.

A. Matrix Multiplication Workshare Algorithm
Matrix multiplication structure is as defined in Figure .5Parallel algorithm workshare does not change matrices multiplication arithmetic operations.It only change the execution sequence for multiple processors.However, the complexity / operation count will change because of the workshare between core processors.

B. MPI Workshare Algorithm
MPI shares heir work among processing units by using message passing across network.Process identification between core CPU (both on the same computer and different computer) is similar with OpenMP (i.e.ID = 0 master process, ID >0 worker process).
Parallel programming model using message passing is similar with UNIX socket programming in which process manager can send a chunked task to all of his worker process and receive computation result from all of his worker [11].
Matrix Multiplication between two rectangular matrixes can be shared between processes using a certain rule.One of the rules is to make the master process as the process manager which divided and distribute matrix elements according to the number of CPU core workers.Thus, if there is 4 process used, 1 will be used as process manager and the other 3 will be used as worker process.Process ID 0 will become process manager and process ID 1 to 2 as workers.There are several MPI model to distribute matrix among the worker processes and one of them is row based distribution.
In row based distribution, For example there are two N × N matrixes, A ij and B ij , which will be multiplied.All of matrix B ij elements (rows and columns) will be sent to all worker processes which are done by master process.For matrix A ij , before it is sent, it will be first divided according to its amount of row.For example if matrix A ij has 4 rows and there are 3 workers available, each process will has 4/3 which is 1 row with another 1 residual row value generated from the arithmetic division.The residual row value will be added to the worker process which has ID lower or equal than amount of residual row value in a for repetition order (start from worker ID 1 to 2).Thus, 1 residual row value will be added to worker process ID 1. www.ijacsa.thesai.orgOffset variable value will be added for each row sent to worker process.Note that offset variable has a crucial role for keeping track of matrix A row index so that each worker process knows which row index needs to be worked on.While Figure .7 shows how all of rows and columns of matrix b sent to all worker process.), respectively.Because each worker process has those required element, For number P process used, each ) (where extra is an residual variable value and may has different value for different 1  P ). Matrix computation for each of worker process is shown in Figure .8.
After the sub process multiplication is done in each process, they will send back their matrix result and offset variable value to the master process.For each value received from worker process, master process will generate the final matrix result according to the number offset variable.
The most important thing in this matrix operation division is that there is no dependent data between each sub process matrix multiplication.Thus, there is not any data synchronization needed between sub processes, which can reduce program complexity.MPI Matrix Multiplications algorithms workshare is divided into two parts, one is for master process and the other is for work process.Master process algorithm steps are: 1. Value of matrixes is initialized using random function.

Wall time calculation process started using
MPI_Wtime() function.
3. Row for each worker process is calculated including additional residual value.
4. Matrix A sub rows sent to all of worker process according to the row and offset variable.Offset variable will be iterated for each sent process.
5. All of Matrix B elements sent to all of worker process.
6. Master process wait to receive all of sub matrix results which will be sent from all worker processes.).
Worker process algorithm steps are: 1.Each worker process receive a subset rows of Matrix A, according to the offset variable sent from master process.www.ijacsa.thesai.org 2. Each worker process receive all elements (rows * columns) of Matrix B which is sent from master process.
3. Matrix multiplication process is done for each worker process.
4. Each worker process send their sub rows of matrix C back to the master process.
In DSM machine architectures, communication cost is classified into two different types.First is communication cost between process which located on different machines, and second is communication cost between processes which located on same machines.
For communication cost between worker and master process which located on different machines over the network for matrix distributions, can be roughly calculated as:  Total Communication cost: For communication cost between worker and master process which located on the same machines, its distribution process steps can be assumed to be same with the communication over the network with exception that time takes to communicate one datum between processors is not c t but f t , where f t is represents the time it takes to communicate one datum between processors over the shared memory which is faster than c t .Thus communication over the shared memory can be calculated as For distributed shared memory, the communication cost in shared memory side can be ignored because its fast and its assumed not influence the performance runtime.
Matrix multiplication complexity in this parallel program is divided into amount of worker process which is 1  P from the total amount of P process used.Thus, total matrix multiplication complexity in MPI for each worker process can be defined as 1)) /( ( 3  P N O .

C. OpenMP Workshare Algorithm
Because OpenMP is an implementation of multithreading which uses multiple thread as it instruction carrier, OpenMP share their work among the amount of threads used in a parallel region.Thread classified into two types: master thread and worker thread [11].
By default, each thread executes the parallelized section of code independently."Work-sharing constructs" can be used to divide a task among the threads so that each thread executes its allocated part of the code.Both Task parallelism and Data parallelism can be achieved using OpenMP in this way.
To determine how worksharing is done in OpenMP, OpenMP offer worksharing construct feature.Using worksharing construct, programmer can easily distribute work to each thread in parallel region in a well ordered manner.Currently OpenMP support four worksharing construct.
 omp for: used to split up loop iterations among the threads, also called loop constructs.
 sections: assigning consecutive but independent code blocks to different threads  single: specifying a code block that is executed by only one thread, a barrier is implied in the end  Master: similar to single, but the code block will be executed by the master thread only and no barrier implied in the end.
Since OpenMP is a shared memory programming model, most variables in OpenMP code are visible to all threads by default.But sometimes private variables are necessary to avoid race conditions and there is a need to pass values between the sequential part and the parallel region (the code block executed in parallel), so data environment management is introduced as data sharing attribute clauses by appending them to the OpenMP directive.The different types of clauses are:  shared: the data within a parallel region is shared, which means visible and accessible by all threads simultaneously.By default, all variables in the work sharing region are shared except the loop iteration counter.
 private: the data within a parallel region is private to each thread, which means each thread will have a local copy and use it as a temporary variable.A private variable is not initialized and the value is not maintained for use outside the parallel region.By default, the loop iteration counters in the OpenMP loop constructs are private.
 default: allows the programmer to state that the default data scoping within a parallel region will be either shared, or none for C/C++, or shared, firstprivate, private, or none for Fortran.The none option forces the programmer to declare each variable in the parallel region using the data sharing attribute clauses.
 firstprivate:like private except initialized to original value.
 lastprivate: like private except original value is updated after construct.
 reduction: a safe way of joining work from all threads after construct.
Matrix multiplication workshare between threads in OpenMP, is done for each matrix row similar to MPI.The www.ijacsa.thesai.orgdifference is that MPI distribute its matrix element by sending it to all worker process, while OpenMP only need to declare the scope of matrix element variable as shared or private.Take an example, matrix multiplication between two N×N matrixes A ij and B ij which result will be contained in matrix C ij .Each Matrix has 4 rows (i=4) and number threads used is 2 (t=2).
Rows distribution process done using workshare construct "pragma omp for" which is placed on the outer most of for loop repetitions.Thus, each thread (t) will responsible for calculating each matrix C i row for all j column elements.
The amount of rows distributed to number of threads is determined by schedule clause.There are 3 types schedule clause (static, dynamic, and guided).Static schedule distribute iterations equally among all of threads (if there is a residual iterations, threads which has done its job first will be assigned to work on that iterations).Dynamic and guided allows iterations to be assigned to threads according their chunk size defined by programmer.In this program, iteration distribution among threads will be done using static schedule.To understand better how does matrix multiplication done in OpenMP look at Figure.9.Figure.9 scheme gives us matrix multiplication process for two different time executions (t 1 and t 2 ).Because there are 4 rows in matrixes and only 2 thread used in programs, there will be 2 residual rows which will be assigned again to those two threads in different time.In t 1 , 2 threads (ID 0 and 1) will calculate first and second rows.After those two thread finished (assumed that time execution for each thread is same), in t 2 time, those 2 threads will calculate again for third and fourth rows.
Determining how many threads should be used in a parallel region is quite tricky.For the same operation performed by all threads (e.g.matrix multiplication) the most optimal number threads used is the same amount as the total number of cores available.But if in a parallel region consist a various operation (e.g.print, open file, read file, etc) using more than amount of CPU core might be a good idea.In this case, amount of thread can be determined by first, calculating operation cost for each different operation.Thus, number of threads used in matrix multiplication program must equal to the number of CPU cores.
The difference between MPI and OpenMP in process management is that MPI needs its master process to do only a specific job, which is distributing matrix elements, receiving the result calculation, and generating matrix result apart from calculating sub matrix like its workers.The reason behind this is to reduce parallel overhead when calculating a large of matrix dimension over network transmission.Hence, master process can focus only on managing and distributing data.
Unlike MPI in OpenMP, process management and synchronization is done in the same memory (i.e shared memory) and not only master thread but all of thread also responsible of thread synchronization.Hence, master thread can also participate in the matrix multiplication process.
OpenMP matrix multiplication algorithm steps are: 1. Initializing matrixes value using random function 2. Wall time calculation process started using omp_get_wtime() function.
3. Matrix multiplication process for each thread is conducted using pragma omp parallel directives and pragma omp for workshare construct.
4. Wall time calculation process stopped.Time interval between end and start runtime calculation process is calculated.
5. Total matrix operation is calculated using formula 1) in floating point type variable 6. Matrix operation per second is calculated in FLOPS and then converted in MFLOPS which same with MPI.
Unlike MPI, which communication is done using message passing, communication cost in OpenMP is conducted between threads which is assumed to be fast and insignificant to the performance.Thus its time calculation can be ignored in this algorithm.
Matrix multiplication complexity in OpenMP parallel is divided into amount of threads which is t including master threads.Thus, total matrix multiplication complexity in OpenMPI for each thread can be defined as (where number of threads is equal to number of CPU cores).

A. Performance Test
Matrix multiplication algorithm tested ranging from dimension 100 up to 2000 on a three different scenario: sequential algorithm, MPI algorithm, and OpenMP algorithm.For OpenMP and sequential program, test was done on a single Intel core duo 1.7 Ghz T5300 laptop with 1GB RAM running on linux SUSE.For MPI program test was done on a two Intel core duo laptops one with frequency 1.7 GHz T5300 laptop with 1GB RAM running on Windows Xp SP3 and another one with frequency 1.83 GHz T5500 with 1GB RAM running on Windows-XP SP3.
Number of threads used in OpenMP is two (one master thread, and the other one is worker thread).Unlike OpenMP, number of process used is three (two worker process and one is master process).The reason is already discussed in the previous section.However, the number of worker process / threads which performed the matrix multiplication process is equal for both programming models (i.e. two workers).www.ijacsa.thesai.orgBecause there are three processes used in MPI which will be distributed on two multicore / SMP machines (i.e each machines will have two cores), one of the two machines will have its both of core CPUs occupied (i.e master process and worker process).Computer which initiates the MPI ring daemon has a master process in one of its core.Thus, computer machine with master process in it will also have a worker process, and the other machine will only has one worker process.
Statistical analysis conducted on one independent variable (i.e.Matrix Dimension) towards three dependent variable(e.g.runtime program, throughput program, and speedup).Using this statistical analysis, matrix dimension (i.e. as an independent variable) influence towards all of three dependent variable can be seen clearly.

B. Statistical Analysis Result 1) Parallel Runtime Towards Matrix Dimension
Table I. gives run time program obtained using wall time function for three different program (e.g.sequential, OpenMP, MPI).Wall time is the actual time taken by a computer to complete a task (i.e matrix multiplication).It is the sum of three terms: CPU time, I/O time, and the communication channel delay if data are scattered on multiple machines (MPI)).
In OpenMP, wall time is calculated using omp_get_wtime() which starts from when the initial thread enter the parallel region until it exits the parallel region.Thus, process times calculated are thread creation, synchronization and multiplication tasks.
In MPI, wall time is calculated using MPI_Wtime() which starts from when the master process distribute the work among the worker processes until it receives matrix results sent from all worker processes.Process time calculated in MPI are communication between master -worker process and matrix multiplication for all worker process.For N=100, runtime MPI is much slower up to 10 times compared to sequential and OpenMP.However For N= 100 to 2000 MPI runtime is gradually become faster compared to those two.MPI has the fastest runtime performance for N >500.

A. Conclusion
OpenMP workshare between threads in matrix multiplication algorithm, done by using OpenMP FOR workshare construct.OpenMP FOR workshare in matrix multiplication algorithm is placed in the most outer loop of matrix multiplication operation.Using this placement, each OpenMP thread is assigned to work on each matrix C row for all columns.MPI workshare in matrix multiplication algorithm done by using send and receive command.Matrix A row will be divided and sent together with all matrix B elements according to the number of worker process both on the different machines and the same machines.Each worker process will work on one row of matrix A multiplied by all row matrix B elements.If there are residual row, it will be added one each from the smallest worker process ID to the biggest worker ID.
The performance between OpenMP and MPI programming model is vary for matrix dimension N from 1 to 2000, although many standardizations made for both of parallel programming models (e.g.number of matrix workers, matrix algorithm steps, and machine specifications).Matrix multiplication complexity is divided for the same number of worker (i.e threads if its OpenMP with the complexity of Performance decline is common in every program testing performance especially when the data testing becomes large.This is due to the resources limitation (CPUs, memory, etc).However for different programming models which use the same resources and algorithm program, there are more reasons than just resources limitations.
For sequential because the worker process only one, its obvious that its overall performance is lower than the other two.For the MPI and differences can be caused by how fast the workshare is done between worker processes / thread.MPI use message passing in sharing its work across processes which has network communication time over the network medium.In the other hand, OpenMP use thread in sharing its work inside shared memory machine which has no network communication time.Hence, OpenMP workshare should be faster than MPI.This can be seen at Table I, II, and III.OpenMP gains fast speedup and large throughput for N= 100 to 500 while MPI gains slower but steady speedup and throughput.However, when as N grows larger (i.e N= 500 to 2000) OpenMP performance is gradually become slower while MPI can still keep up with the growth of N.
Besides, the speed of the workshare, performance differences between OpenMP and MPI for large N computation can be caused by core CPUs access to memory.In parallel computing, memory is scalable with number of processors.Thus, increase in the number of processors and the size of memory will also increases the performance scalability.MPI distribute its work by copying it on each worker process whether its located on the same memory or different memory machine.Thus, each processor which located on different machine can rapidly access its own memory without interference and without the overhead incurred with trying to maintain cache coherency (i.e MPI provides strong memory locality).
For this research, MPI is tested on distributed shared memory architectures using two SMP (Symmetric Multiprocessor) machines.MPI share two worker process between two different machines, thus MPI distribute the copy data located in different machines.Two worker processes can access its data on its own memory which will reduced the overhead half compared on single memory.
OpenMP in the other hand, use a single memory which is shared between core CPU in computer machine (UMA).Hence, the primary disadvantage is the lack of scalability between memory and CPUs.Adding more CPUs can geometrically increases traffic on the shared memory-CPU path, which leads to difficulty maintaining cache coherent systems between processors.
Therefore, the larger memory used in OpenMP, the more congested traffic on the shared memory-CPU path which result in bottleneck.Increase in traffic associated with cache/memory management will produce more parallel overhead while maintaining cache coherency.OpenMP matrix program experienced this problem for N= 500 to 2000.The reason why the performance in OpenMP is decreasing starting from N= 500 to 2000 is because traffic on the shared memory-CPU path is gradually become more congested for memory equal to 1GB.This can be seen at Table.III, where OpenMP does not give any more speedup than 1.5 s.

B. Future Work
Message Passing and Thread has been combined in a DSM (Distributed Shared Memory) parallel architecture to achieve a better performance results in nowadays.In this research MPI parallel expression used on shared memory architectures, has not exploited the thread safety programming explicitly.Using thread safety expression, MPI can explicitly control the threads which running multiple cores across SMP machines.This Message Passing -thread model also referred as Hybrid parallel programming model.In the next research, Hybrid parallel programming model will be used as evaluation material on DSM (Distributed Shared Memory) architecture.

Figure. 1
gives information about cache memory.

Figure 1 .
Figure 1.Block diagram of a generic, cache-based dual core processor

Figure 2 .
Figure 2.An illustration of a distributed memory system of three computers

Figure 3 .
Figure 3.An illustration of a distributed shared memory system

Figure. 4
gives a better understanding about multithreading.

Figure 4 .
Figure 4.The fork-join programming model supported by OpenMP

Figure 5 .
Figure 5. Matrix Multiplication Structure Multiplying two N N  matrices in sequential algorithm takes obviously for each element N multiplications and 1  N additions.Since there are 2 N elements in the matrix this yields a total of 1) (2 * 2  N N floating-point operations, or

Matrix
N N  dimensions will be used to hold the matrix result elements.The computation of a single i row element j C 1, (for N j 1,2,.. =) requires an entire matrix element of ijB and a subset row element of qj A (where i q 

Figure 8 .
Figure 8. Matrix Multiplication For Each Worker Process

TABLE I
Both sequential and OpenMP has a throughput increase from N= 100 to 500, however, it starts to decrease from N= 500 to 2000.Nevertheless, MPI is different from the other two, It has a continuously increased throughput start from N= 100 to 2000.Eventhough, the throughput increase from N= 1000 to 2000 is not as significant as before.

TABLE II
Table III.gives speedup performance for two program(e.g.OpenMP, MPI) towards sequential program.Speedup performance in this research can be obtained by dividing wall−clock time of serial execution with wall−clock time of parallel execution OpenMP has a steady speedup for N= 100 to 2000 which has the average value at 1.5 s, while MPI gives a linear speed up growth for N= 500 to 2000 ranging from 1.38 s to 4 s.MPI gives no speedup for N= 100 because the matrix calculation is to small compared to the MPI running time and communication time.

TABLE III .
SPEED COMPARISON WITH VARIOUS MATRIX DIMENSION Intel Core Duo 1.7 GHz (for OpenMP) and Intel Core Duo 1.7 GHz together with Intel Core Duo 1.83 GHz both with 1 GB of RAM (for MPI).