<?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>GeekPete &#187; Coding</title>
	<atom:link href="http://geekpete.com/blog/category/coding/feed" rel="self" type="application/rss+xml" />
	<link>http://geekpete.com/blog</link>
	<description>Computing, Cycling, horticulture, other stuff</description>
	<lastBuildDate>Fri, 04 May 2012 03:46:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Beardy weighs in on Old School programming methods</title>
		<link>http://geekpete.com/blog/coding/beardy-weighs-school-programming-methods</link>
		<comments>http://geekpete.com/blog/coding/beardy-weighs-school-programming-methods#comments</comments>
		<pubDate>Sat, 13 Jun 2009 01:45:11 +0000</pubDate>
		<dc:creator>Beardy</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[old school programming]]></category>
		<category><![CDATA[programming methods]]></category>

		<guid isPermaLink="false">http://geekpete.com/blog/?p=212</guid>
		<description><![CDATA[by guestblogger &#8220;Beardy&#8221; &#8212; Ok, I&#8217;m &#8220;old school&#8221; and proud of it, and yes the author of the article linked at the bottom of the page makes some excellent points. Yes, I do NOT miss having to write convoluted, upside-down &#8230; <a href="http://geekpete.com/blog/coding/beardy-weighs-school-programming-methods">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>by guestblogger &#8220;Beardy&#8221;</p>
<p>&#8212;</p>
<p>Ok, I&#8217;m &#8220;old school&#8221; and proud of it, and yes the author of the article linked at the bottom of the page makes some excellent points.</p>
<ul>
<li> Yes, I do NOT miss having to write convoluted, upside-down and inside-out self-modifying code just to save a few miserable bytes<strong>* </strong>! <em>(<strong>*</strong>and yes, I know there are still a few bare-metal scenarios where that is still the order of the day&#8230;</em>)</li>
<li> Yes, I do NOT miss having to do all my coding of OO GUI systems using hand-built text objects in CLI text editors!</li>
<li> Yes, I most certainly am grateful that &#8220;GOTO&#8221; has been relegated to the dustbin of history in all but hardcore bare-metal work.</li>
<li> And OH how I do NOT miss writing multithreaded applications with languages and OSes that did not support it inherently.</li>
</ul>
<p>However&#8230;</p>
<p>As onerous is it was to get a handle on initially and hideous to be a support programmer for when the original developer adopted a variation on the more commonly accepted (ie: M$ Win32 API&#8230;), Hungarian notation certainly does have advantages, especially when the code has to be viewed in multiple scenarios with various tools, most of which have no concept of the language or types.</p>
<p><em> (&#8230;rant warning&#8230;)</em><br />
More importantly, I take major issue with the blanket statements about memory management. Yes, it has improved a LOT and yes, modern languages, compilers and OSes have far more of it available and *can* use it very efficiently, BUT, many programmers seem to view memory as an inexhaustible resource and rather than just not focussing on being memory misers, they ignore good design templates to reinvent the wheel or worse reinvent a square wheel!!! So rather than take a minute to consider the implications of collecting a massive dataset into a local list or collection &#8220;just because it is easier for them&#8221; when they could write a more efficient algorithm in the first place and only collect a fraction of the data for the same outcome and let the memory manager worry about dealing with the load. Talk about backward progress&#8230;</p>
<p>&#8220;Old-school programming techniques you probably don&#8217;t miss&#8221;<br />
<a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;articleId=9132061" target="_blank">http://www.computerworld.com/action/article.do?command=viewArticleBasic&amp;articleId=9132061</a></p>
]]></content:encoded>
			<wfw:commentRss>http://geekpete.com/blog/coding/beardy-weighs-school-programming-methods/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Go faster with the same CPU&#8230;just throw the work to the GPU</title>
		<link>http://geekpete.com/blog/coding/faster-cpujust-throw-work-gpu</link>
		<comments>http://geekpete.com/blog/coding/faster-cpujust-throw-work-gpu#comments</comments>
		<pubDate>Wed, 10 Jun 2009 07:36:18 +0000</pubDate>
		<dc:creator>Beardy</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[nvidia cuda]]></category>

		<guid isPermaLink="false">http://geekpete.com/blog/?p=205</guid>
		<description><![CDATA[by guestblogger &#8220;Beardy&#8221; &#8212; Most of you will be aware of nVidia&#8217;s CUDA technology. Essentially nVidia is making a play for the hearts and minds of the HPC community by giving them a more bang for their buck without buying &#8230; <a href="http://geekpete.com/blog/coding/faster-cpujust-throw-work-gpu">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>by guestblogger &#8220;Beardy&#8221;</p>
<p>&#8212;</p>
<p>Most of you will be aware of nVidia&#8217;s CUDA technology. Essentially nVidia is making a play for the hearts and minds of the HPC community by giving them a more bang for their buck without buying mainframes.</p>
<p>If you recognise the following, Opteron, UltraSPARC, EMT64, POWER, CBE or Cell, then you are probably in the market for the PC-universe equivalent of a turbocharger, enter nVidia&#8217;s CUDA technology. If you have PCI-E bus available and can cope with C, then have we got a deal for you! Have a read of the links at the end of the article for more details.</p>
<p>As always, the reviewers at Toms Hardware focus on the raw processing capabilities (which are impressive), but also as usual, because of the limited time for testing they didn&#8217;t encounter (or at least report on any encounter) with the downsides of using CUDA. Aside from the need to ensure better cooling for the GPU than its maker probably supplied, there are some other little considerations that need to be accommodated.</p>
<p>There is no such thing as a free lunch. From personal experience I can say that while CUDA-enabled code churns massive maths functions in a fraction of the time as the system CPU (nVidia 8600GT with 512MB in a Pentium IV H/T 3.2GHz with 3GB) for BOINC work, there is a noticeable trade-off. When the system is grinding away on some intensive function, the graphics display refresh is mind numbingly slow&#8230;. think back to old EGA-era ISA-bus cards in max res&#8230;.ouch!</p>
<p>There is also an interesting problem with coding for CUDA-enabled cards. Ignoring the fact that only nVidia make &#8216;em, there are some unusual scenarios that arise. Those of us who loathe programming using try-catch-exception paradigm would rarely encounter it, but if your compiler still builds on an underlying function library that employs it, you will still hit it.</p>
<p>Specifically, consider the following scenario;  application is written as multi-threaded, multi-processor for grid-enabled operation. Bleeding-edge stuff for most developers. Now break from the SMP architecture and depend on DMA or some other memory block handover technique for moving datasets in and out of the modules.  What happens if an exception is thrown in a CPU (or GPU) that is not within the same OS or system management processor ?  Unless the code is written to specifically handle these cases, death spirals occur&#8230;. you know the kind, &#8220;Dialog *this* has thrown an exception and need to terminate. Press Ok to abort&#8221;&#8230; wash, rinse, repeat&#8230; oops&#8230; um, sorry, how did you plan to handle the exception if the exception handler is the bit going *boom*. Uh oh.</p>
<p>The above scenario occurs rather regularly in a FORTRAN program module (running in the host CPU) that links to a C module (that runs in the GPU), with the unfortunate outcome that the CPU-side module keeps expecting a result block from the C block that never arrives (because the process has terminated unexpectedly), leaving memory invalid and throwing a termination code that &#8220;looks&#8221; ok, but in fact is not. The root cause in this case derives from a complex math divide-by-zero error that does not have a denominator-check. No biggie *IF* the system were operating under an SMP architecture, but oops, no we ain&#8217;t.</p>
<p>&#8220;Your mileage may vary&#8221; is an understatement. CUDA is truly amazing for certain areas of endeavour, but like all solutions, there is no such thing as a magic bullet. More importantly, on the back of Microsoft&#8217;s missive banishing &#8220;memcpy()&#8221; to the bin, the QUALITY of code is critical to delivering any improvement.</p>
<p>&#8220;CUDA-Enabled Apps: Measuring Mainstream GPU Performance&#8221;<br />
&lt;<a href="http://www.tomshardware.com/reviews/nvidia-cuda-gpgpu,2299.html" target="_blank">http://www.tomshardware.com/reviews/nvidia-cuda-gpgpu,2299.html</a>&gt;</p>
<p>&#8220;Use your NVIDIA GPU for scientific computing&#8221;  (BOINC)<br />
&lt;<a href="http://boinc.berkeley.edu/cuda.php" target="_blank">http://boinc.berkeley.edu/cuda.php</a>&gt;</p>
<p>&#8220;NVIDIA CUDA Compute Unified Device Architecture&#8221;<br />
&lt;<a href="http://developer.download.nvidia.com/compute/cuda/1_1/NVIDIA_CUDA_Programming_Guide_1.1.pdf" target="_blank">http://developer.download.nvidia.com/compute/cuda/1_1/NVIDIA_CUDA_Programming_Guide_1.1.pdf</a>&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://geekpete.com/blog/coding/faster-cpujust-throw-work-gpu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

