Thursday 26 March 2015

General Purpose Programming (GPU Programming)

In this post I am going to describe what is general purpose programming or G.P.U. programming is and why we use it over tradition C.P.U. Programming.

Traditional Programming:

C.P.U. programming is the traditional way of doing programming. In which our program is run on the C.P.U. It was the main part of our program execution. But Due to certain limitation now the trend is shifting towards the general purpose computing or G.P.U. computing.

Limitaions of Traditional Programming:

Because we cannot increase the frequency of the C.P.U. further and adding more number of cores to our system is very costly. How much cores we can afford on our own, 2 ,4, 8 ,16. And it will consume so much power that our system's battery will discharge very quickly. Main reason is we want to speed up our computations as now a days the Size of DATA is increasing rapidly. Our C.P.U computation will not give results as fast as our expectation.

G.P.U.( Graphical Processing Unit) :

G.P.U is the abbreviation for Graphical Processing Unit. Which is integrated to our systems for graphical processing. It is being used for graphical processing on our system for long time. Then some people think , why can't we use G.P.U. in general purpose computing instead of using only graphical processing. A single general Graphic Card or G.P.U. contains nearly 65,535 small processors on single chip. Which can do the arithmetic operations simultaneously.



G.P.U. Programming:

In G.P.U. programming we use the G.P.U to do the arithmetic calculations simultaneously. As I described above that a general G.P.U contains almost 65,535 small A.L.Us. We can write our programme logic in a way that our program can be spawn into parts for running simultaneously.

But G.P.U is not a C.P.U. It generally cannot access our Main Ram which is available for C.P.U. So whatever code we write first goes to C.P.U. Then C.P.U send the data and the programme logic to G.P.U. G.P.U. executes it parallely and again send back the data to C.P.U. By parallising the threads on multiple A.L.Us of G.P.U  we speed up the computation. That can be shown in a huge data set program otherwise the transferring cost of DATA from C.P.U. to G.P.U. will be large than the computation speed up we achieved on those data. 

Like: For sorting 10 elements we will not use G.P.U.
For sorting 100,000 elements we will use G.P.U. So that the cost of transferring data can be overcome by computation speed up.

We are using G.P.U. for doing our general processing so this is called general purpose computing.
It solves the problem which can not be solved by C.P.Us in reasonable time. Like: D.N.A. testing.

Next Question is How to do this Programming ???

Next question is how to do this. How can we interact with the G.P.U. as we interact with C.P.U. So there are some Platforms available which you can start with. These platforms provide APIs for interaction with the G.P.U.

1. CUDA(Compute Universal Device Architecture) developed By NVIDIA.
   You can start with this following link. If you are interested.

2. OPEN CL (Open Computing Language) developed by Khronos group.
    You can start with this following link. If you are interested.

But these are two famous tools for G.P.U Programming . I have worked with both the tools. These are awesome.
How to work with these I will explain in the following posts.

Limitations Of  G.P.U. Programming:

1. But every problem's logic cannot be spawned in to the parallel parts means its difficult to think a problem to solve parallely.

2. Even the single G.P.U. might not be sufficient for the task. So now a days people go for more than the one G.P.U.

3. But having more than one G.P.U. also can be problematic. Imagine the scenario if you have two different G.P.U.s developed by two different companies then how to integrate both of them simultaneously.

The research is going on for the improvement of these limitations. But still G.P.U programming is faster then the C.P.U. programming.

I hope it helps. For more posts, like my page on facebook. The link is given below. Subscribe By Email on the side of the page. Thanks for visiting.




2 comments:

Related Posts

Related Posts Plugin for WordPress, Blogger...