<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Jeremy Kemp &#187; Programming</title>
	<atom:link href="http://www.jeremykemp.co.uk/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jeremykemp.co.uk</link>
	<description>//TODO</description>
	<lastBuildDate>Sun, 15 Jan 2012 15:32:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Unit Converter &#8211; Currency!</title>
		<link>http://www.jeremykemp.co.uk/13/06/2011/unit-converter-currency/</link>
		<comments>http://www.jeremykemp.co.uk/13/06/2011/unit-converter-currency/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 09:43:33 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[android sdk]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[unit converter]]></category>

		<guid isPermaLink="false">http://www.jeremykemp.co.uk/?p=292</guid>
		<description><![CDATA[I&#8217;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 &#8220;full internet access&#8221; permission as well as &#8220;view network state&#8221;. I&#8217;d appreciated it if you could let me know of any improvements [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.jeremykemp.co.uk/wp-content/uploads/2011/06/currency-unit.png"><img class="size-medium wp-image-295 alignright" title="Unit Converter" src="http://www.jeremykemp.co.uk/wp-content/uploads/2011/06/currency-unit-180x300.png" alt="Unit Converter Currency Selection" width="180" height="300" /></a></p>
<p>I&#8217;ve just released an update for my Android app which now supports currency conversion!</p>
<p>All global currencies are supported with live exchange rates being fed from the internet. Obviously, it now requires the &#8220;full internet access&#8221; permission as well as &#8220;view network state&#8221;.</p>
<p style="text-align: left;">I&#8217;d appreciated it if you could let me know of any improvements that you&#8217;d like, or any problems with the application that you may be experiencing so that I can improve the application.</p>
<p style="text-align: left;">You can get Unit Converter directly from your phone <a title="here" href="market://details?id=com.joopware.unitconverter">here</a> or from the Android Market website <a title="here" href="https://market.android.com/details?id=com.joopware.unitconverter">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremykemp.co.uk/13/06/2011/unit-converter-currency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Physics System</title>
		<link>http://www.jeremykemp.co.uk/18/05/2011/custom-physics-system/</link>
		<comments>http://www.jeremykemp.co.uk/18/05/2011/custom-physics-system/#comments</comments>
		<pubDate>Wed, 18 May 2011 14:43:30 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Video Games]]></category>
		<category><![CDATA[Computer Games]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Physics Engine]]></category>

		<guid isPermaLink="false">http://www.jeremykemp.co.uk/?p=276</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>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!</p>
<p>&nbsp;</p>
<p style="text-align: center;"><a href="http://www.jeremykemp.co.uk/showreel/"><img class="size-large wp-image-272 aligncenter" title="Physics Screenshot" src="http://www.jeremykemp.co.uk/wp-content/uploads/2011/02/Physics-Screenshot-e1302517607476-1024x349.png" alt="Screenshot of Custom Physics System" width="491" height="167" /></a></p>
<p style="text-align: center;">&nbsp;</p>
<p>&nbsp;</p>
<p>I&#8217;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.</p>
<p>Head on over to my <a title="Showreel" href="http://www.jeremykemp.co.uk/showreel/" target="_blank">showreel</a> to learn about all of the cool features of the system as well as a download link!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremykemp.co.uk/18/05/2011/custom-physics-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git and GitHub!</title>
		<link>http://www.jeremykemp.co.uk/09/02/2011/git-and-github/</link>
		<comments>http://www.jeremykemp.co.uk/09/02/2011/git-and-github/#comments</comments>
		<pubDate>Wed, 09 Feb 2011 21:27:27 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[GitHub]]></category>

		<guid isPermaLink="false">http://www.jeremykemp.co.uk/?p=239</guid>
		<description><![CDATA[Just a quick update on my Unit Converter App. I&#8217;ve just switched over to Git from Subversion to coincide with the creation of my new GitHub account. Unit Converter&#8217;s code is now available to view and modify for all! Access the repository here!]]></description>
			<content:encoded><![CDATA[<p>Just a quick update on my Unit Converter App. I&#8217;ve just switched over to Git from Subversion to coincide with the creation of my new <a href="https://github.com/Odc/" target="_blank">GitHub account</a>.</p>
<p>Unit Converter&#8217;s code is now available to view and modify for all!</p>
<p>Access the repository <a href="https://github.com/Odc/Unit-Converter" target="_blank">here</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremykemp.co.uk/09/02/2011/git-and-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shared Memory Tip</title>
		<link>http://www.jeremykemp.co.uk/07/02/2011/shared-memory-tip/</link>
		<comments>http://www.jeremykemp.co.uk/07/02/2011/shared-memory-tip/#comments</comments>
		<pubDate>Mon, 07 Feb 2011 15:39:37 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[CUDA]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uni]]></category>

		<guid isPermaLink="false">http://www.jeremykemp.co.uk/?p=195</guid>
		<description><![CDATA[As usual, I&#8217;m knee deep in CUDA optimising a fair few algorithms from various papers. Recently, I&#8217;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 [...]]]></description>
			<content:encoded><![CDATA[<p>As usual, I&#8217;m knee deep in CUDA optimising a fair few algorithms from various papers. Recently, I&#8217;ve been implementing the algorithms from <a href="http://www.computer.org/portal/web/csdl/doi/10.1109/ITNG.2010.230" target="_blank">this</a> 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.</p>
<p>My <a href="http://laurencedawson.com/" target="_blank">friend</a> 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.</p>
<p>Here is the original code before the change:</p>
<div class="geshi no cpp">
<div class="head">for (int i = 0; i &lt; gridDim.x; i ++)</div>
<ol>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; __shared__ <span class="kw4">int</span> row<span class="br0">&#91;</span>blockWidth<span class="br0">&#93;</span><span class="br0">&#91;</span>blockHeight<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; __shared__ <span class="kw4">int</span> column<span class="br0">&#91;</span>blockWidth<span class="br0">&#93;</span><span class="br0">&#91;</span>blockHeight<span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">//Code here fills row and column</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; __syncthreads<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">int</span> k <span class="sy1">=</span> <span class="nu0">0</span>; k <span class="sy3">&amp;</span>lt; blockWidth; k <span class="sy2">++</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="kw1">if</span><span class="br0">&#40;</span>row<span class="br0">&#91;</span>threadIdx.<span class="me1">y</span><span class="br0">&#93;</span><span class="br0">&#91;</span>k<span class="br0">&#93;</span> <span class="sy2">+</span> column<span class="br0">&#91;</span>k<span class="br0">&#93;</span><span class="br0">&#91;</span>threadIdx.<span class="me1">x</span><span class="br0">&#93;</span> <span class="sy3">&amp;</span>lt; value<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; value <span class="sy1">=</span> row<span class="br0">&#91;</span>threadIdx.<span class="me1">y</span><span class="br0">&#93;</span><span class="br0">&#91;</span>k<span class="br0">&#93;</span> <span class="sy2">+</span> column<span class="br0">&#91;</span>k<span class="br0">&#93;</span><span class="br0">&#91;</span>threadIdx.<span class="me1">x</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Here, we can see the change needed to drastically improve the running time of the algorithm:</p>
<div class="geshi no cpp">
<div class="head">unsigned int sum;</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw1">for</span><span class="br0">&#40;</span><span class="kw4">unsigned</span> <span class="kw4">int</span> k <span class="sy1">=</span> <span class="nu0">0</span>; k <span class="sy3">&amp;</span>lt; blockWidth; k <span class="sy2">++</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; sum <span class="sy1">=</span> row<span class="br0">&#91;</span>threadIdx.<span class="me1">y</span><span class="br0">&#93;</span><span class="br0">&#91;</span>k<span class="br0">&#93;</span> <span class="sy2">+</span> column<span class="br0">&#91;</span>k<span class="br0">&#93;</span><span class="br0">&#91;</span>threadIdx.<span class="me1">x</span><span class="br0">&#93;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>sum <span class="sy3">&amp;</span>lt; value<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp;value <span class="sy1">=</span> sum;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>Given that shared memory is so quick on CUDA, similar to an L1 cache on CPU, I wouldn&#8217;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.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremykemp.co.uk/07/02/2011/shared-memory-tip/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Android Development</title>
		<link>http://www.jeremykemp.co.uk/19/11/2010/android-development/</link>
		<comments>http://www.jeremykemp.co.uk/19/11/2010/android-development/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 14:35:19 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Apps]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[App]]></category>
		<category><![CDATA[sdk]]></category>
		<category><![CDATA[unit converter]]></category>

		<guid isPermaLink="false">http://www.jeremykemp.co.uk/?p=181</guid>
		<description><![CDATA[I&#8217;ve recently got myself a new phone sporting the Android operating system. It&#8217;s a great little device and sparked my interest in developing for the platform. To ease myself into it, I&#8217;ve developed a simple unit conversion app to help teach me the core features of the Android SDK whilst providing something that I can [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently got myself a new phone sporting the Android operating system. It&#8217;s a great little device and sparked my interest in developing for the platform.</p>
<p>To ease myself into it, I&#8217;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!</p>
<p><a href="http://www.jeremykemp.co.uk/wp-content/uploads/2010/11/original-unit.png"><img src="http://www.jeremykemp.co.uk/wp-content/uploads/2010/11/original-unit-200x300.png" alt="" title="Unit Selection Screen" width="200" height="300" class="aligncenter size-medium wp-image-182" /></a></p>
<p>At the moment, it supports simple units and conversions such as area, length, and volume but I&#8217;m currently expanding to include density, memory sizes, and currency.</p>
<p>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.</p>
<p>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!</p>
<p>Head on over to the <a href="market://details?id=com.joopware.unitconverter">Android Market</a> or <a href="http://www.appbrain.com/app/unit-converter/com.joopware.unitconverter">AppBrain</a> and download my modest little app!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremykemp.co.uk/19/11/2010/android-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CUDA cuPrintf</title>
		<link>http://www.jeremykemp.co.uk/08/02/2010/cuda-cuprintf/</link>
		<comments>http://www.jeremykemp.co.uk/08/02/2010/cuda-cuprintf/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 12:06:08 +0000</pubDate>
		<dc:creator>Jeremy</dc:creator>
				<category><![CDATA[CUDA]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[-deviceemu]]></category>
		<category><![CDATA[cuPrintf]]></category>

		<guid isPermaLink="false">http://www.jeremykemp.co.uk/?p=124</guid>
		<description><![CDATA[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. [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got an Nvidia developer account a few days ago which gave me access to a very useful library to use with CUDA.</p>
<p>cuPrintf allows printf equivalent statements to be placed inside CUDA kernels without the need for -deviceemu.</p>
<p>The following example demonstrates a simple use for cuPrintf and displays the current thread ID.</p>
<div class="geshi no cpp">
<ol>
<li class="li1">
<div class="de1"><span class="co2">#include &lt;cuda.h&gt;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">#include &quot;cuPrintf.cu&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">__global__ <span class="kw4">void</span> cuPrintfExample<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw4">int</span> tid;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;tid <span class="sy1">=</span> blockIdx.<span class="me1">x</span> <span class="sy2">*</span> blockDim.<span class="me1">x</span> <span class="sy2">+</span> threadIdx.<span class="me1">x</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;cuPrintf<span class="br0">&#40;</span><span class="st0">&quot;%d<span class="es0">\n</span>&quot;</span>, tid<span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="kw4">int</span> main<span class="br0">&#40;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;cudaPrintfInit<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;cuPrintfExample <span class="sy1">&lt;&lt;&lt;</span> <span class="nu0">5</span>, <span class="nu0">2</span> <span class="sy1">&gt;&gt;&gt;</span> <span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;cudaPrintfDisplay<span class="br0">&#40;</span><span class="kw2">stdout</span>, <span class="kw2">true</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;cudaPrintfEnd<span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">return</span> <span class="nu0">0</span>;</div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>cudaPrintfInit and cudaPrintfEnd only need be called once throughout your entire project.</p>
<p>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).</p>
<p>cudaPrintfEnd simply frees the memory allocated by cudaPrintfInit.</p>
<p>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&#8217;t (false). The first arguemnt, specified by stdout in this example, simply defines the descriptor where the cuPrintf log is sent.</p>
<p>On another note, I&#8217;ve found that using cuPrintf impacts on the performance of my kernels, presumably due to the data transfer performed every time cuPrintfDisplay() is called.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jeremykemp.co.uk/08/02/2010/cuda-cuprintf/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
	</channel>
</rss>

