<?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>Deep Beta</title>
	<atom:link href="http://deep-beta.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://deep-beta.co.uk</link>
	<description>That&#039;s the way the cookie crumbles</description>
	<lastBuildDate>Sun, 19 Feb 2012 16:47:20 +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>Octree in Place</title>
		<link>http://deep-beta.co.uk/octree-place/</link>
		<comments>http://deep-beta.co.uk/octree-place/#comments</comments>
		<pubDate>Sun, 19 Feb 2012 16:46:39 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[GLSL]]></category>
		<category><![CDATA[Voxel]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=1002</guid>
		<description><![CDATA[Last two nights were all about Octree, however this morning last bug has been hunted down. Now I need to write a structure of report, good luck me Oh and some metrics:]]></description>
			<content:encoded><![CDATA[<div id="attachment_1003" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/02/Octree-in-place.png"><img class="size-large wp-image-1003" title="Grid 64x64x64 and 107 average FPS.  " src="http://deep-beta.co.uk/wp-content/uploads/2012/02/Octree-in-place-1024x595.png" alt="" width="640" /></a><p class="wp-caption-text">Step forward <img src='http://deep-beta.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p></div>
<p>Last two nights were all about Octree, however this morning last bug has been hunted down.<br />
Now I need to write a structure of report, good luck me <img src='http://deep-beta.co.uk/wp-includes/images/smilies/icon_neutral.gif' alt=':|' class='wp-smiley' /> </p>
<p>Oh and some metrics:</p>
<p><img src="https://docs.google.com/spreadsheet/oimg?key=0ApU70qk9QisOdGwtUFJJRzhSSjdzT1JCRF9WTDRLSGc&#038;oid=1&#038;zx=fz6jm92zstek" /></p>
<p><img src="https://docs.google.com/spreadsheet/oimg?key=0ApU70qk9QisOdGwtUFJJRzhSSjdzT1JCRF9WTDRLSGc&#038;oid=2&#038;zx=ng0ofpgzm7ek" /></p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/octree-place/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Editable Grid.. yay!</title>
		<link>http://deep-beta.co.uk/editable-grid-yay/</link>
		<comments>http://deep-beta.co.uk/editable-grid-yay/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 21:29:55 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Voxel Engine]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Voxel]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=991</guid>
		<description><![CDATA[Finally, my grid is editable now. We can edit or remove current blocks &#8211; adding new ones will be introduced after optimisation stage. Current version supports 4 standard blocks (Blue, Green, Yellow, Brown) and 1 point light (Blue with circle in the middle). In this iteration of &#8220;boxel engine&#8221; regenerateBuffers method updates nearest block that [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_992" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-3970-Lights-17-Mem-80348K-Mem-Peak-80856K-FPS-372-avg.-FPS-372.165-09012012-203225.jpg"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-3970-Lights-17-Mem-80348K-Mem-Peak-80856K-FPS-372-avg.-FPS-372.165-09012012-203225.jpg" alt="" title="Cubes 3970 Lights 17 Mem 80348K Mem Peak 80856K FPS 372 avg. FPS 372.165 09012012 203225" width="640" class="size-full wp-image-992" /></a><p class="wp-caption-text">Editable grid 16x16x16</p></div>
<p>Finally, my grid is editable now. </p>
<p>We can edit or remove current blocks &#8211; adding new ones will be introduced after optimisation stage.<br />
Current version supports 4 standard blocks (Blue, Green, Yellow, Brown) and 1 point light (Blue with circle in the middle).</p>
<p>In this iteration of &#8220;boxel engine&#8221;  regenerateBuffers method updates nearest block that collides with ray fired from camera POV within worldGrid 3 dimensional table, after that, buffers that contain shadow and light powers are recalculated, at the end two openGL methods are called (for each buffer):</p>
<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;glBindBuffer<span style="color: #008000;">&#40;</span>GL_ARRAY_BUFFER, vertexbuffer<span style="color: #008000;">&#91;</span>sectorID<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />
&nbsp;glBufferSubData<span style="color: #008000;">&#40;</span>GL_ARRAY_BUFFER, <span style="color: #0000dd;">0</span>, frame_vertices<span style="color: #008000;">&#91;</span>sectorID<span style="color: #008000;">&#93;</span>.<span style="color: #007788;">size</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #000040;">*</span><span style="color: #0000dd;">sizeof</span><span style="color: #008000;">&#40;</span>glm<span style="color: #008080;">::</span><span style="color: #007788;">vec3</span><span style="color: #008000;">&#41;</span>, &nbsp;<span style="color: #000040;">&amp;</span>frame_vertices<span style="color: #008000;">&#91;</span>sectorID<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></td></tr></tbody></table></div>
<p>first, buffer is bind, and then values are updated, starting from index 0 and then updating whole buffer.<br />
Optimisation, that I will be introducing soon, is updating only changed values that will reduce data size.<br />
That has to be send to graphics card.</p>
<p>Note:</p>
<p>Grid 64 recalculation takes a while :S</p>
<p>Metrics will be added soon.</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/editable-grid-yay/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>100 will be about: Shadows and some point Light(s)</title>
		<link>http://deep-beta.co.uk/100-about-shadows/</link>
		<comments>http://deep-beta.co.uk/100-about-shadows/#comments</comments>
		<pubDate>Sat, 07 Jan 2012 17:22:46 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[Voxel Engine]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Voxel]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=977</guid>
		<description><![CDATA[Shadow value for each cube is stored in separate grid, values are sent to shader and then output is altered. It all depends on value. The value is calculated based on number of obstacles on the way between light and current cube. Below you can find some metrics: Earlier I have introduced point light to [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_980" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-262144-Mem-642832K-Mem-Peak-744068K-FPS-40-avg.-FPS-42.1503-07012012-165612.jpg"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-262144-Mem-642832K-Mem-Peak-744068K-FPS-40-avg.-FPS-42.1503-07012012-165612.jpg" alt="" title="Cubes 262144 Mem 642832K Mem Peak 744068K FPS 40 avg. FPS 42.1503 07012012 165612" width="640" class="size-full wp-image-980" /></a><p class="wp-caption-text">Shadows added - calculated on GPU but still works fine!</p></div>
<p>Shadow value for each cube is stored in separate grid, values are sent to shader and then output is altered. It all depends on value.<br />
The value is calculated based on number of obstacles on the way between light and current cube.<br />
Below you can find some metrics:</p>
<div id="attachment_981" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/shadow.png"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/shadow.png" alt="" title="shadow" width="640" class="size-full wp-image-981" /></a><p class="wp-caption-text">Metrics for shadow added.</p></div>
<p>Earlier I have introduced point light to engine, there is example of one point light &#8211; shown below.<br />
<div id="attachment_982" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-262144-Mem-688628K-Mem-Peak-790600K-FPS-34-avg.-FPS-35.0108-07012012-170448.jpg"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-262144-Mem-688628K-Mem-Peak-790600K-FPS-34-avg.-FPS-35.0108-07012012-170448.jpg" alt="" title="Cubes 262144 Mem 688628K Mem Peak 790600K FPS 34 avg. FPS 35.0108 07012012 170448" width="640" class="size-full wp-image-982" /></a><p class="wp-caption-text">Point lights introduced.. performance drops.. but that&#039;s good. </p></div></p>
<p>Below 510 point lights on 64x64x64 cubes grid.</p>
<div id="attachment_986" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-262144-Lights-510-Mem-689088K-Mem-Peak-790536K-FPS-36-avg.-FPS-36.3553-07012012-222015.jpg"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/Cubes-262144-Lights-510-Mem-689088K-Mem-Peak-790536K-FPS-36-avg.-FPS-36.3553-07012012-222015.jpg" alt="" title="Cubes 262144 Lights 510 Mem 689088K Mem Peak 790536K FPS 36 avg. FPS 36.3553 07012012 222015" width="640"  class="size-full wp-image-986" /></a><p class="wp-caption-text">Point lights on 64 grid - 36 FPS.. pretty Ok.</p></div>
<p>And its metrics.. </p>
<div id="attachment_987" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/64.png"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/64.png" alt="" title="64" width="640" class="size-full wp-image-987" /></a><p class="wp-caption-text">512 Point Lights took 2 Friends Episodes to load in </p></div>
<p>Metrics for grid of 32x32x32 cubes, below:</p>
<div id="attachment_988" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2012/01/32.png"><img src="http://deep-beta.co.uk/wp-content/uploads/2012/01/32.png" alt="" title="32" width="640" class="size-full wp-image-988" /></a><p class="wp-caption-text">Wait.. What?!?.. straight Line?</p></div>
<p>Why the results for point lights are almost the same?<br />
All the calculations are precomputed on CPU so we are dealing with fixed buffer of light values &#8211; which is fair enough, however I need to optimise loading process so it will allow to add lights in real time.</p>
<p>Next step, editable terrain.. </p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/100-about-shadows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Directional Light performance impact on the scene</title>
		<link>http://deep-beta.co.uk/directional-light-performance-impact-scene/</link>
		<comments>http://deep-beta.co.uk/directional-light-performance-impact-scene/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 03:34:10 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Voxel Engine]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Voxel]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=969</guid>
		<description><![CDATA[Very simple calculation of directional light had noticeable impact on the performance, table below shows it: and yeah, SW:TOR is pretty Ok but nothing can win with &#8220;coding hunger&#8221;.]]></description>
			<content:encoded><![CDATA[<div id="attachment_970" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cubes-262144-Mem-540892K-Mem-Peak-641888K-FPS-33-avg.-FPS-33.3537-22122011-030404.jpg"><img class="size-full wp-image-970" title="Cubes 262144 Mem 540892K Mem Peak 641888K FPS 33 avg. FPS 33.3537 22122011 030404" src="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cubes-262144-Mem-540892K-Mem-Peak-641888K-FPS-33-avg.-FPS-33.3537-22122011-030404.jpg" alt="" width="640" /></a><p class="wp-caption-text">Directional Lighted &quot;boxel&quot; scene</p></div>
<p>Very simple calculation of directional light had noticeable impact on the performance, table below shows it: </p>
<div id="attachment_971" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/chart_1.png"><img src="http://deep-beta.co.uk/wp-content/uploads/2011/12/chart_1.png" alt="" title="chart_1" width="640"  class="size-full wp-image-971" /></a><p class="wp-caption-text">Performance impact for different number of boxes.</p></div>
<p>and yeah, SW:TOR is pretty Ok but nothing can win with &#8220;coding hunger&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/directional-light-performance-impact-scene/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finally.. textures with metrics</title>
		<link>http://deep-beta.co.uk/finally-textures-metrics/</link>
		<comments>http://deep-beta.co.uk/finally-textures-metrics/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 12:16:05 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Voxel Engine]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=960</guid>
		<description><![CDATA[This evening code hunger got me badly.. tomorrow, big launch of SW:TOR and lets be honest about it.. I will do no more honours project related work over this Christmas. Anyway, in order to evaluate the software I have collected FPS and Memory Usage of the application. Base metrics are like this: Funny enough, in [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_961" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cubes-262144-Mem-399688K-Mem-Peak-502988K-FPS-551-avg.-FPS-125.403-20122011-013809.jpg"><img class="size-full wp-image-961" title="Cubes 262144 Mem 399688K Mem Peak 502988K FPS 551 avg. FPS 125.403 20122011 013809" src="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cubes-262144-Mem-399688K-Mem-Peak-502988K-FPS-551-avg.-FPS-125.403-20122011-013809.jpg" alt="" width="640" /></a><p class="wp-caption-text">Textured 262144 cubes</p></div>
<p>This evening code hunger got me badly.. tomorrow, big launch of SW:TOR and lets be honest about it.. I will do no more honours project related work over this Christmas.</p>
<p>Anyway, in order to evaluate the software I have collected FPS and Memory Usage of the application.</p>
<div id="attachment_962" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cart-textured.png"><img class="size-full wp-image-962" title="Cart-textured" src="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cart-textured.png" alt="" width="640" /></a><p class="wp-caption-text">Metrics for above project</p></div>
<p>Base metrics are like this:</p>
<div id="attachment_963" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cart-base.png"><img class="size-full wp-image-963" title="Cart-base" src="http://deep-beta.co.uk/wp-content/uploads/2011/12/Cart-base.png" alt="" width="640" /></a><p class="wp-caption-text">Base Metrics</p></div>
<p>Funny enough, in texture integration progress I have made some optimisation, frame rate went up by slight cost of memory.. I am happy, I can deal with that.</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/finally-textures-metrics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using OffloadCL to compile C++ AMP code for OpenCL</title>
		<link>http://deep-beta.co.uk/offloadcl-compile-c-amp-code-opencl/</link>
		<comments>http://deep-beta.co.uk/offloadcl-compile-c-amp-code-opencl/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 10:19:18 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[Offload]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenCL]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=896</guid>
		<description><![CDATA[C++ AMP (Accelerated Massive Parallelism) is a GPGPU API (STL-like library) implemented by Microsoft in c++11. Lately, I had a pleasure to use an alternative tool-kit that is not limited to DirectX. Technology that can be used on any device &#8211; that can run OpenCL &#8211; which not only reaches the performance offered by the [...]]]></description>
			<content:encoded><![CDATA[<p>C++ AMP (Accelerated Massive Parallelism) is a GPGPU API (STL-like library) implemented by Microsoft in c++11.</p>
<p>Lately, I had a pleasure to use an alternative tool-kit that is not limited to DirectX.<br />
Technology that can be used on any device &#8211; that can run OpenCL &#8211; which not only reaches the performance offered by the C++ AMP but even goes beyond it &#8211; in some cases.</p>
<p>More information about the <a href="http://www.codeplay.com/" target="_blank">OffloadCL tool-kit</a> &#8211; note that the OffloadCL tool-kit does not implement C++ AMP, it&#8217;s the flexible design allows the possibility to make it work <strong>C++ AMP code</strong>; see example below.</p>
<p>The showcase I want to present in this post is a Binomial Option Pricing Model (BOPM) &#8211; my objective was to &#8220;port&#8221; the code from this <a href="http://blogs.msdn.com/b/nativeconcurrency/archive/2011/10/26/binomial-option-using-c-amp.aspx" target="_blank">blog post</a> so it will be using OffloadCL tool-kit.</p>
<p>More information about <a href="http://en.wikipedia.org/wiki/Binomial_options_pricing_model" target="_blank">BOPM</a>.</p>
<p>After few hours of setting up OffloadCL, few &#8220;why is that not working?&#8221; later I was ready to start my first application using OffloadCL tool-kit.. Well almost..</p>
<p>I had no idea what are the methods and approaches used in the tool-kit &#8211; there is no official documentation &#8211; yet &#8211; however there was a couple of ready examples and header file, for the rescue!</p>
<p>Few minutes later I was good to go.</p>
<p>When I started reading the C++ AMP source code, was pretty usual &#8211; small functions that do the job, few #define etc etc.</p>
<div class="codecolorer-container cpp geshi" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br /></div></td><td><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666;">//----------------------------------------------------------------------------</span><br />
<span style="color: #666666;">// Sequential(CPU) binomial option calculation</span><br />
<span style="color: #666666;">//----------------------------------------------------------------------------</span><br />
<span style="color: #0000ff;">void</span> binomial_options_cpu<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; <span style="color: #0000ff;">const</span> <span style="color: #0000ff;">unsigned</span> data_size <span style="color: #000080;">=</span> MAX_OPTIONS<span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <br />
<br />
&nbsp; &nbsp; <span style="color: #666666;">// this is like GPU kernel - where we have the meat</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span> i <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> i <span style="color: #000080;">&lt;</span> data_size<span style="color: #008080;">;</span> i<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">float</span> call<span style="color: #008000;">&#91;</span>NUM_STEPS <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// Compute values at expiration date:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// call option value at period end is V(T) = S(T) - X</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// if S(T) is greater than X, or zero otherwise.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// The computation is similar for put options.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j <span style="color: #000080;">&lt;=</span> NUM_STEPS<span style="color: #008080;">;</span> j<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;call<span style="color: #008000;">&#91;</span>j<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> expiry_call_value<span style="color: #008000;">&#40;</span>V_S<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>, V_X<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>, V_VDT<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span>, j<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666;">// Walk backwards up binomial tree</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> j <span style="color: #000080;">=</span> NUM_STEPS<span style="color: #008080;">;</span> j <span style="color: #000080;">&gt;</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> j<span style="color: #000040;">--</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">for</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> k <span style="color: #000080;">=</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span> k <span style="color: #000080;">&lt;</span> <span style="color: #000080;">=</span> j <span style="color: #000040;">-</span> <span style="color: #0000dd;">1</span><span style="color: #008080;">;</span> k<span style="color: #000040;">++</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; call<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> V_PU_BY_DF<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000040;">*</span> call<span style="color: #008000;">&#91;</span>k <span style="color: #000040;">+</span> <span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span> <span style="color: #000040;">+</span> V_PD_BY_DF<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000040;">*</span> call<span style="color: #008000;">&#91;</span>k<span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; CALL_VALUE_CPU<span style="color: #008000;">&#91;</span>i<span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> call<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></td></tr></tbody></table></div>
<p><em>Code from <a href="http://blogs.msdn.com/b/nativeconcurrency/archive/2011/10/26/binomial-option-using-c-amp.aspx" target="_blank">BinomialOptions.cpp</a></p>
<p>Code above is CPU version of binomial calculation, fairly simple.</p>
<p>However GPU version of this function is divided in two.</p>
<p>The method that prepares all buffers, in parallel_for_each function kernel method does all the calculations, for source code please download from <a href="http://blogs.msdn.com/b/nativeconcurrency/archive/2011/10/26/binomial-option-using-c-amp.aspx" target="_blank">here</a>.</p>
<p>This is where things got complicated.. I had no big experience with parallel programming so I thought that I will need to spend a lot of time on research and learning, but apparently OffloadCL tool-kit made my work very easy..</p>
<p>What I had to do was to integrate the Offload compiler to the solution for the latest VS11 &#8211; there will be proper integration in the future.</p>
<p>Next step was to write some code in that file, small modification of the c++ code was enough to make the example work.</p>
<p><a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/OffloadCL-Binomial1.png"><img src="http://deep-beta.co.uk/wp-content/uploads/2011/12/OffloadCL-Binomial1.png" alt="" title="OffloadCL-Binomial" width="640" height="881" class="aligncenter size-full wp-image-948" /></a></p>
<p>Get the <a href="http://deep-beta.co.uk/wp-content/uploads/2011/12/Binominal-Offload.zip"> source </a> files for this post.</p>
<p>The OffloadCL tool-kit is still being improved, however I like the way how it works at the moment, the code is C like, simple and efficient.<br />
I hope it will stay this way.</p>
<p>It was very easy and surprisingly straightforward to port C++ AMP code to OpenCL devices using OffloadCL compiler, looking forward to developing more using it!</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/offloadcl-compile-c-amp-code-opencl/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Introduction to graphics programming submitted.</title>
		<link>http://deep-beta.co.uk/introduction-graphics-programming-submitted/</link>
		<comments>http://deep-beta.co.uk/introduction-graphics-programming-submitted/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 17:32:43 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[GLSL]]></category>
		<category><![CDATA[n-Gine]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=880</guid>
		<description><![CDATA[some screen shots from assembly instruction project, n-Gine saved me again.. above result of the work from one night..]]></description>
			<content:encoded><![CDATA[
<a href='http://deep-beta.co.uk/introduction-graphics-programming-submitted/ngine-by-lukasz-iwanski-28112011-040729-2/' title='nGine by Lukasz Iwanski 28112011 040729'><img width="150" height="150" src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-28112011-0407291-150x150.jpg" class="attachment-thumbnail" alt="nGine by Lukasz Iwanski 28112011 040729" title="nGine by Lukasz Iwanski 28112011 040729" /></a>
<a href='http://deep-beta.co.uk/introduction-graphics-programming-submitted/ngine-by-lukasz-iwanski-28112011-040736/' title='nGine by Lukasz Iwanski 28112011 040736'><img width="150" height="150" src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-28112011-040736-150x150.jpg" class="attachment-thumbnail" alt="nGine by Lukasz Iwanski 28112011 040736" title="nGine by Lukasz Iwanski 28112011 040736" /></a>
<a href='http://deep-beta.co.uk/introduction-graphics-programming-submitted/ngine-by-lukasz-iwanski-28112011-044728/' title='nGine by Lukasz Iwanski 28112011 044728'><img width="150" height="150" src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-28112011-044728-150x150.jpg" class="attachment-thumbnail" alt="nGine by Lukasz Iwanski 28112011 044728" title="nGine by Lukasz Iwanski 28112011 044728" /></a>
<a href='http://deep-beta.co.uk/introduction-graphics-programming-submitted/ngine-by-lukasz-iwanski-28112011-044744/' title='nGine by Lukasz Iwanski 28112011 044744'><img width="150" height="150" src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-28112011-044744-150x150.jpg" class="attachment-thumbnail" alt="nGine by Lukasz Iwanski 28112011 044744" title="nGine by Lukasz Iwanski 28112011 044744" /></a>
<a href='http://deep-beta.co.uk/introduction-graphics-programming-submitted/ngine-by-lukasz-iwanski-28112011-044800-2/' title='nGine by Lukasz Iwanski 28112011 044800'><img width="150" height="150" src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-28112011-0448001-150x150.jpg" class="attachment-thumbnail" alt="nGine by Lukasz Iwanski 28112011 044800" title="nGine by Lukasz Iwanski 28112011 044800" /></a>
<a href='http://deep-beta.co.uk/introduction-graphics-programming-submitted/ngine-by-lukasz-iwanski-28112011-050247-2/' title='nGine by Lukasz Iwanski 28112011 050247'><img width="150" height="150" src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-28112011-0502471-150x150.jpg" class="attachment-thumbnail" alt="nGine by Lukasz Iwanski 28112011 050247" title="nGine by Lukasz Iwanski 28112011 050247" /></a>

<p>some screen shots from assembly instruction project, n-Gine saved me again.. above result of the work from one night..</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/introduction-graphics-programming-submitted/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphics Programming wee update</title>
		<link>http://deep-beta.co.uk/graphics-programming-wee-update/</link>
		<comments>http://deep-beta.co.uk/graphics-programming-wee-update/#comments</comments>
		<pubDate>Tue, 22 Nov 2011 02:09:12 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Game]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=870</guid>
		<description><![CDATA[some progress of Graphics Programming coursework &#8211; pause screen and rotation. At the moment buffer of vertices is regenerated each frame &#8211; need to switch to DYNAMIC_DRAW.]]></description>
			<content:encoded><![CDATA[<div id="attachment_871" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-22112011-020136.jpg"><img src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-22112011-020136.jpg" alt="" title="nGine by Lukasz Iwanski 22112011 020136" width="640" class="size-full wp-image-871" /></a><p class="wp-caption-text">Pause screen + Animation</p></div>
<p>some progress of Graphics Programming coursework &#8211; pause screen and rotation. At the moment buffer of vertices is regenerated each frame &#8211; need to switch to DYNAMIC_DRAW.</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/graphics-programming-wee-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphics Programming &#8211; small progress</title>
		<link>http://deep-beta.co.uk/graphics-programming-small-progress/</link>
		<comments>http://deep-beta.co.uk/graphics-programming-small-progress/#comments</comments>
		<pubDate>Sun, 20 Nov 2011 21:52:07 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[University]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[GLSL]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=866</guid>
		<description><![CDATA[Today I have managed to spend few minutes on Graphics Programming Coursework.. effect? SkyBox and clean code of n-Gine. Next step.. animations.]]></description>
			<content:encoded><![CDATA[<div id="attachment_868" class="wp-caption aligncenter" style="width: 650px"><a href="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-20112011-214637.jpg"><img src="http://deep-beta.co.uk/wp-content/uploads/2011/11/nGine-by-Lukasz-Iwanski-20112011-214637.jpg" alt="" title="nGine by Lukasz Iwanski 20112011 214637" width="640" class="size-full wp-image-868" /></a><p class="wp-caption-text">Small progress: Skybox</p></div>
<p>Today I have managed to spend few minutes on Graphics Programming Coursework.. effect? SkyBox and clean code of n-Gine. </p>
<p>Next step.. animations. </p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/graphics-programming-small-progress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exhibition</title>
		<link>http://deep-beta.co.uk/exhibition/</link>
		<comments>http://deep-beta.co.uk/exhibition/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 22:48:04 +0000</pubDate>
		<dc:creator>Lukasz Iwanski</dc:creator>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Kinect]]></category>
		<category><![CDATA[OpenGL]]></category>

		<guid isPermaLink="false">http://deep-beta.co.uk/?p=863</guid>
		<description><![CDATA[Today I was helping in setting up system I was helping in developing n-Gine branch that supports Kinect.]]></description>
			<content:encoded><![CDATA[<p><iframe width="640" height="480" src="http://www.youtube.com/embed/-n6XduFaU90" frameborder="0" allowfullscreen></iframe></p>
<p>Today I was helping in setting up system I was helping in developing n-Gine branch that supports Kinect.</p>
]]></content:encoded>
			<wfw:commentRss>http://deep-beta.co.uk/exhibition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

