Browsing the archives for the Geeky Stuff category.


MPI on xCode

Geeky Stuff

I am currently working on a small MPI project, and I had one hell of a time getting MPI up and running, specifically the MPICC (compiler) to work in xCode.

So here it is if you were wondering how to get it to work:

Put the following into a file called MPICC.pbcompspec

/**
Xcode Compiler Specification for MPICC
*/
{   Type = Compiler;
Identifier = com.apple.compilers.mpicc;
BasedOn = com.apple.compilers.gcc.4_2;
Name = “MPICC”;
Version = “Default”;
Description = “MPI GNU C/C++ Compiler 4.0″;
ExecPath = “/usr/bin/mpicc”;      // This gets converted to the g++ variant automatically
PrecompStyle = pch;
}

Note: ExecPath should be set to your mpicc path, find this by typing which mpicc in terminal. BasedOn should be set to whatever the system GCC is (4.2 for snow leopard).

Save this file to the following directory: /Developer/Library/Xcode/Specifications/, if the directory does not exist, create it, restart xCode.

Finally in your project, open the build targets and select the one you want to build with MPICC, get info on it, and add a custom rule for c source, MPICC should be in the list somewhere, if it is not then you messed up somewhere above.

Setting a custom C xCode target rule

Setting a custom C xCode target rule

The file: mpicc.pbcompspec

Sources:

http://lists.apple.com/archives/xcode-users/2008/Apr/msg00104.html

http://www.open-mpi.org/community/lists/devel/2007/02/1313.php

2 Comments

A handy little AppleScript for Bootstrapping development.

Geeky Stuff

So I don’t blog much, and further more I hardly (if ever) blog about anything tech related. For a blog that claims to be about “tech talk” this is unacceptable :P So with that here is my first, and hopefully not my last, tech-ish blog post.

If you are like me, and since you are reading this I am going to assume you are. Then you are a developer (or my friend) and you probably have at least two, if not more, projects on the go.

Personally at this point I have the following things on the go:

  • Lidar Services International - A realtime arial surveying application written in Java. (Tools: eclipse / versions) note: Versions is a great SVN client I use for everything.
  • BeautifulGardenCreator - A Java / Rails tool for Garden Stuffs… (Tools: eclipse / TextMate / versions / terminal : with rails app, console, and scripts running)
  • Matygo - A Rails App for connecting students to tutors (Tools: TextMate / Versions / Terminal : see above)
  • Masters Work - Stay Tuned (Tools: xCode, TextMate : Erlang / Latex / Misc)
  • What ever else I feel like doing with my free time… :)

So needless to say, I am a busy busy boy. What this also means at that on any given day I have to set up a different work context to get some stuff done. This can be as simple as switching the workspace in eclipse, or completely quitting everything opening text mate, launching rails… the list goes on. Wanting to save a few key strokes I figured (at the suggestion of my buddy Paul Lambert ) this was a job for AppleScript.

AppleScript is fairly straight forward, and really, without even understanding much of the particulars of the language, I was able to get the functionality I desired. The most exciting bit of all of this, which isn’t news to probably anyone, is that AppleScript compiles to Apple application bundles. This means that I can launch my development context from my most favourite of favourite app launchers, quicksilver.

So here is an example, a simple script that launches the terminal, opens three tabs (Tab 1: the rails app, Tab 2: the ruby console, Tab 3: the rails directory to run generators and so forth) and runs TextMate on the current directory. This of course requires that you’ve installed the command line mate capability.

Hope someone finds this helpful.

Cheers,

.joe

set directory to “~/Documents/Software/Matygo/matygo.com”set change_directory to “cd ” & directory

on new_terminal_tab()

tell application “System Events” to tell process “Terminal” to keystroke “t” using command down

end new_terminal_tab

– launch terminal stuff

tell application “Terminal”

activate

– launch rails app

do script change_directory in selected tab of the front window

do script “mongrel_rails start” in selected tab of the front window

– launch the console

my new_terminal_tab()

do script change_directory in selected tab of the front window

do script “script/console” in selected tab of the front window

– set another tab with the current directory for

– the purpose of running generator scripts

my new_terminal_tab()

do script change_directory in selected tab of the front window

do script “mate .” in selected tab of the front window

do script “clear” in selected tab of the front window

end tell


No Comments

WWJLPD - The Great Moral Tale of Star Trek

Geeky Stuff, Nothing of Supreme Importance

Those of you who know me in person (which I’ll just go ahead and assume is 100% of the readers) know that I am a huge Star Trek fan, well perhaps less so in recent years with the advent of the much superior Battlestar Galactica, but none the less I grew up on the trek.

In any case,  my thoughts have recently have been of this poster my dad got me when I was maybe 7 or 8, which read - “Everything I need to know I learned from Star Trek”, and it listed a few clever lines form the show (Can easily be googled for and example). As you may have seen in my earlier post we dressed up as the crew of the enterprise for halloween, in preparation for our parts we spent a month or so watching old Star Trek:The Next Generation. Watching the old shows a few things dawned on me.

- This show looked a lot more bad ass when I was 7.

- There are only four sections of hallway, and they all seem to curve for some reason.

- These characters are mostly pretty boring and one dimensional with the exception of Data.

But most importantly it occurred to me that more so than the religious teachers of my child hood (I went to a Roman Catholic french school for much of my upbringing) Captain Picard and his group of trekers shaped my view of morality. There is some guy out there on the web that wrote a song “What would captain Picard do” and I feel to a certain extent this has some resonance with the geeks of my generation. Picard was a great renaissance man that everyone should aspire to be, he was well read, charming, played music (the tin whistle never sounded so good), he was diplomatic when he needed to be, and tough as nails when the situation called for it (THERE ARE FOUR LIGHTS).

Kirk on the other hand was much more brash, and seemed to see the world in two contexts. Something to be seduced, or something to be judo chopped. He was a cowboy who tended to think in terms of absolutes, in contrast to Picard’s more thoughtful approach. Kirk possessed a moral dichotomy similar to George W. Bush, the with us or against us black and white galactic view. Though it should be noted that I am talking about TV show Kirk, in Star Trek 6 they attempted to round him out a bit more, and there was that search for God in Star Trek 5. 

At the end of the day I think Kirk represented more of the kind of hero figure children have, who always knows right from wrong acts on it, and has beautiful women dripping off him. Where as Picard is more the kind of man that one comes to admire as they get older.

So which are you, Kirk or Picard…. or God help us Janeway… ;) (I guess Sisko was pretty rad too, but he wasn’t really human so that doesn’t count)

.joe out.

1 Comment

Delayed Halloween Post.

Geeky Stuff, Nothing of Supreme Importance

Just thought I’d toss up my halloween costume from this year. Since it’s pretty damn slick.

My Data Halloween costume this year.

My Data Halloween costume this year.

And of course, the crew of the enterprise.

I have some really cool friends...

I have some really cool friends...

That is all…

.joe

No Comments

Late night in the lab leads to great success.

Geeky Stuff

So 11 hours in the lab, with mostly little to no progress finally culminated in a fully functional system.

Our system is basically a series a small microcontrollers with various devices attached to them, these devices communicated with our central PC by way of RS232 communication. In order to call specpfic funcitons on the PIC we basically just pass it a function address through the serial link, and the PIC jams it into a function pointer, and calls the function. It’s pretty neat, but…

What is strange is when we were setting this up, we ran into issues with the function pointers. Now UNB has decided that there is no purpose to me learning C, but here is what we did, and what we had to do to solve the problem.

Our first attempt.

int getFunctionAAsPointerAddress(){
void (*resultPtr)(int); // function ptr
result = &functionA;
return result;
}


int getFunctionBAsPointerAddress(){
void (*resultPtr)(int); // function ptr
result = &functionB;
return result;
}

This for some reason unknown to me doesn’t compile on the PIC… C you’ve done it to me again.

This how ever solves the problem…


int getFunctionAAsPointerAddress(){
void (*resultPtr)(int); // function ptr
result = &functionA;
return result;
}


int getFunctionBAsPointerAddress(){
void (*resultPtr1)(int); // function ptr
result1 = &functionB;
return result1;
}

So this flies in the face of everything I know about programming, function variables should disappear once you have returned them… At least the names should anyway.

If anyone knows why this works the way it does and feels like letting me know… please do.

I’ve decided I might take a C course next year, even just as a bird course so I can learn this stuff properly.

Good saturday to you all.

.joe

No Comments