Saturday, January 15, 2011

Other sites based on multicore programming,..

You can get some more ideas by visiting following sites..

Home

This is a dedicated blog only for Multi-Core Programming and OpenMP.Here discussions will be on Multi-Core technology and how to improve efficiency of system using Multi-Core programming.

This is my first blog, hope it will be nice, cool and useful for everyone who are interested to learn multi-core programming and OpenMP,etc..

Here, as i said will be posting some information on multi-core programming and complete tutorial on OpenMP. I will begin from basics of OpenMP and proceed towards to advanced topics. To say in one line according to me - "OpenMP is very useful and easy to learn",  to get an overview its enough if you go through all of my current posts and some more to come..

My sincere request to one and all is, please feel free to leave a comment as to how you felt about my first blog.. Any and/or all advice is always welcome, please do reply via comments..

At any point of time you can refer to index present at top of the page, so that you get an overview of all topics covered so far.

Threads and Parallel programming model



what is a thread?
  • Informally said, a thread consists of a series of instructions with its own program counter(PC) and state
  • A multi-threaded program executes multiple threads in parallel
  • This is the core concept to increase the utilization of CPU, therefore performance of system is increased.(if you are not convinced with this statement, have a glance at this page  click here)
Multiple Threads
 
Parallel programming models : 

There are various programming models present, some of the well-known are listed below. They can be categorized into two types,
  1. Distributed Memory
  2. Shared Memory
Some models which come under Distributed Memory are : Sockets, PVM(Parallel Virtual Machine), MPI(Message Passing Interface), etc..

Some models which come under Shared Memory are : OpenMP, posix thread, Automatic parallelization, etc,..

I will discuss in one or two sentence about one each from above two categories,

MPI (Message Passing Interface) : 
  • Is an example for Distributed memory model
  • All data is private
  • All threads have access to their own private memory
  • Data is shared explicitly by exchanging buffers
  • Data transfer has to be programmed explicitly
  • An overview is given below in the figure,
Distributed Memory Model - MPI(Message passing Interface)

OpenMP :  (Open Multi-Processing)
  • Is an example for Shared Memory Model
  • Data can be shared or private
  • All threads can have access to the same or globally shared memory
  • private data can be accessed only by the thread that owns it
  • Easy to learn and implement
  • it is as shown below

Shared Memory Model - Open MP

Note : In this blog i will only be discussing about OpenMP and other models on shared memory models, sorry to say no to MPI. So once you are through with this post you can get on to next post which discusses more about OpenMP.

Introduction to Multi-Core Technology

Before we get into,..
  • In computing, a processor is the unit that reads and executes program instructions and provides expected output 
  • Clock speed plays major role in determining the speed of the processors 
  • Initially it was started at 20MHz and later gone up to 3.8GHz 
  • Later the situation was such that they could not increase the clock speed. So they researched about other aspects where they could improve the speed of processing 
  • So they came up with MULTI-CORE  TECHNOLOGY.

Cores and Multi-Cores  
  • Initially processors were originally developed with only one core 
  • The core is the part of the processor that actually performs the reading and executing of the instruction
Time efficiency with usage of multi-core processors

  • Single-core processors can only process one instruction at a time
  • A multi-core processor is a processing system composed of two or more independent cores. It is an integrated circuit(IC) to which two or more individual processors (called cores in this sense) have been attached
  • So if a system has more cores, the more strength it has.
  • One best example you could think off is, just imagine what if you had 4 hands instead of two..? that means you can work faster.. :)
  • But there is certain limit on it, which i will dicuss in future posts.
  • But more number of cores does not mean that performance of the system will always be better than before.
  • That is because suppose if you have 4 hands but your mind is not able to utilize the 4 hands efficiently, so whats the use of having four hands then..?
  • It is the same case in today's Computer Industry. Hardware improvement isn't just enough, there has to be change in software trend to improve efficient usage of the multi-core technology.
  • Always remember the basic thing about computer
Hardware + Software = Computer
  • Of-course that's not exactly accurate in today's trend, i mean there is many more additions to the above like firmware,etc.. But the above equation is the very basic one.

Other Issues :  
  • Currently computer market has hardware that will only run at full speed with parallel programs. But unfortunately number of programmers  who write such supportable and efficient programs are very less…
  • Usually Parallel computing requires,the problems to be decomposed into sub-problems that can be safely solved at the same time(concurrently)
  • The programmer structures the code and data to solve these sub-problems concurrently.
  • There are various tools that help the programmer achieve this, which i will discuss in next post,click here to go to next post.


What is OpenMP? Why OpenMP?



What is OpenMP?
  • OpenMP is an API (Application Programming Interface)
  • OpenMP Supports shared memory model for parallel programming
  • OpenMP can be used along with languages like C, C++, FORTRAN, etc..
  • OpenMP works on Microsoft Windows platform and also on all Unix flavors
  • Therefore, OpenMP is more flexible
OpenMP consists of vast set of compiler directives, library routines, and environment variables that influence run-time behavior. To conclude, OpenMP is a API used to make your application run in parallel, so that CPU utilization is more hence improving time efficiency.(if you aren't convinced, plz have a look at this)



Why do we need OpenMP?

Why do we need OpenMP? why not any other alternatives(for other alternatives click here). This seems to be a BIG question, a million dollar $$ question. But the answer varies from person to person based on personal point of view on OpenMP.

But few common reasons for using OpenMP other than similar alternatives, are listed below :
  • First, OpenMP is easy to learn and implement on a fresh projects
  • Secondly, Minimum code change required to alter existing applications


Compilers :  

Below is the list of compilers which can be used to compile programs which uses OpenMP directives,libraries,..

and many more,.. I recommend you to download and use Intel Parallel Studio along with visual studio 2008 or higher version, because it has nice user interface, has IntelliSense and easy to debug.