Young programmers rubbish

Hey hey, its been a while.

Hell, its been a while since I logged at my blog as admin. I almost forgot that it even exists 🙂 This is my effort to bring it back from the forgotten.

There isn’t any particular thing I’d like to talk about. There are couple of thing I’ve been doing lately, which might be interesting… to finish 😀

First, its socket programming in C. More precisely, I’m making some coding examples, while learning about sockets in C, and while learning I’m trying to implement very very simple application protocol. It might be a good starting point for newbies. Real usefulness of this protocol would exist, if there was need for it. And there isn’t. Doing it for fun, learning and enthusiasm.

Second, since I’m at last year of my studies, I have a finishing project. At finishing year as a bachelor, students have some practical, every day, problem to solve. As a student of master studies, students have more scientific approach, so problem is little bit more science oriented. For example, my work is based on fortran90 MPI parallelization. While I’m at this one, I’d like to point to one funny site. Its about hacker names for your business card. So, related to that, I’d be something between multicore general and parallelista B-) Nice! Now, back to the science. For now, its all about computing positions of gas particles in cylindrical chamber, and one processor is doing calculation for one particle at the time. Nothing very special. Next is doing statistical based model parallelization, which should be more interesting.

Aaaand, in the mean time, while trying to take some time to rest, I’m reading books. Sci-fi ones 🙂 Last book that I’ve finished is Revelation Space, by Alastair Reynolds. Really nice one. The book I started to read recently is Ready Player One, by Ernest Cline. This one is really cool, and I’m not even at one third of the book 🙂 Guys who like games, would like this one.

So, thats it. Have a good time gaming, reading, programming, listening… Bye!

Advertisements

Parallel programing with MPI and OpenMP

Hey hey ppl!

In past couple of hours I have been writing some seminar about parallel programing. It would be correct to say dozen of hours, but I don’t know if that is grammatically correct? 😐 To be precise, I have been working on source codes couple of days, and it was very strong impression. Unforgettable! How could I forget it when I had just a little sleep 🙂 I’m afraid I’m getting hyperactive and very tired at the same time, so don’t mind if I write nonsense every now and then. Yey 😀 Let’s get to business, or sort of business :S

I wont bug you with the history of parallel programming… It’s just a yatty yatty bla bla big companies having a lot of money to spend on distributed computing research… And so, bla bla they developed tools for making programs execute at the same time on more than one processor… Yatty yatty there were a lot of different implementations with the almost same idea, and they had a deal to make some standards. MPI and OpenMP are well known. Boom, you think we are starting real job now! Wouw! Anyway, different tech for different purposes. MPI is Message Passing Interface. Programmers use it for parallel computing on distributed multicomputers. Distributed multicomputers!!! Now, I’m a smart guy? No, it is just a techy name for… lets say cluster! Wtf is cluster man? 🙂 Ok, lets say you have couple of computers and very fast interconnection between them. At that point you are on good way to have a cluster! All you need is right OSes, and very powerful processors on those computers. Yeah, not to forget a lot of RAM, if you are going to run some serious computations which are RAM expensive. On the other side, there is OpenMP. It is Open Multi Processing. Programmers use it to parallelize program codes on centralized processing machines. SMP if you like it! With it you have the power to fully utilize both processors of your computer, or how many you have them. Cool, I’ll try and run it on GPU. Not! I’m afraid you wont be able, coz OpenMP doesn’t run on GPU processors. Either way, you can make a practical use of it. I just can’t remember any right now. These examples which I’ll talk about are some of use, but not very practical. Hey, who needs to calculate list of prime numbers using Eratosthenes sieve on daily basis?? Not me! Lets explain ideas behind those examples.

So, I did some research on Eratosthenes sieve and sequential program codes, and I’m not nuclear physicist, but I did found some really useless things in some implementations found on net. Gosh, today everyone with Internet connection can write something and publish! Haha, me too! 😀 Tell me I’m goood. Pleaseee??!! Ah, forget it. Back to the subject. I did some research on OpenMP and I decided to try and parallelize Eratosthenes sieve with OpenMP, having already parallelized code with MPI. It was good thing to let programs calculate list and compare needed times for both of them. Since I’m going to give you link to archive containing all source code, I’m not going to get all dirty explaining code. Buuut! I’m going to share with you the results of testing. Those are:

OMP v1 and OMP v2 are two versions of OpenMP parallelized code. Word ukupno means time needed for whole program to finish. As you can see, OpenMP is little bit better in compare to MPI. Of course, MPI has some implicit barriers in collective communications and that is what is keeping it from working as fast as OpenMP.

Anyway, you can download source here, and you will find instructions for running programs.

Have a nice day! Bye!