Optimizing Applications for Multicore by Intel Software Engineer Levent Akyil Welcome to the Parallel Universe
Total Page:16
File Type:pdf, Size:1020Kb
Letter to the Editor by parallelism author and expert James Reinders Are You Ready to Enter a Parallel Universe: Optimizing Applications for Multicore by Intel software engineer Levent Akyil Welcome to the Parallel Universe Contents Think Parallel or Perish, BY JAMES REINDERS .........................................................................................2 James Reinders, Lead Evangelist and a Director with Intel® Software Development Products, sees a future where every software developer needs to be thinking about parallelism first when programming. He first published“ Think Parallel or Perish“ three years ago. Now he revisits his comments to offer an update on where we have gone and what still lies ahead. Parallelization Methodology...................................................................................................................... 4 The four stages of parallel application development addressed by Intel® Parallel Studio. Writing Parallel Code Safely, BY PETER VARHOL ........................................................................... 5 Writing multithreaded code to take full advantage of multiple processors and multicore processors is difficult. The new Intel® Parallel Studio should help us bridge that gap. Are You Ready to Enter a Parallel Universe: Optimizing Applications for Multicore, BY LEVENT AKYIL .............................................. 8 A look at parallelization methods made possible by the new Intel® Parallel Studio—designed for Microsoft Visual Studio* C/C++ developers of Windows* applications. 8 Rules for Parallel Programming for Multicore, BY JAMES REINDERS ...................................................................................................................................................................... 16 There are some consistent rules that can help you solve the parallelism challenge and tap into the potential of multicore. EVOLVE YOUR CODE. Get robust parallelism from analysis and compiling through debugging and tuning. Intel® Parallel Studio is the ultimate all-in-one toolset for Windows* applications. These advanced software tools enable agile multicore software development for Microsoft Visual Studio* C/C++ developers. Everything you need to take serial code to parallel and parallel to perfection. Preorder now. Product shipping May 26. www.intel.com/software/parallelstudio © 2009 – 2010, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and other countries. *Other names and brands may be claimed as the property of others. © 2009-2010, Intel Corporation. All rights reserved. Intel and the Intel logo are trademarks of Intel Corporation in the U.S. and other countries. *Other names and brands may be claimed as the property of others. 1 Welcome to the Parallel Universe Welcome to the Parallel Universe Three years ago, as I thought Think about my own future in software de- A good design comes velopment, I penned a piece noting that as software developers we all need to from a human developer, personally “Think Parallel” or face a future where others will do so and we will cease to be competitive. I am still confident that not the tools. software development in 2016 will not This dawning of manycore proces- And, we have gone to beta with our be kind to programmers who have not What we must all learn to Parallel learned to “Think Parallel.” sors, as profound as it is, will not affect Intel® Parallel Studio project. This takes ev- do is “Think Parallel.” or Some of us will write parallel programs, very many programmers in 2009. It will, erything we’ve done to date, and makes it however, make this new parallel era even much more intuitive, robust, and exciting. By James Reinders some of us will not. Some will write using James Reinders, Lead Evangelist new languages to implement in, changing more real than multicore processors Soon, it will be a full product from Intel. and a Director with Intel® Software the way we do most everything. Most have. The opportunity for hardware to be These new projects are in addition to Development Products, sees a future where every software developer will not. enormously parallel is staggering. all the tools we had a few years ago. We needs to be thinking about parallelism What we must all do is learn to “Think The “not parallel” era we are now exit- are growing and expanding our tools to first when programming. He first Perish We are leaving behind an era of ing will appear to be a very primitive time support customers, while they expand published “Think Parallel or Perish“ Parallel.” Understanding how parallelism is too little parallelism. three years ago. Now he revisits and will be used on computers, in in the history of computers when people to use parallelism. We are generally not his comments to offer an update on Where are we now? where we have gone and what still applications, and in our environment is look back in a hundred years. The forcing obsolescence as we expand to To which I say: “It’s about lies ahead. critical to our future. Grasping how to use world works in parallel, and it is time for offer parallelism. Our customers appreci- time!” the good and avoid the bad in this new computer programs to do the same. We ate that. world, intuitively, is the challenge ahead are leaving behind an era of too little I’m also quite excited about Intel’s Ct of us in “Thinking Parallel.” parallelism, to which I say: “It’s about technology, and we’ll be talking more I still have my note stuck to my cube time!” Doing one thing at a time is “so about that as the year goes on. It is one wall: “Memo to self: The fastest way to yesterday.” of several more projects we have been unemployment is to not hone my pro- In less than a decade, a programmer experimenting with, and talking with gramming skills for exploiting parallelism.” who does not “Think Parallel” first will not customers about, to guide us on what This year, 2009, is the fifth year in be a programmer. more we should be doing to help. which Intel is shipping multicore proces- We are building tools that help with sors. Those five years were not the first What’s Intel doing to help? parallel programming. We are embracing five years of multicore processors, but When I first wrote about this a few years standards, extending current languages, they were the five years that drove x86 ago, Intel was already a longtime cham- using library APIs—all with an eye on scal- processors to multicore in servers and pion for the OpenMP* standard (www. ability, correctness, and maintainability. desktop and laptop computers. In this openmp.org) and had many tools for MPI It is still up to us, as software develop- time span, we’ve gone from a few multi- support. Our performance analysis tools ers, to know what to do with these core processor offerings to “game over” and debuggers were ahead of their time wonderful tools. Just as before parallelism, for single-core processors. with top to bottom support for paral- a good design comes from the human This year, 2009, we will also witness lelism. We also had emerging tools for developer—not the tools. Parallelism will another monumental milestone: this will finding deadlocks and race conditions in be no different. Hence, we humans need be the first year that Intel has a produc- parallel programs. to work on “Think Parallel.” tion manycore processor. Manycore pro- Since then, we’ve helped update James Reinders cessors differ from multicore processors OpenMP to specification version 3.0 and Portland, Oregon by having a more sophisticated system of were among the very first to support it in April 2009 interconnecting processors, caches, mem- our compilers. We launched our own MPI ories, and I/O. This is needed at about library, which is more portable and higher James Reinders is Chief Software Evangelist 16 or so cores—so manycore processors performing than prior options. and Director of Software Development Products, can be expected to have more cores than We created Intel® Threading Building Intel Corporation. His articles and books on paral- multicore processors. The world has never Blocks (Intel® TBB), which has become the lelism include Intel Threading Building Blocks: Outfitting C++ for Multicore seen a high-volume manycore processor, best and most popular way to program Processor Parallelism. Find out more at but over the next few years it will. parallelism in C++. www.go-parallelcom. 2 3 For more information regarding performance and optimization choices in Intel software products, visit http://software.intel.com/en-us/articles/optimization-notice. Welcome to the Parallel Universe Welcome to the Parallel Universe Writing Parallel PARALLELIZATION METHODOLOGY ® The Intel Software Development Tools solve four barriers, locks, and thread teams. To debug an Safely Code stages of parallel application development: application with the Intel Parallel Debugger the application must be built with the Intel® C++ Writing multithreaded With the explosion of multicore processors, the pressure is now ® 1. Code and Debug with Intel Parallel Composer: Compiler using the /debug:parallel option. code to take full on application developers to make effective use of this computing Use source code analysis capabilities of Intel Parallel advantage of multiple ® power. Developers are increasingly going to have to better identify Composer to identify errors in the source code during 2. Verify with Intel Parallel Inspector: Run Intel Paral- processors and compilation phase. To enable source code analysis lel Inspector to find threading errors such as data multicore processors opportunities for multithreading and independent parallel operation you will need to use the /Qdiag-enable:sc {[1|2|3]} races and deadlocks and memory errors that are likely is difficult. The in their applications, and to be able to implement those techniques compiler option. The number specifies the severity to occur. If you found errors, fix them and rebuild the ® level of the diagnostics (1=all critical errors, 2=all application with Intel Parallel Composer. new Intel Parallel in their code. errors, and 3=all errors and warnings).