Introduction

Nearly all the computers sold today have a multi-core processor, but only a small number of applications are written to take advantage of the extra cores. Most programmers are playing catch-up. A recent consultation with a group of senior programming engineers revealed the top three hurdles in adopting parallelism: the challenges of porting legacy code, the lack of education, and the lack of the right kinds of programming tools. This book helps to address some of these hurdles.

This book was written to help you use Intel Parallel Studio XE to write programs that use the latest features of multi-core CPUs. With the help of this book, you should be able to produce code that is fast, safe, and parallel. In addition to helping you write parallel code, some chapters cover other optimization topics that you can use in your code development, regardless of whether or not you are developing parallel code. Most of the chapters include hands-on activities that will help you apply the techniques being explained.

Who This Book Is For

If you are writing parallel code or are interested in writing parallel code, this book is for you. The target audience includes:

  • C and C++ developers who are adding parallelism to their code. The required technical skill is “average” to “experienced.” Knowledge of C programming is a prerequisite.
  • Students and academics who are looking to gain practical experience in making code parallel.
  • Owners and users of Intel Parallel Studio XE.

What This Book Covers

This book, written using Parallel Studio XE 2011, shows how you can profile, optimize, and parallelize your code. By reading this book, you will learn how to:

  • Analyze applications to determine the best place to implement parallelism.
  • Implement parallelism using a number of language extensions/standards.
  • Detect and correct difficult to find parallel errors.
  • Tune parallel programs.
  • Write code that is more secure.
  • Use the compiler switches to create optimized code that takes advantage of the latest CPU extensions.
  • Perform an architectural analysis to answer the question, “Is my program making the best use of the CPU?”

How This Book Is Structured

The book is comprised of the following parts:

  • Part I: An Introduction to Parallelism
  • Part II: Using Parallel Studio XE
  • Part III: Case Studies

Every chapter in the book, with the exception of the first two chapters, offers hands-on activities. These activities are an important part of the book, although you can read the book without completing them.

Chapters 6-9 are intended to be used in sequence, showing how to add parallelism to your code using a well-tested, four-step methodology (analyze, implement, error-check, and tune). Examples of parallelism are provided using Cilk Plus, OpenMP, and Threading Building Blocks.

The case studies are based on larger projects and show how Parallel Studio XE was used to parallelize them.

What You Need to Use This Book

You need the following to use this book:

  • Intel Parallel Studio XE. You can download an evaluation version from the Intel Software Evaluation Center (http://software.intel.com/en-us/articles/intel-software-evaluation-center/).
  • If you are using Windows:
    • Visual Studio (not the Express edition) version 2005, 2008, or 2010
    • Windows XP, Windows 2008, or Windows 7
  • If you are using Linux:
    • An installation of the GNU GCC compiler development tools
    • Debian* 6.0; Red Hat Enterprise Linux* 4 (Deprecated), 5, 6; SUSE Linux Enterprise Server* 10, 11 SP1; or Ubuntu* 10.04
  • A PC based on an IA-32 or Intel 64 architecture processor supporting the Intel Streaming SIMD Extensions 2 (Intel SSE2) instructions (Intel Pentium 4 processor or later), or compatible non-Intel processor. If you use a non-Intel processor, you will not be able to carry out the activities in Chapter 12, “Event-Based Analysis with VTune Amplifier XE.”

Conventions

To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.


1

Boxes with a warning icon like this one hold important, not-to-be-forgotten information that is directly relevant to the surrounding text.

 

note

The pencil icon indicates notes, tips, hints, tricks, and asides to the current discussion.

As for styles in the text:

  • We italicize new terms and important words when we introduce them.
  • We show keyboard strokes like this: Ctrl+A.
  • We show filenames, URLs, and code within the text like so: persistence.properties.
  • We present code in two different ways:
We use a monofont type with no highlighting for most code examples.
We use bold to emphasize code that is particularly important in the present context or to show changes from a previous code snippet.

Source Code

As you work through the examples in this book, you may choose either to type in all the code manually, or to use the source code files that accompany the book. All the source code used in this book is available for download at www.wrox.com. When at the site, simply locate the book's title (use the Search box or one of the title lists) and click the Download Code link on the book's detail page to obtain all the source code for the book. Code that is included on the Web site is highlighted by the following icon:

download

Listings include the filename in the title. If it is just a code snippet, you'll find the filename in a code note such as this:

Code snippet filename

note

Because many books have similar titles, you may find it easiest to search by ISBN; this book's ISBN is 978-0-470-89165-0.

Once you download the code, just decompress it with your favorite compression tool. Alternately, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download .aspx to see the code available for this book and all other Wrox books.

Errata

We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata, you may save another reader hours of frustration, and at the same time, you will be helping us provide even higher-quality information.

To find the errata page for this book, go to www.wrox.com and locate the title using the Search box or one of the title lists. Then, on the book details page, click the Book Errata link. On this page, you can view all errata that have been submitted for this book and posted by Wrox editors. A complete book list, including links to each book's errata, is also available at www.wrox.com/misc-pages /booklist.shtml.

If you don't spot “your” error on the Book Errata page, go to www.wrox.com/contact /techsupport.shtml and complete the form there to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.

p2p.wrox.com

For author and peer discussion, join the P2P forums at p2p.wrox.com. The forums are a web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to e-mail you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.

At http://p2p.wrox.com, you will find a number of different forums that will help you, not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:

1. Go to p2p.wrox.com and click the Register link.
2. Read the terms of use and click Agree.
3. Complete the required information to join, as well as any optional information you wish to provide, and click Submit.
4. You will receive an e-mail with information describing how to verify your account and complete the joining process.

note

You can read messages in the forums without joining P2P, but in order to post your own messages, you must join.

Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the web. If you would like to have new messages from a particular forum e-mailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.

For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works, as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.12.34