Unit Converter – Currency!

June 13th, 2011 by Jeremy No comments »

Unit Converter Currency Selection

I’ve just released an update for my Android app which now supports currency conversion!

All global currencies are supported with live exchange rates being fed from the internet. Obviously, it now requires the “full internet access” permission as well as “view network state”.

I’d appreciated it if you could let me know of any improvements that you’d like, or any problems with the application that you may be experiencing so that I can improve the application.

You can get Unit Converter directly from your phone here or from the Android Market website here.

Custom Physics System

May 18th, 2011 by Jeremy No comments »

Recently I decided to implement a custom physics system to improve my knowledge of the topic, as well as learning about rendering with OpenGL and all the fun stuff that goes with that.

I decided to learn everything that I could about it all and implement it in just one week as sort of a mini challenge for myself. Everything that I used in the system was entirely new to me so gaining enough knowledge and implementing the entire thing in just a week was a challenging but rewarding experience that taught me a lot about physics systems as well as OpenGL. The system features gravity, simple collision detection as well as a host of other things!

 

Screenshot of Custom Physics System

 

 

I’m planning on updating the system to include more fluid collision detection, as well as greater user control of the objects in the simulation. Please let me know of ways that I could improve it, as well as things that you might like to see in the system.

Head on over to my showreel to learn about all of the cool features of the system as well as a download link!

Git and GitHub!

February 9th, 2011 by Jeremy No comments »

Just a quick update on my Unit Converter App. I’ve just switched over to Git from Subversion to coincide with the creation of my new GitHub account.

Unit Converter’s code is now available to view and modify for all!

Access the repository here!

Shared Memory Tip

February 7th, 2011 by Jeremy 3 comments »

As usual, I’m knee deep in CUDA optimising a fair few algorithms from various papers. Recently, I’ve been implementing the algorithms from this paper with the aim of improving them later/creating my own based from their concepts. The algorithm is an All Pairs Shortest Path algorithm with a nested loop in the kernel. Each time the second loop executes, two values from shared memory are added together and the resulted is evaluated against another variable stored in a register on the appropriate core. For some reason the code was running a lot slower than the results posted in the paper.

My friend here at Durham who is also working with CUDA suggested taking the addition out of the loop and storing the result in a register before the conditional. Much to my surprise, this worked a treat and instantly gave me comparable results with the paper.

Here is the original code before the change:

for (int i = 0; i < gridDim.x; i ++)
  1. {
  2.   __shared__ int row[blockWidth][blockHeight];
  3.   __shared__ int column[blockWidth][blockHeight];
  4.  
  5.   //Code here fills row and column
  6.  
  7.   __syncthreads();
  8.  
  9.   for(int k = 0; k &lt; blockWidth; k ++)
  10.   {
  11.    if(row[threadIdx.y][k] + column[k][threadIdx.x] &lt; value)
  12.    {
  13.     value = row[threadIdx.y][k] + column[k][threadIdx.x];
  14.    }
  15.   }
  16.  }

Here, we can see the change needed to drastically improve the running time of the algorithm:

unsigned int sum;
  1. for(unsigned int k = 0; k &lt; blockWidth; k ++)
  2.  {
  3.   sum = row[threadIdx.y][k] + column[k][threadIdx.x];
  4.   if(sum &lt; value)
  5.   {
  6.    value = sum;
  7.   }
  8.  }

Given that shared memory is so quick on CUDA, similar to an L1 cache on CPU, I wouldn’t have thought that it would have made any difference at all. Obviously, I was wrong! So watch out for things like this when using CUDA or any parallel computing platform.

Android Development

November 19th, 2010 by Jeremy No comments »

I’ve recently got myself a new phone sporting the Android operating system. It’s a great little device and sparked my interest in developing for the platform.

To ease myself into it, I’ve developed a simple unit conversion app to help teach me the core features of the Android SDK whilst providing something that I can publish on the Android Market that only took a few days to develop!

At the moment, it supports simple units and conversions such as area, length, and volume but I’m currently expanding to include density, memory sizes, and currency.

Currency provides an exiting challenge in that I will be able to pull live exchange rates to the app where an internet connection is available for highly accurate conversions. I could even use GPS to detect which currency the user will currently be using based on the country that they are in.

Such a simple premise for an application has and will be able to teach me a lot about the Android SDK and provide an excellent grounding for future apps!

Head on over to the Android Market or AppBrain and download my modest little app!

Steam UI Beta Games Icons

April 21st, 2010 by Jeremy No comments »

Valve recently released the Steam UI beta which is due to come out of beta this Monday. It seems a lot of people are complaining that you can’t have icons next to your games in the games list like in the old UI.

This is false!

Just press the “+” symbol just to the right of Counter-Strike in this screenshot and you can enable game icons. Easy!

Steam UI Beta Screenshot

CUDA cuPrintf

February 8th, 2010 by Jeremy 18 comments »

I finally got an Nvidia developer account a few days ago which gave me access to a very useful library to use with CUDA.

cuPrintf allows printf equivalent statements to be placed inside CUDA kernels without the need for -deviceemu.

The following example demonstrates a simple use for cuPrintf and displays the current thread ID.

  1. #include <cuda.h>
  2. #include "cuPrintf.cu"
  3.  
  4. __global__ void cuPrintfExample()
  5. {
  6.  int tid;
  7.  tid = blockIdx.x * blockDim.x + threadIdx.x;
  8.  cuPrintf("%d\n", tid);
  9. }
  10.  
  11. int main()
  12. {
  13.  cudaPrintfInit();
  14.  cuPrintfExample <<< 5, 2 >>> ();
  15.  cudaPrintfDisplay(stdout, true);
  16.  cudaPrintfEnd();
  17.  return 0;
  18. }

cudaPrintfInit and cudaPrintfEnd only need be called once throughout your entire project.

Output is not automatically displayed on the screen, but stored in a buffer which is cleared and displayed when cudaPrintfDisplay is called. The size of the buffer can be specified with the optional argument cudaPrintfInit(size_t bufferLen).

cudaPrintfEnd simply frees the memory allocated by cudaPrintfInit.

When cudaPrintfDisplay is called, output stored in the buffer is displayed to the console. The second argument in this call either displays the current thread (true) or doesn’t (false). The first arguemnt, specified by stdout in this example, simply defines the descriptor where the cuPrintf log is sent.

On another note, I’ve found that using cuPrintf impacts on the performance of my kernels, presumably due to the data transfer performed every time cuPrintfDisplay() is called.

Dropbox

December 13th, 2009 by Jeremy No comments »

Dropbox is a great little app I found about a year ago for backing up all your important files and making them available anywhere in the world, as well as syncing them to any other computer you have linked to your account.

For example, if you’re working on a document on your computer, any changes you make to the document will instantly be reflected on your laptop or iPhone so you don’t have to bother with a flash drive or e-mail.

Dropbox Diagram

I’ve found it ridiculously useful for all my uni work as it saves up to 30 days of revisions to any file. So for example, you mess up some piece of source code and you want to get the version back from 3 days ago at 3 o’clock, then that’s possible via the Dropbox website (Obviously no replacement for SVN but handy anyway). You just select which version you want to restore, and then that version is pushed back to all your devices with Dropbox installed! You can even recover deleted files and it works on Windows, Linux, Mac and iPhone.

Sign up for free here and get an extra 250mb on top of the standard 2Gb that you’d usually get.

Still Alive

December 6th, 2009 by Jeremy 2 comments »

After buying the orange box over a year and a half ago, one of the included games that I never got around to completing was Portal (as I primarily bought it for Half-Life 2: Episode 2 and Team Fortress 2 like everyone else). What a mistake that was!

Portal is a first person action/puzzle game that puts you in the shoes of Chell; the seemingly silent protagonist.

It’s set almost entirely inside the “Enrichment Centre” for “Aperture Science”, a research corporation responsible for creating the “Aperture Science Hand Held Portal Device” (portal gun).

The game takes place through a series of test chambers that pit the player against increasingly difficult challenges. All of these challenges revolve around using the portal gun to overcome some particular obstacle and are all excellent fun.

Portal Momentum Puzzle

Portal Momentum Puzzle

The plot has a few amusing twists in it and is told through the narrative of GLaDOS, an artificial intelligence that directs the player through the test chambers whilst providing some amusing dark humour. All the while promising the reward of cake upon the completion of all test chambers.

Portal really is a game that needs to be experienced as my description of it really doesn’t do justice. The combination of unique game play, challenging puzzles and a humorous but simple plot line make for several hours of excellent fun!

Om Nom Urgh

November 29th, 2009 by Jeremy No comments »

Usually food at uni is pretty good but last night I got served this thing (we’re catered). God knows what was going on in the kitchen but it was terrible. Who serves a chicken boob with no sauce or any kind of seasoning!? Whats more, the “vegetables” consisted of cauliflower and yet more cauliflower. There was nothing else on offer apart from some bread. WTF?

The Abomination

The Abomination

Here’s to hoping this remains the worst uni food I will ever receive!