Saturday, March 20, 2010

Parallelizing the Fibonacci using java

Hai...

Its being a quite some time to my last post. Anyway since I currently researching on parallel computing I thought to publish a post relevant parallel programming. So I thought to implement the Fibonacci calculation algorithm in a parallel way using Java. Here is the source code.

Parallel Fibonacci--------------------------------------




Sequential Fibonacci----------------------------




I have use the Java executor framework to achieve the parallelism. I tested the source code under duel core 1.73Ghz machine. Following are the results that I got for sequential and the parallel computations.

number=25
seq=0.0040 parallel=0.0070
number=30
seq=0.035 parallel=0.029
number=35
seq=0.215 parallel=0.189
number=40
seq=2.025 parallel=1.719
number=45
seq=22.215 parallel=14.291



Above graph shows the performance of each calculation (X=fib number,Y=time(s)).

Thats it for today. I hope to explain the concept behind the performance gain in next post.

0 comments:

Post a Comment

Custom Search

My Video Bar

Loading...