{"id":2103,"date":"2012-10-12T09:20:00","date_gmt":"2012-10-12T09:20:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/vcblog\/2012\/10\/12\/check-out-the-new-c-amp-book-by-kate-gregory-and-ade-miller\/"},"modified":"2019-02-18T18:41:29","modified_gmt":"2019-02-18T18:41:29","slug":"check-out-the-new-c-amp-book-by-kate-gregory-and-ade-miller","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/cppblog\/check-out-the-new-c-amp-book-by-kate-gregory-and-ade-miller\/","title":{"rendered":"Check out the new C++ AMP book by Kate Gregory and Ade Miller"},"content":{"rendered":"<p>The <a href=\"http:\/\/shop.oreilly.com\/product\/0790145341907.do\">C++ AMP book<\/a>&nbsp;by Kate Gregory and Ade Miller is available in print or online from your favorite retailer! What is in it for you? Among other things, you will discover how to:<\/p>\n<ul>\n<li>Gain greater code performance using graphics processing units (GPUs)<\/li>\n<li>Choose accelerators that enable you to write code for GPUs<\/li>\n<li>Apply thread tiles, tile barriers, and tile static memory<\/li>\n<li>Debug C++ AMP code with Microsoft Visual Studio&reg;<\/li>\n<li>Use profiling tools to track the performance of your code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/li>\n<\/ul>\n<p>I was able to corner Ade Miller long enough to answer&nbsp;a few&nbsp;questions:<\/p>\n<p style=\"padding-left: 30px\"><b>Q1: &ldquo;C++ AMP&rdquo; in 140 characters or less?<\/b><\/p>\n<p style=\"padding-left: 30px\">&ldquo;A hardware agnostic data parallel programming model for C++.&rdquo;<\/p>\n<p style=\"padding-left: 30px\">That&rsquo;s pretty terse :). The C++ bit is important: C++ AMP is C++ not C.<\/p>\n<p style=\"padding-left: 30px\"><b>Q2. <\/b><b>How did you get interested in writing about C++ AMP?<\/b><\/p>\n<p style=\"padding-left: 30px\">I&rsquo;ve had a longstanding interest in GPU programming. I got into it when I was writing a book about the C++ Parallel Patterns Library (PPL) that shipped with Visual Studio 2010. Like a lot of other people I was amazed by the potential for huge performance gains. At the time CUDA was the obvious choice for GPU programming so I wrote a fair bit of CUDA code. At the same time I was actually lobbying the PPL team and telling them they should go after GPUs too. I was really happy to see how C++ AMP was turning out and to get involved with the book.<\/p>\n<p style=\"padding-left: 30px\"><b>Q3. <\/b><b>What kind of research did you do for this book?<\/b><\/p>\n<p style=\"padding-left: 30px\">I&rsquo;d been writing code for CUDA and Thrust so I was already pretty familiar with the data parallel model. I talked to the product team <i>a lot<\/i>. They were a fantastic resource and I&rsquo;m really grateful to them for giving me the time. I wrote or rewrote <i>a lot<\/i> of code. I didn&rsquo;t write all the book samples from scratch but I rewrote them to make sure that they not only used C++ AMP in the best possible way but also embraced the whole modern C++ style. I also ended up reading some really old papers from the 80s, stuff like &#8220;<a href=\"http:\/\/citeseerx.ist.psu.edu\/viewdoc\/download?doi=10.1.1.85.1876&amp;rep=rep1&amp;type=pdf\">Data Parallel Algorithms<\/a>&#8221; by Hollis &amp; Steele. A few of the first big supercomputers, like the Connection Machine, were data parallel. Those guys did a lot of great thinking around how to program in a data parallel way. In that way GPUs are the old new thing.<\/p>\n<p style=\"padding-left: 30px\"><b>Q4. <\/b><b>What was the hardest part about writing C++ AMP?<\/b><\/p>\n<p style=\"padding-left: 30px\">I think it&rsquo;s fair to say that was the work Kate and I did on performance (chapters 7-9). C++ AMP provides an abstraction over the GPU which is great for portability but occasionally it can lead to unexpected results that require more <br \/>thought to figure out. We were also working with pre-release bits. The product team were working hard to improve the performance so our numbers would change between drops and on different hardware. On the plus side I learnt a whole lot more about the inner workings of GPUs.<\/p>\n<p style=\"padding-left: 30px\"><b>Q5. <\/b><b>What are you working on now?<\/b><\/p>\n<p style=\"padding-left: 30px\">Some extra material for the book; some fun stuff and some stuff I think we would have put in if we had the time. It&rsquo;ll start appearing in the next few weeks. You can find out about it on <a href=\"http:\/\/ademiller.com\/tech\">my blog<\/a>. I&rsquo;m going to be doing some more coding with C++ and C++ AMP and I have another book project in mind.<\/p>\n<p style=\"padding-left: 30px\"><b>Q6. <\/b><b>What advice would you give new C++ developers? <\/b><\/p>\n<p style=\"padding-left: 30px\">Don&rsquo;t worry too much about some of the darker corners of the language. It&rsquo;s really easy to get caught up in some of the more esoteric features of C++ like performance tweaks and template (meta-)programming. There&rsquo;s good stuff there for sure, but you&rsquo;d be better off getting really comfortable with the Standard Library and the new language features of C++11. If you write modern C++ using algorithms, iterators and containers and use the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Resource_acquisition_is_initialization\">RAII<\/a> pattern a lot of the things new C++ programmers struggle with pretty much disappear.<\/p>\n<p style=\"padding-left: 30px\"><b>Q7. <\/b><b>Do you have any favorite C++ favorite authors or books?<\/b><\/p>\n<p style=\"padding-left: 30px\">Hands down Scott Meyers. Right now I&rsquo;m reading his &ldquo;<a href=\"http:\/\/www.aristeia.com\/C++11.html\">An Overview of the New C++ (C++11)<\/a>&rdquo;. It was reading his other books and listening to some of Herb Sutter&rsquo;s talks that got me interested in C++ again after a long vacation in C#.<\/p>\n<p style=\"padding-left: 30px\"><b>Q8. <\/b><b>What question should I have asked?<\/b><\/p>\n<p style=\"padding-left: 30px\">What&rsquo;s it like to be a famous author?<\/p>\n<p style=\"padding-left: 30px\"><b>Q9. <\/b><b>And the answer? <\/b><\/p>\n<p style=\"padding-left: 30px\">You&rsquo;d have to ask J.K. Rowling! Although someone did recognize me on the subway in Montreal a while back, which was quite a surreal experience.<\/p>\n<p>Thanks Ade!<\/p>\n<p>Visit the C++ AMP Book <a href=\"http:\/\/www.gregcons.com\/cppamp\/\">landing page<\/a> for updates, retailers, and pointers to additional resources.<\/p>\n<p>Should I have asked other questions? Let me know in the comments. Thanks!&nbsp;<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The C++ AMP book&nbsp;by Kate Gregory and Ade Miller is available in print or online from your favorite retailer! What is in it for you? Among other things, you will discover how to: Gain greater code performance using graphics processing units (GPUs) Choose accelerators that enable you to write code for GPUs Apply thread tiles, [&hellip;]<\/p>\n","protected":false},"author":264,"featured_media":35994,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[178,8,179,140],"class_list":["post-2103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cplusplus","tag-amp","tag-announcement","tag-book","tag-c"],"acf":[],"blog_post_summary":"<p>The C++ AMP book&nbsp;by Kate Gregory and Ade Miller is available in print or online from your favorite retailer! What is in it for you? Among other things, you will discover how to: Gain greater code performance using graphics processing units (GPUs) Choose accelerators that enable you to write code for GPUs Apply thread tiles, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/2103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/users\/264"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/comments?post=2103"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/posts\/2103\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media\/35994"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/media?parent=2103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/categories?post=2103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/cppblog\/wp-json\/wp\/v2\/tags?post=2103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}