Sunday, March 30, 2008

X264

My head aches,and I feel weak. Why? Its a little (Yeah right) H.264 Encoder written in c, called the x264. Now whats my bizness with it? Its part of my MSc thesis project on Hardware Acceleration.
I have to pick the computationally intensive parts of the code and send them to an FPGA, and investigate if theres speed up.I gotta make use of a C to VHDL compiler written in house.
Sounds easy right?
Yawwwnnnnn. My first assignment was to see if I could serialize the application, by removing the pthreads. Then I had to do some profiling. The call graphs generated by this thing were so damn huge.I mean this is an encoder software, and its opensource....gosh some people really have time.
Now I gotta pick the functions which only operate on macroblocks, and use them to estimate area and delay on an FPGA. Some of my friends think I am losing it...lets just see.
Try stepping through a large piece of software like that, and see how you feel...but its interesting anyways, Thank God for doxygen, which allowed me to generate documentation for the whole encoder.
For the estimates, I am considering the hardware arithmetic units which will be used by the functions. So if theres a multiplication operation, followed by addition, I know that I will need an multiplier and an adder. I will have to generate some data flow graphs, and maybe perform ASAP scheduling for resources, and add an extra 20% for routing and logic.
Now let me get back to picking out my functions....

Tuesday, February 19, 2008

Maven Maven and Maven

I have been battling with installing maven for my new project....now this thing has been showing me hell. I downloaded all the stuff, and the atlassian pdk.
Now I followed all the instructions they had on their page, for some reason, they prefered to use jdk 1.4, but for me, that didnt matter anyways.
So I did all the exporting environmental variables, got the thing to work, created the maven archetype(Directory skeleton for a particular kind of project).
Now I had a full screen(Oh did I mention I got a new phillips flat screen yesterday?), filled with weird looking linux commmands...then since I Wasnt going to kill myself, I exported the whole thing into my eclipse IDE with the command eclipse:eclipse.......this frigging download took 29 mins approximately. When I was rejoicing that it had finally worked, came the hard part, getting eclipse to compile and build this thing.
Maven uses a test/development life cycle method. The first stage is compile, then some tests, and then an install. These stages are called "goals" in maven terminology.
I wasnt making any progress, so I installed the maven plug in for eclipse. Now I began suffering because for maven to compile, it needs to download all the dependencies from the local maven repository(29 minute download...remember?), and if it doesn't see what it wants, it begins to bitch like a starving cat.
I got so many errors. imagine getting an error called mojo:ActionMojo:execute, or some crap like that...reminds me of a friend in school who saw a line of code commented as "suicide".
Now I have been trying to get this to work all day with no avail. Now its hinting that one of the POMS for the dependencies its trying to download is faulty. Mavens proponents say its better than ant, but for some reason, I find that doubtful.
Anyways, back to the grind...this thing must and will work, if I have to beat it with a stick...

In case anyone sees this, this is an example of some of the crap eclipse feeds me:

2/19/08 4:27:46 PM CET: [WARN] POM for 'seraph:seraph:pom:0.7.17:provided' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM. for project seraph:seraph at /home/ade/.m2/repository/seraph/seraph/0.7.17/seraph-0.7.17.pom
2/19/08 4:27:50 PM CET: [WARN] POM for 'oscore:oscore:pom:2.1.0:provided' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM. for project oscore:oscore at /home/ade/.m2/repository/oscore/oscore/2.1.0/oscore-2.1.0.pom
2/19/08 4:27:50 PM CET: [WARN] POM for 'cargo-test-runner:cargo-test-runner:pom:8Aug07:provided' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM. for project cargo-test-runner:cargo-test-runner at /home/ade/.m2/repository/cargo-test-runner/cargo-test-runner/8Aug07/cargo-test-runner-8Aug07.pom
2/19/08 4:28:14 PM CET: [WARN] POM for 'seraph:seraph:pom:0.7.17:provided' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM. for project seraph:seraph at /home/ade/.m2/repository/seraph/seraph/0.7.17/seraph-0.7.17.pom
2/19/08 4:28:25 PM CET: [WARN] POM for 'oscore:oscore:pom:2.1.0:provided' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM. for project oscore:oscore at /home/ade/.m2/repository/oscore/oscore/2.1.0/oscore-2.1.0.pom
2/19/08 4:28:27 PM CET: [WARN] POM for 'cargo-test-runner:cargo-test-runner:pom:8Aug07:provided' is invalid. It will be ignored for artifact resolution. Reason: Not a v4.0.0 POM. for project cargo-test-runner:cargo-test-runner at /home/ade/.m2/repository/cargo-test-runner/cargo-test-runner/8Aug07/cargo-test-runner-8Aug07.pom
2/19/08 4:28:30 PM CET: Parsing error /home/ade/.m2/repository/seraph/seraph/0.7.17/seraph-0.7.17.pom; org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: 'logo' (position: START_TAG seen ...\n ... @9:11)
2/19/08 4:28:30 PM CET: Unable to read search-portlet/pom.xml; org.eclipse.core.runtime.CoreException: Parsing error /home/ade/.m2/repository/seraph/seraph/0.7.17/seraph-0.7.17.pom; org.codehaus.plexus.util.xml.pull.XmlPullParserException: Unrecognised tag: 'logo' (position: START_TAG seen ...\n ... @9:11)

Do I sound pissed off? You bet I am.... :-)

Saturday, February 16, 2008

so far...since last year

Havent posted in a long while. So this is gonna be a bit messy.
I am working on my thesis in Hardware Acceleration. Basically you have an application, and you are looking for ways in which it can run faster in hardware. So you profile the code using tools like gnuprof, and then you can detect which functions in the code are the most computationally intensive. You then have to merge the functions, because you want to reduce the amount of times you reconfigure your FPGA when you run the code, and also by merging, you should achieve some speedup.
Now, the thing is that merging isnt so easy. You have to consider some criteria, i.e the number of times the function is called, and also, the data dependencies which might exist between the functions. We have a tool that can generate control flow graphs (CFGs), which show the rest.
The application I am using is the h264 decoder, its open source, written in c, and I am going to write about it as a chapter in my thesis. I also had to remove the pthreads it had, to make it serial, and do some profiling. That included some call graph generation by the way.
On the other side, my web development skills are improving. I finished the tag search extension to the LDAS application (a web based Java/LDAP application) given to me, and now I am going to work on developing a JIRA portlet, as an interface to opensearch.
I wonder if its possible to run two different coding interests at the same time, but It should be.
And for the assembly assignment, I got a grade of 8.5, and I got a 9 as a final mark for compiler construction. Yup......all that reading of the grammar files, and generating assembly code paid off......we got the highest mark in the lab...68/70.
Cheers, and later!

Sunday, October 28, 2007

I have just spent most of today (sunday) working on my assembly programming assignment..its finished by the way.....lol, I just have to write another version of the code that runs faster. It was just a matrix multiplication code in C that we had to rewrite in MIPS 64 Assembly. The hardest part for me was knowing how to calculate the index in a 2-d array in assembly. I finally figured it out, so check this out:

consider a simple 2-d array a[i][j]. To get the element at this location, we simply use the formula:

(i * max_index_of_i +j)<<3.

We need to shift by 3, because in assembly, we are just stepping through an array, and each element occupies 8 bits.
So this principle is shown in MIPS64 assembly code to reference p[i][k] in a 3x3 array.

daddi $t7, $r0, 3 ; $t7=3

dmul $t6, $t0, $t7 ; $t6=i*3

dadd $t6 , $t6, $t2 ; i*3 +k


dsll $t4, $t6, 3 ; $t4=(i*3+k)<<3 multiply by 3

daddi $t8, $r0, p ; get base address of p

dadd $t8, $t8,$t4 ; $t8 has the address of p[i][k]

lw $t9, 0($t8) ; $t9 has the value of p[i][k]

Now I am getting back to debugging. See you later!

Wednesday, October 24, 2007

We finally finished the first assignment of the compiler construction project, which was to make the reference compiler recognize records. We were able to compile the test file, record.ast, and it generated the right c-code. Today, we simply ported the code from the old compiler to the new one. The new one had some new assert statements, to check if the right subtype was being used, and all, but it didn't take so long.
We now began the testing phase. We have this Java applet called diagnostix which is able to evaluate the quality of our test suite, and it showed us that our test cases detected 3/5 bugs the compiler should guard against...not bad for our first day of testing, and we are way ahead of schedule.
An interesting case we had was checking that a record name could not be used as a variable name, and also checking that it is illegal in our compiler to check for equality of two records.
Later, thats all for today.

Thursday, October 18, 2007

Compiler construction

I am currently working on the compiler construction course with my greek partner, and its one of the baddest courses in my msc program. We basically have a reference compiler written in C, called asterix, and we are meant to make the compiler recognize record structures. The code generation part has to generate c-structs for the records. For the second assignment, we are meant to change the entire back end code generator from producing C code to assembly.
So far so good, things are alright, we were able to compile a simple record program, and our compiler was able to generate C structs, which was a relief.
Now we need to implement the dot (.) operator so that it is possible to do stuff like this:

record foo is
begin
a:int;
end

Now, our extended compiler should be able to handle statements like

f:foo /*record declaration */

f.a:=2.

But unfortunately, we still get a segmentation fault, which we might tackle tomorrow.
Well more news later, and Im still thesis hunting.

Wednesday, August 15, 2007

Finally, I was able to install, MySQL 5.0. I had problems with it before. I am not sure about why it worked now, but maybe its because I ran spybot on my system and found out that there was a script on my system that had messud up my security centre updates....
Well now I have entered into the cool part of ruby, which is the rails framework. The framework uses the WEBrick server, and all I had to do was just type

ruby script/server, at the command prompt, and that was enough to start the server. This dosent need any fancy XML configuration files like I was doing with Apache Tomcat in the days of JSP.

Then I simply opened my browser window and entered this url http://localhost:3000/
and viola:



Rails uses a Model View controller paradigm, and one has to create a controller, and give the controller a couple of actions.....
The controller is a .rb file which has a class inheriting from class ApplicationController.

Well I gotta go back to study, I will write some more later.
Went to a bookstore and saw this cute book on python.......who knows,that might be my next project......