<?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>Matthieu Brucher&#039;s blog &#187; Tools</title> <atom:link href="http://matt.eifelle.com/category/tools/feed/" rel="self" type="application/rss+xml" /><link>http://matt.eifelle.com</link> <description></description> <lastBuildDate>Tue, 27 Jul 2010 07:04:23 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.1</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Optimally use massively parallel clusters resources</title><link>http://matt.eifelle.com/2010/06/15/optimally-use-massively-parallel-clusters-resources/</link> <comments>http://matt.eifelle.com/2010/06/15/optimally-use-massively-parallel-clusters-resources/#comments</comments> <pubDate>Tue, 15 Jun 2010 07:53:10 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Distributed Computing]]></category> <category><![CDATA[High Performance Computing]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Batch scheduling]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=1208</guid> <description><![CDATA[We have now several petaflopic clusters available in the Top500. Of course, we are trying to get the most of their peak computational power, but I think we should sometimes also look at optimal resource allocation.
I&#8217;ve been thinking about this for several months now, for work that has thousands of tasks, each task being massively [...]]]></description> <content:encoded><![CDATA[<p>We have now <a
href="http://www.top500.org/">several petaflopic clusters available in the Top500</a>. Of course, we are trying to get the most of their peak computational power, but I think we should sometimes also look at optimal resource allocation.</p><p>I&#8217;ve been thinking about this for several months now, for work that has thousands of tasks, each task being massively data parallel. Traditionnally, one launches a job through one&#8217;s favorite batch scheduler (favorite or mandatory&#8230;) with fixed resources and during an estimated amount of time. This may work well in research, but in the industrial world, there often a new job that arises and that needs part of your scarce resources. You may have to stop your work, loose your current advances and/or restart the job with less resources. And then the cycle goes on.</p><p><span
id="more-1208"></span></p><h4>Static resource allocation</h4><p>How can resource allocation work? Let&#8217;s start with a simple case where you have 2 applications with different priorities. One of them has a priority of 70 (it&#8217;s supposed to finish in three days) whereas the other one has a priority of 50 (four days left). They share the cluster so that 66% is allocated to the first application and 33% to the second one.<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2010/06/Allocation-2.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2010/06/Allocation-2-300x165.png" alt="" title="Dispatch and allocation of two applications" width="300" height="165" class="aligncenter size-medium wp-image-1241" /></a></center></p><p>What happens if a third application must be launched with a higher priority, because it has to ne finished by tomorrow? You may stop the other two programs, you may loose a lot of work if you didn&#8217;t implement checkpoints (besides, one of them may be an of-the-shelf program you bought yesterday) or suspend it. Either way, this is what you will get:<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2010/06/Allocation-3.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2010/06/Allocation-3-300x165.png" alt="" title="Dispatch and allocation for three applications" width="300" height="165" class="aligncenter size-medium wp-image-1242" /></a></center></p><p>In fact, even if you use dynamic resource allocation, this is what you must get to have your results by the time you need them, but obviously, you have lost your two other applications. Some batch schedulers allow applications to be suspended, but this is a double-edge sword:</p><ul><li>your cluster must support job suspension, and thus have access to drives to save the job state (which is not possible for medium to large-scaled clusters)</li><li>if your application does not scale to your entire cluster (it happens), although one of the other two applications could go on, it is not possible, all processes are put to sleep</li></ul><p>So all things considered, you have to implement dynamic resource allocation.</p><h4>Dynamic resource allocation</h4><p>How does this work? Each application must be aware that it can be allocated more resources or deallocated some at all time. To be portable on all clusters, you cannot suspend part of your program, it must really go away. The batch scheduler must also notice that your application has freed some of its resources. You thus have to allocate small jobs that will communicate together (this can be done with MPI-2).</p><p>This means that you will have hundreds or thousands of small works. All of them will not have to be connected to the scheduler, only one master must be. Of course, this can easilly be done by using a specific queue. Each application on this queue will thus receive orders from the batch scheduler and act upon it. Another advantage is that also the application gets no resource at one point, it still has a saved state that enable the continuation of a run.<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2010/06/Dynamic-workflow.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2010/06/Dynamic-workflow-300x165.png" alt="" title="Dynamic resource allocation workflow" width="300" height="165" class="aligncenter size-medium wp-image-1244" /></a></center></p><p>Of course, this is not easy to do. How can this be applied to an of-the-shelf application? Well, in this case, you may create a bogus application on the master queue that will at least allow other applications to be allocated resources beside it.</p><p>You do not have to implement this on top of MPI. It can be really hard to do (handling data moves between processors, change the decomposition, &#8230;), and you may implement another solution. In my case, I have thousands different tasks that can be run on very few cores, so this is my elementary unit. I don&#8217;t need all tasks to communicate between them, so I create each time brand new independent jobs and I also can tell the scheduler it can kill jobs that are not responding before the next allocation phase.</p><h4>Conclusion</h4><p>To finish, I&#8217;ll say that I know that <a
href="http://www.platform.com/">LSF</a> allows plugins that help dispatch jobs on specific hosts of your cluster (to have the best communication location). There seems to be a way of implementing the needs gathering and the resource assignment, but the documentation is not clear (at all). A specific daemon may be needed. I don&#8217;t know if other batch scheduler allow plugins to modify their behavior, if you know of them and their API, please do tell <img
src='http://matt.eifelle.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2010/06/15/optimally-use-massively-parallel-clusters-resources/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Book review: Programming Massively Parallel Processors: A Hands-on Approach</title><link>http://matt.eifelle.com/2010/03/31/book-review-programming-massively-parallel-processors-a-hands-on-approach/</link> <comments>http://matt.eifelle.com/2010/03/31/book-review-programming-massively-parallel-processors-a-hands-on-approach/#comments</comments> <pubDate>Wed, 31 Mar 2010 07:42:28 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Book review]]></category> <category><![CDATA[Distributed Computing]]></category> <category><![CDATA[High Performance Computing]]></category> <category><![CDATA[Morgan Kaufmann]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[CUDA]]></category> <category><![CDATA[Parallel and Distributed Computing]]></category> <category><![CDATA[Parallel computing]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=1161</guid> <description><![CDATA[Massively parallel processors are in the mood today. We had small parallel processors with a few cores and the ability to launch serevral threads on one core, we have now many cores on one processor and at the other end of the spectrum, we have GPUs. CPUs vendors are now going in this direction with [...]]]></description> <content:encoded><![CDATA[<p>Massively parallel processors are in the mood today. We had small parallel processors with a few cores and the ability to launch serevral threads on one core, we have now many cores on one processor and at the other end of the spectrum, we have GPUs. CPUs vendors are now going in this direction with Larabee and Fusion, and GPUs will still have more cores/threads/&#8230; It&#8217;s thus mandatory to understand this shift now.<br
/> <span
id="more-1161"></span></p><h4>Content and opinions</h4><p>First of all, it&#8217;s not a book on programming massively parallel processors, it&#8217;s a book about CUDA. One of the authors is a nVidia fellow, so it&#8217;s no wonder. I think there are three parts in the book: an introduction of CUDA, two examples and then general considerations and the future.</p><p>The first 6 chapters (I don&#8217;t count the first chapter as a real chapter, it&#8217;s more of an introduction to the massively paralell processors and their use in a few pages) are the main CUDA tutorial. I say tutorial because it feel like all beginner courses I&#8217;ve taken in CUDA. The content can be found in all Internet classes, so the only advantage is that you have everything in a book. Nothing less, nothing more.</p><p>I had a feeling of &#8220;deja vu&#8221; for the MRI example, the second was unknown to me. There is not much code, only for the relevant parts, but you won&#8217;t be able to test the different implementations with what is provided in the book. Besides, several times during the writting flow, new techniques are introduced, but one can&#8217;t know what speed-up they provide. Perhaps this is because this speedup cannot be generalized, but still, with proper warnings, the different timings through the GPU port of woth examples would have been great.</p><p>The last part is, as I&#8217;ve said, more general. It starts with a workflow to help parallelizing with GPUs, then an introduction (too short IMHO) of OpenCL and the future of CUDA with Fermi and the SDK 3.0. The workflow chapter is too small. Of course, the goal isn&#8217;t to be like <a
href="http://matt.eifelle.com/2009/12/08/book-review-the-art-of-concurrency-a-thread-monkeys-guide-to-writing-parallel-applications/">The Art of Concurrency</a>, and at least there is a chapter about the process of selecting the algorithm, &#8230; but it is too small. The OpenCL introduction is really an introduction. I&#8217;ve seen one small complete OpenCL call, but that&#8217;s it. I couldn&#8217;t program a single kernel right now. Of course it&#8217;s a CUDA book, not an OpenCL one, but the chapter is useless. Perhaps it would be better to merge it with the &#8220;future&#8221; chapter, as OpenCL is not widely available. Finally, the last chapter states what can be expected of Fermi (really interesting) and of the SDK 3.0.</p><p>What I miss in this book is some explanations of the texture memory. The obvious matrix example uses constant memory for caching the memory accesses. Why isn&#8217;t texture memory used in this example? It&#8217;s far bigger than constant memory and also has a cache, so why not use it? It&#8217;s a CUDA book, but a lot of content is freely available in several tutorials that are sometimes better shaped than the book, so why isn&#8217;t there some special content, like how the cache works? How can you manage grid sizes that are no a power of two? (it&#8217;s explained in one of the example, with zero padding, but there are no protection in the first chapters, which is dangerous) What is coalescing memory and how can I optimize the memory bandwidth with coalescing in mind? (the actual real explanation and appropriate picture is in the last annexe!)</p><h4>Conclusion</h4><p>I don&#8217;t say that the book is not useful, it&#8217;s really interesting as a companion book for a CUDA course or for a beginner. If you&#8217;re used to electronic papers, you will not be interested. If you buy this book, don&#8217;t expect to know everything about CUDA, or even less massively parallel processors. You will have to dig deeper for specific topics, but at least you will have a good basis.</p><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/uploads/2009/12/BN_Logo_3tier.jpg) right bottom no-repeat #ffffff;"> <a
rel="nofollow" href="http://r.popshops.com/pp/78348/programming-massively-parallel-processors-a-hands-on-approach"><img
style="width: 150px;" src="http://images.barnesandnoble.com/images/47190000/47190706.JPG" border="0" alt="Programming Massively Parallel Processors: A Hands-on Approach" /></a><br
/> <a
rel="nofollow" href="http://r.popshops.com/pp/78348/programming-massively-parallel-processors-a-hands-on-approach">Programming Massively Parallel Processors: A Hands-on Approach</a><br
/> Price: $62.95</div><div
class="subcolumns"><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/amazon_US_small.gif) right bottom no-repeat #ffffff;"><div
style="width: 60px; float: left; margin-right: 5px;"> <a
href="http://www.amazon.com/exec/obidos/ASIN/0123814723/masbl03-20" target="_blank"><img
src="http://ecx.images-amazon.com/images/I/51VL9FqF6ML._SL75_.jpg" width="60" height="75" border="0" /></a></div><div><p><a
href="http://www.amazon.com/exec/obidos/ASIN/0123814723/masbl03-20" target="_blank">Programming Massively Parallel Processors: A Hands-on Approach</a> (Paperback)<br
/> <span
style="font-size: 0.8em;">by <strong>David B. Kirk, Wen-mei W. Hwu</strong></span><br
/> ISBN: 0123814723</p><p><strong>Price:</strong> <span
style="color: #990000; font-weight: bold;">USD 51.99</span><br
/> <strong>40 used &#038; new</strong> available from <span
style="color: #990000; font-weight: bold;">USD 46.52</span></p><p> <img
src="http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/stars-3.5.gif" class="asa_rating_stars" /> | 3.5 | 8</div><div
style="clear: both;"></div></div></div>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2010/03/31/book-review-programming-massively-parallel-processors-a-hands-on-approach/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Book review: Debug It!: Find, Repair, and Prevent Bugs in Your Code</title><link>http://matt.eifelle.com/2010/03/23/book-review-debug-it-find-repair-and-prevent-bugs-in-your-code/</link> <comments>http://matt.eifelle.com/2010/03/23/book-review-debug-it-find-repair-and-prevent-bugs-in-your-code/#comments</comments> <pubDate>Tue, 23 Mar 2010 08:01:41 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Book review]]></category> <category><![CDATA[Debugger]]></category> <category><![CDATA[Development process]]></category> <category><![CDATA[Pragmatic Bookshelf]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Agile software]]></category> <category><![CDATA[Test patterns]]></category> <category><![CDATA[Test-Driven Development]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=1153</guid> <description><![CDATA[Debugging software is one of the complex actions in software development. It&#8217;s not just about using a debugger, it&#8217;s about how do you manage bugs. This book has a pragmatic (amazing, don&#8217;t you think?) approach on this matter.Content and opinions
Thee parts, three views how what debugging actually is.
The first is the pragmatic debugging: reproduce your [...]]]></description> <content:encoded><![CDATA[<p>Debugging software is one of the complex actions in software development. It&#8217;s not just about using a debugger, it&#8217;s about how do you manage bugs. This book has a pragmatic (amazing, don&#8217;t you think?) approach on this matter.<br
/> <span
id="more-1153"></span></p><h4>Content and opinions</h4><p>Thee parts, three views how what debugging actually is.</p><p>The first is the pragmatic debugging: reproduce your bug, diagnose it, fix it, and make it definitely go away. Each step is actually not mandatory done by a debugger, and in fact the book advocates <a
href="http://matt.eifelle.com/2009/08/20/book-review-test-driven-development/">the TDD approach</a>. Making it go away is in fact thinking about what this bug meant: was it a design issue, a feature, and if it is a bug, how can all the consequences be erased?</p><p>The second is managing your bugs. The main action is to have a bug database that is healthy, meaning it must be taken care of. As the book is about a pragmatic approach, one may think the advice are pure logic, and that no one would not follow them. If this book serie has so much success, it is because those advice are in fact not that obvious for everyone!</p><p>Finally, the first two parts are in fact the theory. Practice is always a little bit different. What do you do of leagacy releases? Of third-parties libraries? Of bugs that you need to fix in a hurry in parallel? Tests is another facet of software closelly related to debugging. Once you&#8217;ve debugged something, you want your tests to assert that it won&#8217;t come again unless you see it. How can you be sure that you will have enough information when debugging your software? Finally, there are some pitfalls in software that hinder debugging. As those anti-patterns, this part is about concrete actions that must be implemented in every software project.</p><h4>Conclusion</h4><p>Pragmatic Bookshelf has the habit of having a lot of experience feedback in their books, and this one is not an exception. Sadly, there are mainly present in the first part of the book. Still, it&#8217;s not the main value of the book. I think the main value is placing debugging in the new landscape of agile software. Too many times, the word debugging is missing in agile books, replaced by only testing. They are the two sides of the same coin. The last part has its virtues as well. Debugging is not a simple workflow, there are differences for each software project.</p><p>As usual, the publisher has an excellent book on a practical subject that answers practical questions on debugging.</p><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/uploads/2009/12/BN_Logo_3tier.jpg) right bottom no-repeat #ffffff;"> <a
rel="nofollow" href="http://r.popshops.com/pp/77376/debug-it-find-repair-and-prevent-bugs-in-your-code"><img
style="width: 150px;" src="http://images.barnesandnoble.com/images/32590000/32595801.JPG" border="0" alt="Debug It!: Find, Repair, and Prevent Bugs in Your Code" /></a><br
/> <a
rel="nofollow" href="http://r.popshops.com/pp/77376/debug-it-find-repair-and-prevent-bugs-in-your-code">Debug It!: Find, Repair, and Prevent Bugs in Your Code</a><br
/> Price: $29.88</div><div
class="subcolumns"><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/amazon_US_small.gif) right bottom no-repeat #ffffff;"><div
style="width: 61px; float: left; margin-right: 5px;"> <a
href="http://www.amazon.com/exec/obidos/ASIN/193435628X/masbl03-20" target="_blank"><img
src="http://ecx.images-amazon.com/images/I/31xF4DWc2mL._SL75_.jpg" width="61" height="75" border="0" /></a></div><div><p><a
href="http://www.amazon.com/exec/obidos/ASIN/193435628X/masbl03-20" target="_blank">Debug It!: Find, Repair, and Prevent Bugs in Your Code (Pragmatic Programmers)</a> (Paperback)<br
/> <span
style="font-size: 0.8em;">by <strong>Paul Butcher</strong></span><br
/> ISBN: 193435628X</p><p><strong>Price:</strong> <span
style="color: #990000; font-weight: bold;">USD 23.07</span><br
/> <strong>38 used &#038; new</strong> available from <span
style="color: #990000; font-weight: bold;">USD 12.94</span></p><p> <img
src="http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/stars-4.5.gif" class="asa_rating_stars" /> | 4.5 | 8</div><div
style="clear: both;"></div></div></div>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2010/03/23/book-review-debug-it-find-repair-and-prevent-bugs-in-your-code/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Thinking of good practices when developing with accelerators</title><link>http://matt.eifelle.com/2010/01/05/thinking-of-good-practices-when-developing-with-accelerators/</link> <comments>http://matt.eifelle.com/2010/01/05/thinking-of-good-practices-when-developing-with-accelerators/#comments</comments> <pubDate>Tue, 05 Jan 2010 08:48:57 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[C++]]></category> <category><![CDATA[Design Patterns]]></category> <category><![CDATA[Development process]]></category> <category><![CDATA[Distributed Computing]]></category> <category><![CDATA[High Performance Computing]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[CUDA]]></category> <category><![CDATA[Fortran]]></category> <category><![CDATA[Grid computing]]></category> <category><![CDATA[HMPP]]></category> <category><![CDATA[MPI]]></category> <category><![CDATA[Multithreaded applications]]></category> <category><![CDATA[Scientific computing]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=997</guid> <description><![CDATA[Due to the end of the free lunch, manufacturers started to provide differents processing units and developers started to go parallel. It&#8217;s kind of back to the future, as accelerators existed before today (the x87 FPU started as a coprocessor, for instance). If those accelerators were integrated into the CPU, their instruction set were also.
Today&#8217;s [...]]]></description> <content:encoded><![CDATA[<p>Due to the end of the <a
href="http://www.gotw.ca/publications/concurrency-ddj.htm">free lunch</a>, manufacturers started to provide differents processing units and developers started to go parallel. It&#8217;s kind of back to the future, as accelerators existed before today (the x87 FPU started as a coprocessor, for instance). If those accelerators were integrated into the CPU, their instruction set were also.</p><p>Today&#8217;s accelerators are not there yet. The tools are not ready yet (code translators) and usual programming practices may not be adequate. All the ecosystem will evolve, accelerators will change (GPUs are the main trend, but they will be different in a few years), so what you will do today needs to be shaped with these changes in mind. How is it possible to do so? Is it even possible?<br
/> <span
id="more-997"></span></p><h4>Available code translators</h4><p>Code translators are the easiest path to solution. I know two of them.</p><p>The first is the <a
href="http://www.pgroup.com/resources/accel.htm">PGI compiler</a>. It only supports CUDA and the Fortran and C99 language. I didn&#8217;t use it yet, also I plan of testing it in the near future. It is based on pragmas, and the compiler generates the CUDA microcode.</p><p>The second solution is <a
href="http://www.caps-entreprise.com/fr/page/index.php?id=49&amp;p_p=36">HMPP</a>. It supports more than just CUDA (also CAL/IL or OpenCL) and Fortran/C (also Java now). As the PGI compiler, it is based on pragmas, and a excellent thing is that it detects the available accelerators and launches the correct kernel (if you authorized it) or the original code. You can also modify the generated code to put your own (you can tune the code for instance, which may give you an additional x2 factor). Unfortunately, it is not possible to call functions inside the parallelized kernels, which means that only simple or badly-written (too many lines or duplicated code) kernels can be called. I think this is the same for the PGI compiler.</p><p>It seems that code translators still need work:</p><ul><li>only few accelerators are supported (CUDA, and sometimes CAL/IL or OpenCL),</li><li>almost no langage (Fortran/C/Java, a lot of Virtual Machines should be able to use them natively, without developers using specific tools),</li><li>only one function can be parallelized at a time.</li></ul><p>The last point is currently the biggest issue. You need to cut your function int pieces to have clean code and a good portability/evolutivity for the future.</p><p>This is why one still need to program a lot for those accelerators, and so we need to adapt our programming practices, develop in the accelerators&#8217; native langages (even if we know that they may disappear in a few years).</p><h4>Developping your own &#8220;tool chain&#8221; for accelerators</h4><p>For accelerators, there are a lot of things that needs to be done each time: copying some data, computing and getting some data back. These are the steps that code translators automate, in fact it is a common practice to use tools to automate stuff. The issue is that complex kernels are not supported by those translators. So what?</p><p>Creating automatic functions that will copy the data you need is in fact very common in metaprogramming. Coding the kernel on an accelerator is in fact not that difficult: the manufacturers provide the needed compilers (that&#8217;s what nVidia does and the success of the tool chain cannot be denied), and this is really the cornerstone. One has to write more code, some parts are less portable (because they are written in one of the accelerator&#8217;s languages), but in the end, with metaprogramming, the code can be better tuned, enhanced and read. This is the leverage of the accelerators.</p><h4>Conclusion</h4><p>Why do we care developing for accelerators? We know that they will go away. Before they do, they are the only way of speeding up our software. Code translators are the best tools to develop in a portable way, but they need time to support more accelerators, languages and method of programming. When CPUs will be on a par with accelerators, their progress will help compilers to target them correctly. It&#8217;s just a matter of time.<br
/> Meanwhile, metaprogrammin is the next best solution to automate processes that code translators cannot support yet.</p>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2010/01/05/thinking-of-good-practices-when-developing-with-accelerators/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Book review: The Art of Concurrency: A Thread Monkey&#8217;s Guide to Writing Parallel Applications</title><link>http://matt.eifelle.com/2009/12/08/book-review-the-art-of-concurrency-a-thread-monkeys-guide-to-writing-parallel-applications/</link> <comments>http://matt.eifelle.com/2009/12/08/book-review-the-art-of-concurrency-a-thread-monkeys-guide-to-writing-parallel-applications/#comments</comments> <pubDate>Tue, 08 Dec 2009 07:57:54 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Book review]]></category> <category><![CDATA[C++]]></category> <category><![CDATA[Debugger]]></category> <category><![CDATA[O'Reilly]]></category> <category><![CDATA[Profiler]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Multithreaded applications]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=847</guid> <description><![CDATA[Free lunch is over, it&#8217;s time to go concurrent. The Art of Concurrency addresses the need for a workflow to develop concurrent/parallel applications.Mainly based on multithreaded applications, the book covers pthreads, Windows threads, OpenMP or Intel Threading Building Blocks library. It also covers some part of multiprocess applications if there are differences with threaded ones.
Content [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.gotw.ca/publications/concurrency-ddj.htm">Free lunch is over</a>, it&#8217;s time to go concurrent. <span
style="text-decoration: underline;">The Art of Concurrency</span> addresses the need for a workflow to develop concurrent/parallel applications.<br
/> <span
id="more-847"></span><br
/> Mainly based on multithreaded applications, the book covers pthreads, Windows threads, OpenMP or <a
href="http://matt.eifelle.com/2008/07/09/book-review-intel-threading-building-blocks-outfitting-c-for-multi-core-processor-parallelism/">Intel Threading Building Blocks library</a>. It also covers some part of multiprocess applications if there are differences with threaded ones.</p><h4>Content and opinions</h4><p>The book starts with two chapers on what actions to take before parallelizing and what can and what cannot. Before the usual algorithms that can be parallelized, the author takes three chapters to explain how you may achieve your goal. Ensuring correctness is a difficult task, so the book gives 8 rules to help and then an explanation of several support libraries that can be used.</p><p>The biggest part of the book, as I&#8217;ve hinted, is dedicated to simple but usual algorithms that may be parallelized: sums and scans, mapreduce, sorts, searches, and graph algorithms. Each time, several different algorithms are first coded in a serial way and then parallelized with possibly different support libraries. Also each time, the efficiency, the simplicity, the portability and the scalability conclude the sub art: it helps standing back.</p><p>The last chapter is a small overview of the additional tools that you may use (but they are not mandatory). They are mainly Intel&#8217;s tools, but it&#8217;s mainly because Intel provides the developer with some of the best tools.</p><h4>Conclusion</h4><p>Although the author works for Intel, he doesn&#8217;t expose Intel tools more than others. The book tone is adequate, not too much serious, not like a &#8220;For Dummies&#8221;, so just enjoyable.</p><p>If you need advices to parallelize your applications and you don&#8217;t want to buy <a
href="http://matt.eifelle.com/2009/03/10/book-review-patterns-for-parallel-programming/">Patterns for Parallel Programming</a>, buy this one (well, buy it anyway).</p><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/uploads/2009/12/BN_Logo_3tier.jpg) right bottom no-repeat #ffffff;"> <a
rel="nofollow" href="http://r.popshops.com/pp/69253/the-art-of-concurrency-a-thread-monkey-s-guide-to-writing-parallel-applications"><img
style="width: 150px;" src="http://images.barnesandnoble.com/images/37180000/37189689.JPG" border="0" alt="The Art of Concurrency: A Thread Monkey's Guide to Writing Parallel Applications" /></a><br
/> <a
rel="nofollow" href="http://r.popshops.com/pp/69253/the-art-of-concurrency-a-thread-monkey-s-guide-to-writing-parallel-applications">The Art of Concurrency: A Thread Monkey&#8217;s Guide to Writing Parallel Applications</a><br
/> Price: $40.49</div><div
class="subcolumns"><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/amazon_US_small.gif) right bottom no-repeat #ffffff;"><div
style="width: 57px; float: left; margin-right: 5px;"> <a
href="http://www.amazon.com/exec/obidos/ASIN/0596521537/masbl03-20" target="_blank"><img
src="http://ecx.images-amazon.com/images/I/51QaJYFLmGL._SL75_.jpg" width="57" height="75" border="0" /></a></div><div><p><a
href="http://www.amazon.com/exec/obidos/ASIN/0596521537/masbl03-20" target="_blank">The Art of Concurrency: A Thread Monkey&#8217;s Guide to Writing Parallel Applications</a> (Paperback)<br
/> <span
style="font-size: 0.8em;">by <strong>Clay Breshears</strong></span><br
/> ISBN: 0596521537</p><p><strong>Price:</strong> <span
style="color: #990000; font-weight: bold;">USD 38.48</span><br
/> <strong>40 used &#038; new</strong> available from <span
style="color: #990000; font-weight: bold;">USD 17.99</span></p><p> <img
src="http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/stars-3.5.gif" class="asa_rating_stars" /> | 3.5 | 6</div><div
style="clear: both;"></div></div></div>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2009/12/08/book-review-the-art-of-concurrency-a-thread-monkeys-guide-to-writing-parallel-applications/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Book review: Mercurial &#8211; The Definitive Guide</title><link>http://matt.eifelle.com/2009/11/19/book-review-mercurial-the-definitive-guide/</link> <comments>http://matt.eifelle.com/2009/11/19/book-review-mercurial-the-definitive-guide/#comments</comments> <pubDate>Thu, 19 Nov 2009 08:55:43 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Book review]]></category> <category><![CDATA[O'Reilly]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[DVCS]]></category> <category><![CDATA[Mercurial]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=812</guid> <description><![CDATA[Thre is two ways of getting this book: the electronic one or the paper one. If you plan of using Mercurial, the paper may be better suited.
Mercurial (also called hg as the Mendeleiev symbol for mercurial) is one of the three DVCS (Distributed Version Control System) that are in the mood nowadays. Written in Python, [...]]]></description> <content:encoded><![CDATA[<p>Thre is two ways of getting this book: the electronic one or the paper one. If you plan of using Mercurial, the paper may be better suited.</p><p>Mercurial (also called hg as the Mendeleiev symbol for mercurial) is one of the three DVCS (Distributed Version Control System) that are in the mood nowadays. Written in Python, its life started at the time as git&#8217;s when BitKepper was dumped as the Linux kernel&#8217;s VCS. Now it is a mature product, and the book tries to explain how to use it and also the differences with Git. Bazaar, the third DVCS, is not even mentionned, although it is also written in Python.<br
/> <span
id="more-812"></span></p><h4>Content and opinions</h4><p>The book starts with a small introduction to revision control, and then gets to the basics of version control with Mercurial. This chapter and the following one really are the only things to fully master before starting with hg. With them, you can track your changes, send them to other repositories, &#8230;, and the third chapter helps you merging different changes together. In this case, you may encounter some small &#8220;glitches&#8221; of Mercurial, and the book explains them correctly.</p><p>The remainign of the book is more dedicated to small additions that can make your life better.  For instance, the fourth chapter is about the efficient repository storage. If a repository with Subversion could get really big, Mercurial keeps things small and doesn&#8217;t use garbage collectors like Git. The next chapter that was interesting was the eigth (the other deal with daily use, that is, copy, rename, &#8230;, web servers, selecting several files through regexp). It deals with organizing the branches and giving names to revisions. I think it could have deserved a better place, as I find the last three chapters of less interest (in fact, other book on DVCS deal with the web server part at the end, so I think it&#8217;s not just me).</p><p>The next chapter is about fixing some mistakes you may make. Mercurial has some useful tools, and there is also the <strong>bisect</strong> command. I had to use it several times, and it is really efficient. Some tips are given to help using this command efficiently, and it may be the most important topic in this chapter. Reverting or &#8220;removing&#8221; a commit (they are never really removed, they will stay in a hidden branch of some sort) can help sorting a situation, but you shouldn&#8217;t use it anyway. The book should have big red/orange warnings in this chapter (which is obviously has not). An important part of VCS is everything related to automation with hooks. Mercurial delivers several places where you can launch your scripts (for instance to update your web site), and the book has a good tutorial on how to write simple hooks.</p><p>Another not so important part is how you can customize Mercurial&#8217;s output. Interesting, but not that much. A topic that helped Mercurial gaining momentum is MQ (Management Queues). I don&#8217;t have the need myself, so the two chapters on that subject were a little bit boring. Besides, to use MQ, you have to set up another repository inside the hidden folder of Mercurial, which is not as efficient as having the queues directly inside the first repository. A good point is that it shows that extensions can really change the way Mercurial can be used (which is the subject of the last chapter).</p><h4>Conclusion</h4><p>All things considered, the book managed browsing through the capabilities of Mercurial. The contents may not be organized in the best way, but one can still find what it needs, and even more. If you want to use a DVCS, try Mercurial with this book, you won&#8217;t be disappointed (by neither of them).</p><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/uploads/2009/12/BN_Logo_3tier.jpg) right bottom no-repeat #ffffff;"> <a
rel="nofollow" href="http://r.popshops.com/pp/69261/mercurial-the-definitive-guide-modern-software-for-collaboration-animal-guide-se"><img
style="width: 150px;" src="http://images.barnesandnoble.com/images/40350000/40355581.JPG" border="0" alt="Mercurial: The Definitive Guide: Modern Software for Collaboration (Animal Guide Series)" /></a><br
/> <a
rel="nofollow" href="http://r.popshops.com/pp/69261/mercurial-the-definitive-guide-modern-software-for-collaboration-animal-guide-se">Mercurial: The Definitive Guide: Modern Software for Collaboration (Animal Guide Series)</a><br
/> Price: $35.99</div><div
class="subcolumns"><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/amazon_US_small.gif) right bottom no-repeat #ffffff;"><div
style="width: 57px; float: left; margin-right: 5px;"> <a
href="http://www.amazon.com/exec/obidos/ASIN/0596800673/masbl03-20" target="_blank"><img
src="http://ecx.images-amazon.com/images/I/414gvga11SL._SL75_.jpg" width="57" height="75" border="0" /></a></div><div><p><a
href="http://www.amazon.com/exec/obidos/ASIN/0596800673/masbl03-20" target="_blank">Mercurial: The Definitive Guide (Animal Guide)</a> (Paperback)<br
/> <span
style="font-size: 0.8em;">by <strong>Bryan O&#8217;Sullivan</strong></span><br
/> ISBN: 0596800673</p><p><strong>Price:</strong> <span
style="color: #990000; font-weight: bold;">USD 34.07</span><br
/> <strong>33 used &#038; new</strong> available from <span
style="color: #990000; font-weight: bold;">USD 17.93</span></p><p> <img
src="http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/stars-5.gif" class="asa_rating_stars" /> | 5 | 4</div><div
style="clear: both;"></div></div></div>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2009/11/19/book-review-mercurial-the-definitive-guide/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Book Review: Pragmatic Version Control Using Git</title><link>http://matt.eifelle.com/2009/10/06/book-review-pragmatic-version-control-using-git/</link> <comments>http://matt.eifelle.com/2009/10/06/book-review-pragmatic-version-control-using-git/#comments</comments> <pubDate>Tue, 06 Oct 2009 07:07:52 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Book review]]></category> <category><![CDATA[Development process]]></category> <category><![CDATA[Pragmatic Bookshelf]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[DVCS]]></category> <category><![CDATA[Git]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=790</guid> <description><![CDATA[As I was looking for a book on Bazaar (a book I didn&#8217;t find yet), I ran accross this one on Git. I heard that to use correctly Git, one needed a tutorial, so I figured a pragmatic book would do the trick.Content and opinions
The book has three main parts: a general introduction to Distributed [...]]]></description> <content:encoded><![CDATA[<p>As I was looking for a book on Bazaar (a book I didn&#8217;t find yet), I ran accross this one on Git. I heard that to use correctly Git, one needed a tutorial, so I figured a pragmatic book would do the trick.</p><p><span
id="more-790"></span></p><h4>Content and opinions</h4><p>The book has three main parts: a general introduction to Distributed Version Control Systems (DVCS) and Git, using Git everyday and what is called administration.</p><p>The introduction covers the different choices made by Git relative to Version Control. Without the actual commands, it is a gentle introduction, and if the choices does not suit you, well, you can walk away here. Its mainly an introduction to DVCS, but with a Git biais. If you find the book in a real library, you can browse this single chapter first. Then, another chapter helps you install the software package on Linux, OS X or even Windows.</p><p>The actual fun part comes next. How do you actually use Git to add and commit changes? Git has some some specifics in that matter compared to Bazaar or Mercurial. What are branches and how can they be used, how they should be used? What is the purpose of history and how it can be changed (fundamentaly changed)? Git is one of the few VCS that can actually rewrite history. There are of course enough warnings because this can be dangerous. Once history is known, it can be shared through remote repositories, and then how should a repository be organized? Finally some additional tools are presented. It&#8217;s really easy to follow the evolution, and it draws a small picture of the commands you will use every day.</p><p>The last part is abut migrating from CVS and SVN, and then how to set up a Git server. The connection between the commands in SVN and CVS is also described when you switch to Git. Of course, you will need more than CVS and SVN knowlegde to really use Git to its maximum power, the book is not about the theory of VCS, only about how to use Git. You will find a good introduction, but you will have to learn by other means the complete philosophy behind DVCS.</p><h4>Conclusion</h4><p>I didn&#8217;t know much about Git before reading the book, and the approach proposed here is efficient (although simple): from the basics to advanced workflows. You need to know a little about version control, as the Git specific parts are well explained in the book.</p><div
class="subcolumns"><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/amazon_US_small.gif) right bottom no-repeat #ffffff;"><div
style="width: 63px; float: left; margin-right: 5px;"> <a
href="http://www.amazon.com/exec/obidos/ASIN/1934356158/masbl03-20" target="_blank"><img
src="http://ecx.images-amazon.com/images/I/519CeNsejdL._SL75_.jpg" width="63" height="75" border="0" /></a></div><div><p><a
href="http://www.amazon.com/exec/obidos/ASIN/1934356158/masbl03-20" target="_blank">Pragmatic Version Control Using Git (Pragmatic Starter Kit)</a> (Paperback)<br
/> <span
style="font-size: 0.8em;">by <strong>Travis Swicegood</strong></span><br
/> ISBN: 1934356158</p><p><strong>Price:</strong> <span
style="color: #990000; font-weight: bold;">USD 23.07</span><br
/> <strong>46 used &#038; new</strong> available from <span
style="color: #990000; font-weight: bold;">USD 16.00</span></p><p> <img
src="http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/stars-4.5.gif" class="asa_rating_stars" /> | 4.5 | 20</div><div
style="clear: both;"></div></div></div>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2009/10/06/book-review-pragmatic-version-control-using-git/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Parallel Studio: Using Advisor Lite</title><link>http://matt.eifelle.com/2009/09/22/parallel-studio-using-advisor-lite/</link> <comments>http://matt.eifelle.com/2009/09/22/parallel-studio-using-advisor-lite/#comments</comments> <pubDate>Tue, 22 Sep 2009 08:02:28 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[C++]]></category> <category><![CDATA[Distributed Computing]]></category> <category><![CDATA[Interactive RayTracer]]></category> <category><![CDATA[Profiler]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Advisor]]></category> <category><![CDATA[Intel]]></category> <category><![CDATA[Parallel Studio]]></category> <category><![CDATA[Raytracing]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=647</guid> <description><![CDATA[After reviewing Parallel Studio, I&#8217;ve decided to look after Advisor Lite. Intel offers it for free, before the actual Advisor is released with a future Parallel Studio version. It aims at steering multithreaded development with Parallel Studio.I&#8217;ve started with the Starting Guide, and in fact, it is the best way to know how to use [...]]]></description> <content:encoded><![CDATA[<p>After reviewing <a
href="http://matt.eifelle.com/2009/07/07/review-of-intel-parallel-studio/">Parallel Studio</a>, I&#8217;ve decided to look after Advisor Lite. Intel offers it for free, before the actual Advisor is released with a future Parallel Studio version. It aims at steering multithreaded development with Parallel Studio.<br
/> <span
id="more-647"></span><br
/> I&#8217;ve started with the Starting Guide, and in fact, it is the best way to know how to use this plugin. Advisor offers four steps, two of them being short-cuts to the online help, and the two others link to some Parallel Studio actions (namely hotspot in Amplifier and the threaded memory check with Inspector).<br
/> The online help is interesting, but once you know how you can parallelize an application and what to look for, the two Parallel Studio actions with the help of some macros presented in the Starting Guide are the only thing you need.</p><h4>Test on parallelizing a custom library</h4><p>I&#8217;ve decided to test Advisor Lite on my <a
href="http://matt.eifelle.com/category/cpp/interactive-raytracer/">Interactive Raytracer</a>. This is a test to verify if Advisor Lite finds the adequate parallelization and the memory sharing issues. It is a simple raytracer, so it can be parallelized for each pixel in the image. The only memory sharing issue that I know of is in the kd-tree ray traversal.</p><h4>Profiling the library</h4><p>First, I will profile the library. For the complete Advisor Lite workflow, I have to use Intel Compiler, and as it is faster than Microsoft&#8217;s compiler, I will use the <strong>timeit_image.py</strong> script instead of the <strong>measure_image.py</strong> I&#8217;ve used when profiling with <a
href="http://matt.eifelle.com/2009/04/07/profiling-with-valgrind/">Valgrind</a> or <a
href="http://matt.eifelle.com/2009/08/18/profiling-with-visual-studio-performance-tool/">Visual Studio</a>.</p><p>Amplifier can show the results in a bottom-up or in a top-down manner. Unfortunately, you only have the exclusive timing that is displayed. In my case, when displaying bottom-up results, the method <strong>getEntryExitDistances()</strong> is the most costly one. In the top-down view, unfortunately, I can&#8217;t have a simple tree, as it can be seen in the following view:</p><p><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/irt-profile-advisor.png"><img
class="aligncenter size-medium wp-image-727" title="IRT: Amplifier profile (call-tree view)" src="http://matt.eifelle.com/wp-content/uploads/2009/08/irt-profile-advisor-300x187.png" alt="IRT: Amplifier profile (call-tree view)" width="300" height="187" /></a></p><p>In Visual Studio, I have the same results &#8211; more or less -, but with a correct top-down call-tree:</p><p><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/irt-profile-msvc.png"><img
class="aligncenter size-medium wp-image-695" title="Profile returned by Visual Studio Performance Tool (call-tree)" src="http://matt.eifelle.com/wp-content/uploads/2009/08/irt-profile-msvc-300x187.png" alt="Profile returned by Visual Studio Performance Tool (call-tree)" width="300" height="187" /></a></p><p>The method <strong>getEntryExitDistances()</strong> cannot be parallelized: it is recursively called, several times per pixel, which would lead to a lot of memory contention. The simpler task is thus to parallelized the pixel rendering, a perfect data-parallel problem.</p><h4>Annotation of the code</h4><p>OK, now I can annotate my code. I had to dig inside the help for this, as it was not mentionned in the Starting Guide that Intel provides a header, <strong>annotate.h</strong>, which mimics the issues you may encounter in a multithreaded application.</p><p>So you need to read at least once the online help so that you know the available annotation macros, how you can get them and how they will retrieve what you need. Once the code is annotated, it must be recompiled and then the sharing issues can be detected.</p><h4>Detection of sharing issues</h4><p>As expected, Inspector detected errors in the kd-tree traversal:</p><p><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/irt-advisor-annotate-correctness.png"><img
class="aligncenter size-medium wp-image-696" title="Memory sharing issues detected by Inspector" src="http://matt.eifelle.com/wp-content/uploads/2009/08/irt-advisor-annotate-correctness-300x187.png" alt="Memory sharing issues detected by Inspector" width="300" height="187" /></a><br
/> The solution in this case is to have a ray-traversal stack per thread, which will have to be implemented in whichever parallel library will be chosen, or simply to put the stack in the actual traversal algorithm and not in the instance.</p><h4>Using TBB</h4><p>I&#8217;ve decided to go for Thread Building Blocks, as it was already used for game development. This seemed to me a good idea, as it is a Open Source solution. So now, I will split the screen in 2D pieces, and add a thread-specific storage in the kd-tree class. Of course, I will have to add a flag to disable this paralellization if TBB is not available.</p><p>The actual parallelization will be in a future post in the Interactive Raytracer category. It is pretty straightforward once I had the different elements Parallel Studio gave me.</p><h4>Conclusion</h4><p>In fact Advisor is mainly the <strong>annotate.h</strong> header, as you have to know your program to put the macros at correct locations. The parallelization must be done by hand, as well as correcting the memory sharing issues.</p><p>The only problem I had is that <strong>annotate.h</strong> includes <strong>window.h</strong>. This header is not C++ compliant and declares some macros as <strong>max()</strong> (in fact I got the same issue with TBB headers!). As I use a <strong>max()</strong> function declared in <strong>std::numerical_limits</strong>,  I had to explicitely undefine this macro.</p><p>Safe from this, Advisor Lite is a good plugin, and I&#8217;m looking forward to seeing Advisor in a next Parallel Studio release.</p>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2009/09/22/parallel-studio-using-advisor-lite/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Book review: Test-Driven Development</title><link>http://matt.eifelle.com/2009/08/20/book-review-test-driven-development/</link> <comments>http://matt.eifelle.com/2009/08/20/book-review-test-driven-development/#comments</comments> <pubDate>Thu, 20 Aug 2009 08:47:33 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[Addison-Wesley]]></category> <category><![CDATA[Book review]]></category> <category><![CDATA[Design Patterns]]></category> <category><![CDATA[Development process]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Test patterns]]></category> <category><![CDATA[Test-Driven Development]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=405</guid> <description><![CDATA[Test-Driven Development is one of the most controversial development processes. Instead of planning everything ahead, you develop your program incrementally as well as simultaneously and rigorously test it. Kent Beck is one of the most proeminent advocates of this method and this book is the Bible of TDD.Content and opinions
TDD is about testing while developing, [...]]]></description> <content:encoded><![CDATA[<p>Test-Driven Development is one of the most controversial development processes. Instead of planning everything ahead, you develop your program incrementally as well as simultaneously and rigorously test it. Kent Beck is one of the most proeminent advocates of this method and this book is the Bible of TDD.</p><p><span
id="more-405"></span></p><h4>Content and opinions</h4><p>TDD is about testing while developing, so it is of no wonder that the first part of the book which expose the methodology is done with the help of an example. Small steps, one of the main ideas behind TDD, in the explanations result in a lot of small chapters that explain how to do one thing.</p><p>The second part is about the main tol for TDD: xUnit. Its goal is to provide a standard tool for all languages.Well, in fact, it is different implementation, but some are not as easy to use as JUnit, the Java implementation. Some languages are more easy to cope with TDD than others.</p><p>The third part is a formal list of patterns to efficiently develop with TDD. What do you need to test something completly? What do you need to go from a test to the actual associated solution? This is the kind of questions the patterns try to answer.</p><h4>Conclusion</h4><p>There are a lot chapters with simple ideas in each one. What bothers me is that they could have been hierarchized a little bit more, but really, this is not an issue here. TDD is something that everyone should do, but there are some domains where it is more difficult than in other. For instance, hw would you test a complex stochastic scientific module? This is a question that remains open at the end of the book. For general IT, it answers every question on testing though.</p><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/uploads/2009/12/BN_Logo_3tier.jpg) right bottom no-repeat #ffffff;"> <a
rel="nofollow" href="http://r.popshops.com/pp/69397/test-driven-development-by-example"><img
style="width: 150px;" src="http://images.barnesandnoble.com/images/14580000/14587404.JPG" border="0" alt="Test Driven Development: By Example" /></a><br
/> <a
rel="nofollow" href="http://r.popshops.com/pp/69397/test-driven-development-by-example">Test Driven Development: By Example</a><br
/> Price: $44.99</div><div
class="subcolumns"><div
style="border: 1px solid #000; padding: 5px; margin-bottom: 15px; background: url(http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/amazon_US_small.gif) right bottom no-repeat #ffffff;"><div
style="width: 60px; float: left; margin-right: 5px;"> <a
href="http://www.amazon.com/exec/obidos/ASIN/0321146530/masbl03-20" target="_blank"><img
src="http://ecx.images-amazon.com/images/I/513PZWJDH7L._SL75_.jpg" width="60" height="75" border="0" /></a></div><div><p><a
href="http://www.amazon.com/exec/obidos/ASIN/0321146530/masbl03-20" target="_blank">Test Driven Development: By Example</a> (Paperback)<br
/> <span
style="font-size: 0.8em;">by <strong>Kent Beck</strong></span><br
/> ISBN: 0321146530</p><p><strong>Price:</strong> <span
style="color: #990000; font-weight: bold;">USD 40.53</span><br
/> <strong>54 used &#038; new</strong> available from <span
style="color: #990000; font-weight: bold;">USD 24.99</span></p><p> <img
src="http://matt.eifelle.com/wp-content/plugins/amazonsimpleadmin/img/stars-4.gif" class="asa_rating_stars" /> | 4 | 34</div><div
style="clear: both;"></div></div></div>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2009/08/20/book-review-test-driven-development/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Profiling with Visual Studio Performance Tool</title><link>http://matt.eifelle.com/2009/08/18/profiling-with-visual-studio-performance-tool/</link> <comments>http://matt.eifelle.com/2009/08/18/profiling-with-visual-studio-performance-tool/#comments</comments> <pubDate>Tue, 18 Aug 2009 08:14:39 +0000</pubDate> <dc:creator>Matt</dc:creator> <category><![CDATA[C++]]></category> <category><![CDATA[General]]></category> <category><![CDATA[Interactive RayTracer]]></category> <category><![CDATA[Profiler]]></category> <category><![CDATA[Tools]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Profiling]]></category> <category><![CDATA[Visual Studio]]></category><guid
isPermaLink="false">http://matt.eifelle.com/?p=689</guid> <description><![CDATA[After presenting Valgrind as an emulation profiler, I will present Microsoft solution, Visual Studio Performance Tool. It is available in the Team Suite editions, and offers a sampling- and an instrumentation-based profiler. Of course, it is embedded in Visual Studio IDE and accessible from a solution.Using the profiler
First of all, the code must be compiled [...]]]></description> <content:encoded><![CDATA[<p>After presenting <a
href="http://matt.eifelle.com/2009/04/07/profiling-with-valgrind/">Valgrind</a> as an emulation profiler, I will present Microsoft solution, Visual Studio Performance Tool. It is available in the Team Suite editions, and offers a sampling- and an instrumentation-based profiler. Of course, it is embedded in Visual Studio IDE and accessible from a solution.<br
/> <span
id="more-689"></span></p><h4>Using the profiler</h4><p>First of all, the code must be compiled with <strong>/Zi</strong> or <strong>/Z7</strong>. Then, the link edition must be done with <strong>/DEBUG</strong>. Without these options, it won&#8217;t be possible to measure anything.</p><p>Performance Tool must be used in a Visual Studio Solution, which I don&#8217;t have in the case of the Interactive Raytracer. I will have to create an empty project, and I will create a bogus project, just to be able to browse the code in the IDE.</p><p>Once in Performance Tool, I create a new target which will be my generated library:<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-ajouter-binaire-01.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-ajouter-binaire-01-300x187.png" alt="Adding a new target to a Performance session" title="Adding a new target to a Performance session" width="300" height="187" class="aligncenter size-medium wp-image-704" /></a></center></p><p>Then, I have to add it to the targets to profile:<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-proprietes-02.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-proprietes-02-300x187.png" alt="Selected targets to profile" title="Selected targets to profile" width="300" height="187" class="aligncenter size-medium wp-image-703" /></a></center></p><p>Then I modify the launch properties to launch python with a sample script that is supposed to be descriptive enough. If you profile a Visual Studio project, you can use the debugging project properties (there are more environment parameters that you may modify).<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-ajouter-binaire-02.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-ajouter-binaire-02-300x187.png" alt="Modify launch properties" title="Modify launch properties" width="300" height="187" class="aligncenter size-medium wp-image-702" /></a></center></p><h4>Sampling</h4><p>To use the sampling profiler, you have to select it in the session parameters. Once done, you can launch the profiler.</p><p>This is the results I got from the IRT:<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-sampling-01.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-sampling-01-300x187.png" alt="Sampling: Main result page" title="Sampling: Main result page" width="300" height="187" class="aligncenter size-medium wp-image-707" /></a></center><br
/> Only the most relevant are shown in the first panel. The first table is the most important inclusive function. The cost of a function is its cost as well as the functions it has called. Then the second table is the most important exclusive functions: only the cost of the function, without the cost of the called functions, is used.</p><p>This view helps finding the function to optimize. It display the current function at the middle of the panel, and then the caller functions at the top and the callee/called functions at the bottom. The displayed costs are inclusive and exclusive costs.<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-sampling-03.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-sampling-03-300x187.png" alt="Sampling: Function callers and callees" title="Sampling: Function callers and callees" width="300" height="187" class="aligncenter size-medium wp-image-708" /></a></center></p><p>A more general view, the call-tree, can help finding the hotspot as well. The caller can obviously not be displayed.<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-sampling-04.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-sampling-04-300x187.png" alt="Sampling: Call-tree" title="Sampling: Call-tree" width="300" height="187" class="aligncenter size-medium wp-image-709" /></a></center></p><p>It is easy to get access to the code by a left click, which is one of the reasons I&#8217;ve created a bigus Visual Studio project.</p><h4>Instrumentation</h4><p>Instrumentation-based profiling is somewhat different than sampling-based profiling. Here, the executable is modified to count cycles or counters, whereas in sampling-based profile, the program is sampled at regular intervals to get where the program is, the counters, &#8230;</p><p>Instrumentation results are quite like the sampling ones<br
/><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-instrumentation-01.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-instrumentation-01-300x187.png" alt="Instrumentation: Main result page" title="Instrumentation: Main result page" width="300" height="187" class="aligncenter size-medium wp-image-710" /></a></center></p><p><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-instrumentation-03.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-instrumentation-03-300x187.png" alt="Instrumentation: Callers and callees" title="Instrumentation: Callers and callees" width="300" height="187" class="aligncenter size-medium wp-image-711" /></a></center></p><p><center><a
href="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-instrumentation-04.png"><img
src="http://matt.eifelle.com/wp-content/uploads/2009/08/msvc-instrumentation-04-300x187.png" alt="Instrumentation: Call-tree" title="Instrumentation: Call-tree" width="300" height="187" class="aligncenter size-medium wp-image-712" /></a></center></p><h4>Conclusion</h4><p>According to the different results I got, I know that I have some work to do on the math library. Well, this was some months ago, so now this code optimized as well. Based on Performance Tool profile, a lot has been optimized, as not creating rays inside the loop, &#8230;</p><p>I cannot really compare Performance Tool to Valgrind, as they are not the same kind of profilers. They each give more or less precise information on some parts of your program.<br
/> Compared to KCacheGrind, the callee map is missing, but Microsoft did a great job with the UI. The information may not be visualized as a 2D image, but it is still easy to extract it from the different views.</p><p>As a conclusion, I&#8217;d simply say that Performance Tool is an excellent tool Mixrosoft provides in its high-end Visual Studio versions. To bad it is not acceissble in the lower versions.</p>]]></content:encoded> <wfw:commentRss>http://matt.eifelle.com/2009/08/18/profiling-with-visual-studio-performance-tool/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Served from: matt.eifelle.com @ 2010-07-30 08:43:09 by W3 Total Cache -->