Archive for March, 2009

Doing Your Tax != Hard

// March 26th, 2009 // 1 Comment » // Announcement

This is my second year doing my taxes now and I just finished all my taxes in about 20 minutes. There seems to be a spooky factor when people bring up tax season. I am trying to figure out what all the fuss is about? When doing your tax there are four places you have to file your tax with. These are:

  1. Federal tax
  2. State tax
  3. City tax
  4. Local School District

All of these tax forms I filed online! You only need two things handy to complete all of your taxes.  Your W2, you get these from your employer (if you have a job) and finally your bank account and Routing number, this you can get from your bank.

If you run a business or make alot of money, unlike a poor graduate student (me) you might need to get your taxes professionally done.

For the federal tax can be done freely @ http://www.irs.gov/

For the state tax, just do a google search with you state’s name and append ‘tax’, for me the google search was “ohio tax” the first hit was the right place @ http://tax.ohio.gov/

The city tax was a bit weird, because it was not so obvious on where to file, but a quick google search turned up a place called the Regional Income Tax Agency aka RETA @ http://www.ritaohio.com/

The last tax to file is with the local school district, this can be filed at the same place where the state tax was file, so just follow the second link if you are an Ohio resident. Remember you don’t need to pay someone to file your taxes when you can do it yourself online and FREE! After about 30 minutes tops you are good to go and hopefully you’ll be getting money back like me :-)

Muse Code Generator

// March 25th, 2009 // No Comments » // Announcement

My latest work on research has been the development of code generation tool that basically sets up all the needed directories for a muse simulation to work correctly. It also gives users the option to generate agent,state, or event classes which are subclasses from muse base classes. The language I’ve chosen to create this tool is ‘kick ace’  python. Python is probably is my favorite scripting language. Once the tool is complete it will be documented on the muse site @ musesimulation.org

Research Work Issues

// March 24th, 2009 // No Comments » // Announcement

I had a freaking break down today. There are just so many things going on with research and at times can feel very over whelming. I took this day off to get a hold of myself and to reorganize my current attack plan. Things on my list that have to be done for research include:

  • Thesis write up
  • muse benchmarking
  • muse website

My issue today was with testing.  Ignoring the fact that I am not a c++ expert (in my opinion the shear complexities of c++ requires many years of development to master, and the word expert should not be used to lightly),  dealing with code that runs in parallel is just a pain the a**. There is no easy way to test, no easy way to unit test. When a bug is discovered, well, good luck because hunting that bug down will consume valuable time. I have managed to make good progress on the muse website musesimulation.org. However my work on the thesis writeup has been at a stand still for the last week and a half because I have been developing simulations for my benchmarking.

Benchmarking is a whole other ball game. I found the best way to find bugs in the kernel is to create different types of simulations and see if they work. Everytime I create a benchmark simulation I find an error. This got me thinking, why is there no good way to test parallel code? However I am determined to create something useful and I will give it all I got :-)

Anyways, this is my rant for the day and if you have some tips about parallel development please feel free to leave some hints.

Favorite Shows on Hulu

// March 20th, 2009 // 2 Comments » // Announcement

I love hulu and I have a couple of shows that I absolutely love to watch on the site. The following are the the descriptions of the shows as displayed on hulu and also an episode from the show you can watch here!

Lie To Me

When you scratch your chin, wring your hands, wrinkle your nose or swallow too much, Dr. Cal Lightman (Roth) knows you’re lying. He doesn’t just think so – he knows so. As the foremost deception expert in the country, Dr. Lightman can uncover the deepest secrets and crack the hardest cases. More accurate than any polygraph, he knows whether those in front of him – be they family, friends, criminals or complete strangers – are honest or not. Dr. Lightman heads up The Lightman Group, a private agency contracted by the FBI, local police, law firms, corporations and private individuals when they hit roadblocks in their searches for the truth. Joining him at the agency are a variety of experts in the field of behavioral evaluation: Dr. Gillian Foster (Williams) is a gifted psychologist and Lightman’s professional partner, a woman whose guidance he needs whether he knows it or not; Will Loker (Brendan Hines) is Lightman’s lead researcher who practices “radical honesty” at all times; and Ria Torres (Monica Raymund) is the newest member of the team, selected for her innate ability to read body language and catch certain clues that her colleagues may miss.

Life

A detective gets a second chance after serving time for a crime he did not commit.

Fringe

From J.J. Abrams (“Lost”), Roberto Orci and Alex Kurtzman, the team behind “Star Trek,” “Mission: Impossible III” and “Alias,” comes a new drama that will thrill, terrify and explore the blurring line between science fiction and reality. When an international flight lands at Boston’s Logan Airport and the passengers and crew have all died grisly deaths, FBI Special Agent OLIVIA DUNHAM (newcomer Anna Torv) is called in to investigate. After her partner, Special Agent JOHN SCOTT (Mark Valley, “Boston Legal”), is nearly killed during the investigation, a desperate Olivia searches frantically for someone to help, leading her to DR. WALTER BISHOP (John Noble, “Lord of the Rings: Return of the King”), our generation’s Einstein. There’s only one catch: he’s been institutionalized for the last 20 years, and the only way to question him requires pulling his estranged son PETER (Joshua Jackson, “Dawson’s Creek”) in to help. When Olivia’s investigation leads her to manipulative corporate executive NINA SHARP (Blair Brown, “Altered States”), our unlikely trio along with fellow FBI Agents PHILLIP BROYLES (Lance Reddick, “The Wire”), CHARLIE FRANCIS (Kirk Acevedo, “Oz”) and ASTRID FARNSWORTH (Jasika Nicole, “Law & Order: Criminal Intent”) will discover that what happened on Flight 627 is only a small piece of a larger, more shocking truth.

Hulu Rocks

// March 20th, 2009 // 2 Comments » // Announcement

hulutm_130_squareFirst, I would like to state that I am currently a grad student. With that disclaimer, everyone knows that typically we don’t have much money to spend. The stipend you do get will probably be enough for you rent, food, and utilities. Cable, especially in Oxford Ohio is a luxury not enjoyed by most grad students. Hulu comes to the rescue with streams to the hottest shows on television. With hulu around cable will soon be obsolete.

Mephisto 0.8 (Drax) Quick Install

// March 20th, 2009 // No Comments » // Rails

If you are not a programmer, I recommend you use a different blogging engine, because even after the install is a success. You’ll still need to edit the template of your choice to get it just right. I am still not done editing this template. Installing Mephisto 0.8 (Drax) is not exactly the easiest thing to do. However, I have managed to do it twice in the last month. So here is the process to save hackers out there some time. There are a couple of requirements that you will need before proceeding with the install.

  1. Rails 2.0.2
  2. tzinfo (I have 0.3.9)
  3. At least rake 0.8.1

Installing Rails 2.0.2

This should also install rake for you. Just in case I have the command below.

sudo gem install rails -v=2.0.2

Installing tzinfo

sudo gem install tzinfo

Installing Rake

sudo gem install rake

From here change directory to the home of your rail applications.
Now run the command:

sudo wget http://github.com/technoweenie/mephisto/tarball/master.tar.gz
sudo tar -xvf technoweenie-mephisto-90e2cc253d94e2e544bc8b21f361c7360c1e9baa.tar.gz
sudo mv technoweenie-mephisto-90e2cc253d94e2e544bc8b21f361c7360c1e9baa blog

The last command simply renames the directory to something more readable. Here I renamed it to “blog”. This will be the mephisto root directory. OK! You now have all the things to need to start the installation. From here on is where I ran into all the trouble. Not to worry, I ironed out all the kinks so you should be OK!

Installation in 8 easy steps

  1. Create a database named mephisto (or one of your choosing).If you are running mysql, you can do this at the command prompt. This assumes your localhost root does not have a password.
  2. mysql -u root
    mysql> create database mephisto;
    
  3. Copy config/database.example.yml to config/database.yml
    Just copy and past the following command from the config directory.
  4. sudo mv database.example.yml database.yml
    
  5. Edit database.yml and set your database credentials.
  6. This step is important. Edit config/environment.rb
    and append the following line. This step will save you trouble when running the rake db:bootstrap command two steps down.
  7. RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION
    
  8. Time to update your boot.rb file. From your mephisto root directory, run the following command.
  9. rake rails:update
    
  10. OK! Time for the big moment! Are you ready? It’s time to bootstrap your database. Run the following command from your mephisto root directory.
  11. rake db:bootstrap RAILS_ENV=production
    
  12. If you got to this step without troubles, then consider this a big win! The next step is to deploy mephisto, I recommend mod_rails.
  13. Last step! Login to your administration at http://domain.com/admin with the username: admin and password: test

That is all there is to it. I hope everything went OK for you. Any questions or comments are welcomed.

Different Types of Parallelism in HPDC part2

// March 19th, 2009 // No Comments » // HPDC

In Part1 of this article we went over the basics, so read that first if you already haven’t. In this article, we will go into more detail over the different types of parallelism.

Parallelism types from Implicit to Explicit

  1. Instruction Level parallelism
  2. Compiler assisted parallelism
  3. Programmer guided, Compiler assisted parallelism
  4. Programmer guided, automatic multi-threading
  5. Multi-threaded programs (manually developed)
  6. Multi-process applications (manually developed)

Instruction Level parallelism
This is what is provided at the processor level, when you compile the serial code, parallelism is automatically extracted by the microprocessor. The CPU tries to runs concurrent instructions in parallel. This is a pure hardware solution, future articles will discuss how instruction level parallelism is achieved and the challenges developers must concur in order to fully utilize this parallelism.

Compiler assisted parallelism
Still in the implicit parallelism category, the compiler and the CPU work together to achieve parallelism. The compiler identifies concurrent instructions while compiling and tags them with OP codes. When the CPU executes the instructions the ones with OP tags are run in parallel. The difference here is the hardware overhead is decreased because the software is taking on some of the load of extracting parallelism. This requires the compiler to be highly optimized for the CPU, for example ICC, the Intel C Compiler.

Programmer guided, Compiler assisted parallelism
Here is where we start to fall a little over to the explicit parallelism, but mostly it’s implicit. This is just like compiler assisted parallelism, but the programmer helps the compiler by reorganizing parts of the code. I will be writing an article soon that deals with some cool code reorganization, which will improve your code big time! Usually, this process is done via a process called profile driven optimization. Profilers are tools that can show you bottlenecks in your code.

Programmer guided, automatic multi-threading
This one falls more into the explicit parallelism, but has some implicit as well. The idea here is to use a programming language or a compiler that is extended/enhanced with special constructs that can be used by the programmer to tag different areas that concurrent. A good example of this is OpenMP. The reason it’s automatic mulit-threading is because the compiler will handle the work of creating, synchronizing, and destroying threads for you. However, scope of gain is limited to shared-memory architecture.

Multi-threaded programs (manually developed)
Now we are getting into the full explicit parallelism category. These programs are basically mulit-threaded. Most languages you use will have a way to create and use threads. If you have a mulit-core machine, it’s a given to use multi-threads which will utilize the different cores. The programmer is responsible for the extra overhead of synchronizing critical sections and avoiding deadlocks and race conditions. For most programmers, it’s often challenging to develop good multi-threaded programs.

Multi-process applications (manually developed)
This is the last type and the most difficult to get right. This is fully explicit parallelism and the program typically runs on multiple processes. Each process works on a different computer (computes are interconnected). Note, each process may contain mulitple threads. Again, it’s up to the programmer to keep track of all the overhead of allocating resources and handling synchronization. This is the current favored solution on most supercomputing clusters.

That concludes this article. Remember the idea of this article was to get you a little info into the different types. Future articles will go even further into some of these types and discuss how we can optimize our code to get some big improvement. Questions or comments are always welcomed!

Different Types of Parallelism in HPDC part1

// March 19th, 2009 // No Comments » // HPDC

There are many types of parallelism in HPDC, but in general the term is typically used to describe the idea of performing two or more tasks at the same time using different computational devices. These computational devices can be:

  1. A different computer thats networked or interconnected
  2. Another microprocessor on the same computer
  3. Another core on a microprocessor
  4. A seprate ALU or part of ALU on a processor

This idea of parallelism is extended and we have different types of parallelism. Imagine a spectrum if you will. In this spectrum, one extreme end will be implicit parallelism and the other extreme is explicit parallelism.

Implicit parallelism in its basic form is parallelism that is automatically or semi-automatically realized. Meaning the microprocessor and the compiler work together to extract parallelism. Note, that the scope of what you gain are limited to a single processor or single machine. Explicit parallelism is the other extreme, so parallelism here is realized manually. The programmer is responsible for developing the program to run in parallel. Typically, for anything worthwhile, would require considerable programming efforts. However, the gain be scoped to multiple machines or supercomputing clusters!

You might be asking, why is explicit parallelism so difficult to code? If you are not asking yourself this question, pretend you just did! It’s tough because most of the time the serial running program that you created is hard to break up into multiple small chunks of code. Basically, parallelism strives to effectively utilize concurrency in code to reduce the overall computational time required to complete processing.

By concurrency, I am talking about the lack of dependency or relationship between two tasks. Identifying concurrency is what makes explicit parallelism so hard. If you understood everything to this point, then you have the basics of parallelism and the challenges. Part2 of this article will discuss the different types of parallelism, the stuff between our imaginary spectrum we described earlier.

Rails 2.0 Patrials and Collections part2

// March 19th, 2009 // No Comments » // Rails

In part one of this article we went over how to create and use partials. Part two will take what we learned from part one and see how we can use collections to make partials even more useful. We’ll see how you can set additional local variables in your partial. This article is short and assume you have read part1 of this article.

Outline for this article

  1. How do we set local variables in Rails Partials?
  2. Using Rails Partials in a loop?
  3. Is there a point to the Spacer Template in Rails Partials?

How do we set local variables in Rails Partials?
Ok, so we know that we can pass in an object to a partial with the

 :o bject

symbol. Great, but what if you want to use more variables in the partial.
This can be done using the

:locals

symbol in the render helper. For example if go back to the example given in part1

<%= render :partial => "shared/testpartial", :o bject => @name , :locals => {:testvar => @any_object_you_want } %>;

Just make sure you know the name of the local variables you are setting.

Using Rails Partials in a loop?
With partials we can format create modular views. Sometimes you’ll find the need to
render a partial many time over. On way you can do this is to run the partial in a for loop.
Rails has a shortcut for this. You can use the symbol

:collection

The symbol takes a collection of objects that the partial takes! The example from part1 took a string object. So to use the collection we can pass it a list of string objects like the following

<%= render :partial => "shared/testpartial",
:collection => %w{ Mez Adam Azmara John} %>;

This is a very useful feature, if used correctly your views show look clean. This makes maintenance
of code very manageable and enjoyable.

Is there a point to the Spacer Template in Rails Partials?
There is a option the render helper can take called

:spacer_template

It lets you specify a template that will be rendered between each of the elements in the collection.
Basically, it renders another parital. Here is how to use it.

<%= render :partial =&gt; "shared/testpartial",
:collection => %w{ Mez Adam Azmara John},
:spacer_template => "shared/another_partial" %>;

Note, this assumes you have a “_another_partial.html.erb” handy. My thinking on this is a little off. I am not sure if you really need to define another partial to display in between partials. Why not just define the content of the spacer template in the first partial? Give some good examples if you think of any!

That concludes this article. I hope you enjoyed it!

Rails 2.0 Patrials and Collections part1

// March 19th, 2009 // No Comments » // Rails

Often in web applications, the same data is displayed in more than one location. Usually this is done by copying code between different template pages. Using Rails we can avoid this and remain true to the Rails principles of “never repeating ourselves”. This is accomplished by using Rails partials.

In part one of this article we’ll see how to create and use partials. Part two will take what we learned from part one and see how we can use collections to make partials even more useful. Note, more info can be found from the book “Agile Web Development with Rails” in the chapter that deals with ActionView.

Outline for this article

  1. What the heck are Rails Partials?
  2. How do we create Rails Partials?
  3. How to use Rails Partials?

What the heck are Rails Partials?
Rails Partials are basically subroutines in their own right. You can use them many times and in many different templates. If you want, you can even pass in objects to render as parameters. A partial template looks just like a regular templates in Rails with the exception of the name of the file containing the partial. The name of the file containing the template code must start with an underscore character.

How do we create a Rails Partials?
I learn best by examples. So that’s what we’ll do here! Let take a simple example that serves no purpose but to learn from. Lets create a simple partial template that will take a string object and simply render the string. In a file named “_testpartial.html.erb”.

Some background information to keep in mind. you might be wondering where do you store this partial file? Well that depends. If you want to use this partials in views from multiple controllers, then what I like to do is create a folder called “shared” in the views directory. So go ahead and do that now. Are you done yet? Ok, lets keep moving.

Hello, <%=testpartial%>;

Keep in mind that the partial in this example expects a string object. Well now you might be wondering how does the partial know the name of the object being passed in? It uses the name of the partial as a variable name. Since this simple partial is called “_testpartial.html.erb”, we can use the variable “testpartial”. Now that we have this partial setup and created lets go and use it!

How to use Rails Partials?
Using a partial is really simple. You can do this in two places. The first way is in the controller like the following.

def index
@name = "Meseret Gebre"
render :partial =&gt; "shared/testpartial", :o bject =&gt; @name
end

The second way is in the view. For example if we setup the instance variable in the controller like the following.

def index
#var to be used in view.
@name = "Meseret Gebre"
end

Then in the view “index.rhtml” we can render the partial by placing the following code somewhere in the view.

<%=render :partial => "shared/testpartial", :o bject => @name%>;

Thats Rails partials in a nutshell. Remember in part2 of this article, we’ll look at using partials to render a collections of objects! I hope you learned something cool here and remember to never repeat yourself! Any questions or comments are welcomed!

-->

Categories