<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
   <channel>
      <title>A Programmer&apos;s Apology</title>
      <link>http://avitzur.hax.com/</link>
      <description></description>
      <language>en</language>
      <copyright>Copyright 2008</copyright>
      <lastBuildDate>Fri, 07 Mar 2008 13:24:33 -0800</lastBuildDate>
      <generator>http://www.sixapart.com/movabletype/?v=3.2</generator>
      <docs>http://blogs.law.harvard.edu/tech/rss</docs> 

            <item>
         <title>Art Project #11</title>
         <description><![CDATA[<p><center><a href="http://www.PacificT.com/Examples/CarFinal/"><img src="http://www.PacificT.com/Examples/CarFinal/graph.png" WIDTH=50% HEIGHT=50%></a></center></p>
<p>(Click the image to see the equations.)</p>]]></description>
         <link>http://avitzur.hax.com/2008/03/art_project_11_1.html</link>
         <guid>http://avitzur.hax.com/2008/03/art_project_11_1.html</guid>
         <category>Gallery</category>
         <pubDate>Fri, 07 Mar 2008 13:24:33 -0800</pubDate>
      </item>
            <item>
         <title>Virtual math spaces</title>
         <description><![CDATA[<a href="http://www.nada.kth.se/~gustavt/cybermath/"><img src="http://www.nada.kth.se/~gustavt/cybermath/dh4s.jpg"></a>
<p><a href="http://www.nada.kth.se/~gustavt/cybermath/">CyberMath</a> is a  shared virtual environment for exploring mathematics. I've long wanted to make Graphing Calculator into an authoring tool for such an interactive immersive space. The popularity and success of World of Warcraft hints at the possibilities in coming years.</p>

<p>Does anyone here use <a href="http://secondlife.com/">Second Life</a> or have any knowledge of <a href="http://www.croquetconsortium.org/index.php/Main_Page">Croquet</a>? The technology for building these spaces is maturing. I'm now wondering how to make it accessible to teachers and curriculum authors so that they can focus on the mathematical content and pedagogy while constructing mathematical landscapes.</p>

<p>I would welcome any advice.</p>]]></description>
         <link>http://avitzur.hax.com/2007/09/virtual_math_spaces.html</link>
         <guid>http://avitzur.hax.com/2007/09/virtual_math_spaces.html</guid>
         <category>programming</category>
         <pubDate>Wed, 12 Sep 2007 18:51:42 -0800</pubDate>
      </item>
            <item>
         <title>Lunar Eclipse</title>
         <description><![CDATA[Enjoy two rather different views of Monday night's total lunar eclipse. I watched from <a href="http://chabotspace.org/">Chabot</a> with a huge crowd, frenetic activity, many telescopes big and small, television news crews shining floodlights periodically on people in sleeping bags and people in line for the big telescope, the Castilleja High School astronomy class - the TV crews loved interviewing them. One Chabot astronomer in a pointy hat and cape told amusing and educational stories all night long. Quite a few shooting stars. One particularly large one just at the start of totality after the diamond in the diamond ring faded away was a big crowd pleaser. </p>
<p>
<a href="http://apod.nasa.gov/apod/image/0708/EclipsedMoonPugh.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://apod.nasa.gov/apod/image/0708/EclipsedMoonPugh.jpg" alt="" border="0"></a><a ..="" try="" {parent.deselectbloggerimagegracefully();}="" catch(e)="" {}="" href="http://apod.nasa.gov/apod/image/0703/tsemoon_Gartstein_720cropped.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px;" src="http://apod.nasa.gov/apod/image/0703/tsemoon_Gartstein_720cropped.jpg" alt="" border="0">
</a></p><p>Kudos to <a href="http://amandabauer.blogspot.com/2007/08/dark-lunar-eclipse.html">Astropixie</a> for pointing out the images!</p>]]></description>
         <link>http://avitzur.hax.com/2007/08/lunar_eclipse.html</link>
         <guid>http://avitzur.hax.com/2007/08/lunar_eclipse.html</guid>
         <category>programming</category>
         <pubDate>Thu, 30 Aug 2007 13:48:57 -0800</pubDate>
      </item>
            <item>
         <title>Cubes</title>
         <description><![CDATA[<p>Nico Bakker sent in this <a href="http://www.PacificT.com/Examples/Cubes/">document</a>  saying <i>Here is another example of the beauty of Graphing Calculator.</i></p> 

<p>Thank you, Nico!</p>

<p><center><a href="http://www.PacificT.com/Examples/Cubes/"><img src="http://www.PacificT.com/Examples/Cubes/graph.png" height="331" width="414"></a></center></p>
<p>Click the image to see the equations. </p></p><a href="http://www.pacifict.com/Examples/Cubes.mov"> Click here for the movie.</a></p>]]></description>
         <link>http://avitzur.hax.com/2007/08/cubes.html</link>
         <guid>http://avitzur.hax.com/2007/08/cubes.html</guid>
         <category>Gallery</category>
         <pubDate>Mon, 20 Aug 2007 11:48:48 -0800</pubDate>
      </item>
            <item>
         <title>&quot;Math is hard&quot;</title>
         <description><![CDATA[<p>Mattel got a lot of flack for its talking Barbie doll which said "Math is hard."  I wanted to reprogram the voice chips to say "Partial differential equations with  Neumann boundary conditions are hard." It's not that I completely disagreed with Mattel, I just thought Barbie should have been more specific.  Imagine the conversations: "Mommy, what's a Neumann boundary condition?" "Well you see dear, that's when you fix the value of the derivative on the boundary curve." But then, I've been working on nerd propaganda for decades.</p>
]]></description>
         <link>http://avitzur.hax.com/2007/07/math_is_hard.html</link>
         <guid>http://avitzur.hax.com/2007/07/math_is_hard.html</guid>
         <category>books</category>
         <pubDate>Wed, 25 Jul 2007 11:16:20 -0800</pubDate>
      </item>
            <item>
         <title>Cross-platform development</title>
         <description><![CDATA[<p>I clicked "Restart" after Apple Software Update applied what I thought were minor system patches, and my computer rebooted into Windows....</p>]]></description>
         <link>http://avitzur.hax.com/2007/07/crossplatform_development.html</link>
         <guid>http://avitzur.hax.com/2007/07/crossplatform_development.html</guid>
         <category>programming</category>
         <pubDate>Wed, 04 Jul 2007 10:50:58 -0800</pubDate>
      </item>
            <item>
         <title>Adventures in Optimization: OpenGL</title>
         <description><![CDATA[<blockquote><i>Over the past few years, the hardware-accelerated rendering pipeline has rapidly increased in complexity, bringing with it increasingly intricate and potentially confusing performance characteristics. Improving performance used to mean simply reducing the CPU cycles of the inner loops in your renderer; now it has become a cycle of determining bottlenecks and systematically attacking them. This loop of identification and optimization is fundamental to tuning a heterogeneous multiprocessor system; the driving idea is that a pipeline, by definition, is only as fast as its slowest stage. Thus, while premature and unfocused optimization in a single-processor system can lead to only minimal performance gains, in a multiprocessor system such optimization very often leads to zero gains.</i> - Cem Cebenoyan, NVIDIA, in <a href="http://download.nvidia.com/developer/GPU_Gems/Sample_Chapters/Graphics_Pipeline_Performance.pdf">GPU Gems</a></blockquote>]]></description>
         <link>http://avitzur.hax.com/2007/06/adventures_in_optimization_ope.html</link>
         <guid>http://avitzur.hax.com/2007/06/adventures_in_optimization_ope.html</guid>
         <category>programming</category>
         <pubDate>Tue, 19 Jun 2007 11:53:53 -0800</pubDate>
      </item>
            <item>
         <title>Adventures in Optimization: Threading</title>
         <description><![CDATA[<p>After identifying the superficial bugs slowing GC4, I set out to measure the degree of parallelism I was able to achieve with <a href="http://avitzur.hax.com/2006/10/embarrassingly_parallelizable.html">the new multi-threaded calculation code</a>. Are there any other calls like <a href="http://avitzur.hax.com/2007/05/getwrefcon.html">GetWRefCon</a> unintentially introducing dependencies stalling threads? Was GC able to keep multiple CPU cores fed wih independent work? In additional to the traditional questions of <i>Where is the software spending its time? What is it doing there?</i> I now have to ask those question separately of multiple threads of execution on multiple CPU cores and understand the answers in context, asking <i>When is one thread of execution stalled waiting for results from another?</i> With the right tool, the answer can be obvious. </p>
<p><center><img alt="ThreadView.png" src="http://avitzur.hax.com/images/ThreadView.png" width="378" height="147" /></center></p>]]></description>
         <link>http://avitzur.hax.com/2007/06/adventures_in_optimization_threading.html</link>
         <guid>http://avitzur.hax.com/2007/06/adventures_in_optimization_threading.html</guid>
         <category>programming</category>
         <pubDate>Sun, 10 Jun 2007 15:11:09 -0800</pubDate>
      </item>
            <item>
         <title>Adventures in Optimization: Benchmarking</title>
         <description><![CDATA[<p>My first job at Apple in 1992 was benchmarking the quality of a dozen different handwriting recognition software libraries from different companies. We like to pretend that everything from health to cars to wars can be measured by a single number but real systems are  multi-dimensional. <i>Benchmarks</i> are like <i>standards</i>: everyone likes to make their own. I approach software measurements with my old Stanford Physics lab training. I treat the software as tangible physical system, experiment to determine what I can measure reproducibly, look for mathematical relationships between variables, and attempt to construct a useful basis set of axes upon which to characterize their phase space. This did not make me any friend while benchmarking for Apple. Each company or internal group with a solution to sell had strong ideas about comparing systems to put their own solution in the best light.  Furthermore, handwriting recognition was and is still an unsolved research problem. Comparing different research projects is quite different from comparing products of a mature technology. Ultimately, none of the choices proved adequate.</p>
<p>For Graphing Calculator, I use performance measurements to make programming choices when comparing high-level algorithms, low-level implementation details, different compilers, and compilation options. Holding the Command key while pressing the slider Play button will initiate a stopwatch to time the slider. When I'm focusing on a particular routine, this is useful to compare small code changes from one build to the next. In the Graphing Calculator menu, the Graphing Calculator > Benchmark command runs through thirty-two tests timing calculation and drawing. These help me compare how GC behaves on different hardware and how its behavior changes across versions years apart. The report looks like this:</p>]]></description>
         <link>http://avitzur.hax.com/2007/06/adventures_in_optimization_benchmarking.html</link>
         <guid>http://avitzur.hax.com/2007/06/adventures_in_optimization_benchmarking.html</guid>
         <category>programming</category>
         <pubDate>Sun, 10 Jun 2007 14:16:23 -0800</pubDate>
      </item>
            <item>
         <title>Adventures in Optimization: Prelude</title>
         <description><![CDATA[<p><a href="http://avitzur.hax.com/2007/05/getwrefcon.html">Two weeks ago</a>, I ran the Intel-native GC4 on an 8-core machine. It revved all 8 processing cores yet ran no faster than on a four-year old single-core G4 laptop at one-third the clock speed. A few minutes with Shark identified the culprit: a single innocuous call to GetWRefcon. In the single-user, single-core, single-threaded Macintosh toolbox of 1984, that call would have taken a few instructions. Mac OS X must share system resources across multiple users, processor cores, applications, and threads of execution all making demands at once. GetWRefCon is labelled <i>Not Thread Safe</i>: it is not guaranteed to work at all from anywhere but the main  thread. Rather than crash or return a bogus result, it was causing all eight otherwise independent threads of execution to serialize on that one shared resource, passing the baton from one thread to the other, unable to execute in parallel. Fixing this was easy. Although the window structure is a shared resource protected by a lock, the RefCon itself that I actually needed contained read-only information all threads could read in parallel safely without locking. No need to go through GetWRefCon at all. The parallel threads should have been passed a pointer to the read-only document record directly.</p><p>

After fixing that, some tests ran twenty times faster. Other tests however, still ran at the same speed as on the older, slower, single-core laptop. I devoted the last two weeks to figuring out why. </p>

<p><center><img alt="Dock.png" src="http://avitzur.hax.com/images/Dock.png" width="473" height="75" /></center></p>]]></description>
         <link>http://avitzur.hax.com/2007/06/adventures_in_optimization_pre.html</link>
         <guid>http://avitzur.hax.com/2007/06/adventures_in_optimization_pre.html</guid>
         <category>programming</category>
         <pubDate>Sun, 10 Jun 2007 10:55:10 -0800</pubDate>
      </item>
            <item>
         <title>Spike!</title>
         <description><![CDATA[<p><img alt="Spike on top of stairs" src="http://avitzur.hax.com/images/AvoSpikeStairs.jpg" width="400" height="300" /></p><p>
Spike returns triumphant from the garden. After inhaling half an avocado, he held on greedily to the rest until he was ready for it.   His wet food contains a fair bit of avocado. He seemed quite pleased with himself to discover that food really does fall from trees. I wouldn't let him back in until he finished. Close-up below the fold....</p>]]></description>
         <link>http://avitzur.hax.com/2007/06/spike.html</link>
         <guid>http://avitzur.hax.com/2007/06/spike.html</guid>
         <category></category>
         <pubDate>Mon, 04 Jun 2007 21:54:22 -0800</pubDate>
      </item>
            <item>
         <title>glBufferSubData</title>
         <description><![CDATA[<center><a href="http://www.pacifict.com/glBufferSubDataArtifact/"><img src="http://www.pacifict.com/glBufferSubDataArtifact/graph.png" height="170" width="190"></a></center>
<p>Yesterday was spent debugging until two in the morning trying to diagnose a drawing artifact which occured only on Intel-native builds of GC4 when animating colors on a static 3D model defined using an implicit surface equation using OpenGL <a href="http://www.opengl.org/registry/specs/ARB/vertex_buffer_object.txt">vertex buffer objects</a>. The image above started out, correctly, as a solid red sphere. When animating the colors using the GC slider, the top of the sphere did not change, remaining red. The middle of the sphere animated correctly. The bottom of the sphere animated but rgb color values (a,b,c) would display shifted as (b,c,a).</p>]]></description>
         <link>http://avitzur.hax.com/2007/05/glbuffersubdata.html</link>
         <guid>http://avitzur.hax.com/2007/05/glbuffersubdata.html</guid>
         <category>programming</category>
         <pubDate>Thu, 31 May 2007 18:27:11 -0800</pubDate>
      </item>
            <item>
         <title>None Shall Pass!</title>
         <description><![CDATA[<center><img alt="None shall pass!" src="http://avitzur.hax.com/images/Balrog.jpg" width="400" height="300" /></center><p>Spike guards the entrance to my office.</p>]]></description>
         <link>http://avitzur.hax.com/2007/05/none_shall_pass.html</link>
         <guid>http://avitzur.hax.com/2007/05/none_shall_pass.html</guid>
         <category></category>
         <pubDate>Wed, 30 May 2007 11:06:27 -0800</pubDate>
      </item>
            <item>
         <title>GetWRefCon</title>
         <description><![CDATA[<p>Graphing Calculator's calculations are for the most part <a href="http://avitzur.hax.com/2006/10/embarrassingly_parallelizable.html">emabarrassingly parallelizable</a>. I spent <a href="http://avitzur.hax.com/programming/">several months</a> last year expressing that parallelism in code to take advantage of muti-core systems.  Yesterday I compared an Intel native build of GC4 on an 8-core system side by side with GC3.5 running under Rosetta. As expected, GC4 pegged the meter on all 8-cores:</p><p><center><img alt="Activity.png" src="http://avitzur.hax.com/images/Activity.png" width="265" height="112" /></center></p><p> Imagine my surprise upon discovering that GC4 running native and parallel was no faster than GC3.5 running emulated on a single-core. <a href="http://developer.apple.com/tools/sharkoptimize.html">Shark</a> long ago earned a permanent spot in my dock as one of the best development visualization tools. It quickly informed me that 85% of the time was spent in GetWRefCon which calls GetWindowData which calls HIObject::IsRefValid and HLTBSearchRefTable which was serializing the parallel threads of execution. I had mistakenly thought of GetWRefCon as "free", misled by my 1980s-era Macintosh training when it was no more than a simple wrapper to dereference a WindowRecord structure field. Just another reminder that the only way to have any idea where your program is spending its time is to actually measure it. Stay tuned for a benchmarks report after I fix this.</p>]]></description>
         <link>http://avitzur.hax.com/2007/05/getwrefcon.html</link>
         <guid>http://avitzur.hax.com/2007/05/getwrefcon.html</guid>
         <category>programming</category>
         <pubDate>Mon, 28 May 2007 08:50:05 -0800</pubDate>
      </item>
            <item>
         <title>3D Models</title>
         <description><![CDATA[<p>Now <a href="http://www.ferrismath.com/calc/images/2006projects/index.htm">these</a> are real 3D models (<a href="http://ferrismath.com/calc/2001-4projects/index.htm">2004</a>, <a href="http://ferrismath.com/calc/2005projects/index.htm">2005</a>, <a href="http://www.ferrismath.com/calc/images/2006projects/index.htm">2006</a> <a href="http://ferrismath.com/calc/3Dproject/Index.htm">3D projects</a>) .</p>
<center><a href="http://www.PacificT.com"><img src="http://pacifict.com/images/gcIconAgainstGray.png"></a></center>
<p>The equation for the surface on the Mac OS X Graphing Calculator application icon above is shown <a href="http://pacifict.com/Examples/Example19.html">here</a>. Graphing Calculator draws the equation in the image below.</p>
<center><a href="http://pacifict.com/Examples/Example19.html"><img alt="model.png" src="http://avitzur.hax.com/images/model.png" width="354" height="270" /></a></center>
<p>Here the equation is modelled in what looks like plasticine.</p>
<center><a href="http://www.ferrismath.com/calc/images/2006projects/pages/3Dproj06%20046_jpg.htm"><img alt="ClayModel.jpg" src="http://avitzur.hax.com/images/ClayModel.jpg" width="354" height="360" /></a></center>


]]></description>
         <link>http://avitzur.hax.com/2007/05/3d_models.html</link>
         <guid>http://avitzur.hax.com/2007/05/3d_models.html</guid>
         <category>Gallery</category>
         <pubDate>Mon, 14 May 2007 18:27:24 -0800</pubDate>
      </item>
      
   </channel>
</rss>
