Download presentation
Presentation is loading. Please wait.
Published byKevin Strickland Modified over 9 years ago
1
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Intel Confidential Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20151 Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20151 Selecting a Suitable Parallel Technology Parallel Technology Comparison
2
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20152 Agenda Considerations Examine Win32/Posix Threading Issues Overview of Parallel Programming Models The Threading Models –Fixed Function Libraries –Intel Parallel Building Blocks –Intel ® Cilk Plus –Intel ® Threading Building Blocks –Intel ® Array Building Blocks Comparison Chart Research Initiatives
3
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20153 Considerations in Choosing a Parallel Programming Model Compatibility with your Code –Supports your Base Language –Focus Today = C/C++/FORTRAN –Supports your Design Pattern –Tasking –Data Parallelism –Algorithms, Data Structures, Data Portability –New Processors –New Processor Paradigms (GPU) –Vendors: Compilers/OS/CPU Architecture –Compiler Extensions – Requires Supporting Compiler Scalability –Micro Architecture Parallelism (SIMD) –Multi-Core –GPU –Distributed Ease of Use –How much to learn –Data Model (Shared, Distributed, Other) –How easy to understand/reduce threading considerations –Compiler Extensions vs Library Based Composability with other Parallel Programming Models –Source File, –Process, –System Tool Support –QA Tools –Debugger –Automated Checking –Performance Analysis Tools
4
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20154 Finding a Number with Win32*/POSIX* Style Threading int pos=NOTFOUND; DWORD WINAPI FindnumThr((LPVOID)MyThreadID) { for(i=MyThreadID;i<MAX; i+=MAXTHREADS) if array[i]==val pos=i;} findnum() { for (int ThreadID=0;ThreadID<=MAXTHREADS;i++) SWThreads[i] = CreateThread(NULL, 0, ThreadFn, (LPVOID) i, 0, NULL); WaitForMultipleObjects(MAXTHREADS, SWThreads, TRUE, INFINITE);} Thought Lab: List as many nondesirable/missing features of this implementation as possible
5
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20155 Parallel Programming Models Fixed Function Libraries Other Supported Standards Research Initiatives Intel ® Math Kernel Library MPI Intel ® Concurrent Collections Intel ® Integrated Performance Primitives OpenMP* Intel ® Cluster OpenMP Intel ® OpenCL SDK Software Transactional Memory Intel ® Threading Building Blocks Intel ® Cilk Plus Intel ® Array Building Blocks Intel ® Parallel Building Blocks Win32* & POSIX*
6
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20156 Fixed Function Libraries Intel ® Math Kernel Library (MKL) BLAS, (Sca)LAPACK, FFTw, Vector Math Library, Vector Random Number Generation, Solvers (sparse) Intel ® Integrated Performance Primitives (IPP) Video, Image, Audio, Speech, Signal, Crypto, Compression, Data Integrity, String Processing, Linear Algebra, Solvers, Processor related functions, etc… Best Way to Thread – Let Somebody else do it :> When there are performance benefits functions are threaded/distributed All the functions are thread safe Included Examples shows how to use functions in a threaded manner Ex: Matrix Matrix Multiply MKL:dgemm IPP:ippiMul_8u_C4RSfs
7
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20157 Intel ® Cilk Plus An extremely simple but powerful C++/C compiler extensions consisting of a few simple keywords, hyperobjects, array notations, SIMD hint’s, and Elemental Functions cilk::reducer_list pos; void findnum(int *MAX, float *array, float val) { cilk_for(int i=0;i<*MAX;i++) if array[i]==val pos.push_back(i); }
8
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20158 Intel ® Threading Building Blocks A C++ Template Library – which promotes good threading design. tbb::concurent_queue pos; void findnum(int MAX, float *array, float val) { tbb::parallel_for( tbb::blocked_range (0, MAX), [&]( const tbb::blocked_range &r ) for(int i=r.begin;i<r.end;i++) if array[i]==val pos.push(i) //or instead of Q tbb::task::self().cancel_group_execution();) }
9
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/20159 Intel ® Array Building Blocks A generalized data-parallel programming model which transforms code (C++ today) into multiple implementations that exploit current and future hardware implementations. void findnum(dense array, f32 val, dense & results) { dense locations = (array == val); dense matching_indices = indices(0, array.length()); results = pack(matching_indices, locations); }
10
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201510 A Comparison of Parallel Technologies Language s 1 Learning Curve ComposableScalable Portable (OS/Compiler) Intel Tool Support Fixed Function Libraries MKLC, FortranEasyYes 3 Includes Distributed Very (Many Vendors) Good IPPCEasyYes 3 Very Good Linux, Windows, Apple Good Intel Parallel Building Blocks Intel Cilk PlusC++, CEasyYesVery GoodStay TunedYes 4 Intel TBBC++MediumYesVery Good Yes (Open Source) Yes Intel (r) Array Building Blocks C++MediumYesVery GoodStay TunedYes 4 Other Standards Win32*CEasy/Hard 2 NoDifficultNoVery Good Posix*CEasy/Hard 2 NoDifficult Yes (Many Vendors) Very Good
11
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201511 Introduced Parallel Programming Technologies: Discussed Parallel Programming Technologies Criteria Compared the Technologies Summary –Intel Parallel Building Blocks –Intel Cilk Plus –Intel Threading Building Blocks –Intel Array Building Blocks –Compatibility –Composability –Scalabilty –Other Supported Standards –Win32/Posix –Portability –Learning Curve –Tool Support
12
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201512 OpenMP* A set of compiler directives that you can insert into C/C++/FORTRAN code to specify parallelism int pos=NOTFOUND; void findnum(int MAX, float *array, float val) { #pragma OMP parallel for for (int i=0;i<MAX;i++) if array[i]==val #pragma omp critical pos=i;}
13
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201513 Message Passing Interface (MPI) #include int pos=NOTFOUND; MPI_Status status; MPI_Request request; int crank,csize; void main(int argc, char* argv[]) { MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&crank); MPI_Comm_size(MPI_COMM_WORLD,&csize); if (crank==0) getarray(array); findnum(array, MAX, val); MPI_Finalize(); } void findnum(int MAX, float *array, float val) { int localpos; MPI_Bcast(array,MAX,MPI_REAL,0, MPI_COMM_WORLD); for (int i=(crank*MAX/csize); i<=((crank+1)*(MAX/csize)-1);i++) if (array[i]==val) localpos=i; if (crank>=1) for(int i=1;i<csize;++i) MPI_send(&localpos,1,MPI_INT,0,TAG, MPI_COMM_WORLD); else { pos=localpos; for(int i=1;i<csize;++i) { int remotepos; MPI_recv(&remotepos,1,MPI_INT,i,TAG, MPI_COMM_WORLD,&status); if (remotepos!=NOTFOUND) then pos=remotepos; } } } “Distributed Parallel” Programming Library for Passing Messages between Processes. All Communication between tasks is explicit.
14
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201514 Research @Intel Intel ® OpenCL SDK On Whatif.intel.com –Concurrent Collections –Software Transactional Memory –Cluster OpenMP*
15
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201515 A Comparison of Parallel Technologies Languages 1 Learning Curve ComposableScalable Portable (OS/Compiler) Intel Tool Support Fixed Function Libraries MKLC, FortranEasyYes 3 Includes Distributed Very (Many Vendors) Good IPPCEasyYes 3 Very Good Linux, Windows, Apple Good Intel Parallel Building Blocks Intel Cilk PlusC++, CEasyYesVery GoodStay TunedYes 4 Intel TBBC++MediumYesVery Good Yes (Open Source) Yes Intel Array Building Blocks C++MediumYesVery GoodStay TunedYes 4 Other Standards Win32CEasy/Hard 2 NoDifficultNoVery Good PosixCEasy/Hard 2 NoDifficult Yes (Many Vendors) Very Good OpenMP C, C++, Fortran EasyNoGood Yes (Many Vendors) Good MPI C, Fortran MediumYesDistributed Yes (Many Vendors) Very Good Intel OpenCL SDK CMedium?Good Yes (Many Vendors) Some
16
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201516 Optimization Notice Intel compilers, associated libraries and associated development tools may include or utilize options that optimize for instruction sets that are available in both Intel and non-Intel microprocessors (for example SIMD instruction sets), but do not optimize equally for non-Intel microprocessors. In addition, certain compiler options for Intel compilers, including some that are not specific to Intel micro-architecture, are reserved for Intel microprocessors. For a detailed description of Intel compiler options, including the instruction sets and specific microprocessors they implicate, please refer to the “Intel Compiler User and Reference Guides” under “Compiler Options." Many library routines that are part of Intel compiler products are more highly optimized for Intel microprocessors than for other microprocessors. While the compilers and libraries in Intel compiler products offer optimizations for both Intel and Intel-compatible microprocessors, depending on the options you select, your code and other factors, you likely will get extra performance on Intel microprocessors. Intel compilers, associated libraries and associated development tools may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include Intel Streaming SIMD Extensions 2 (Intel SSE2), Intel Streaming SIMD Extensions 3 (Intel SSE3), and Supplemental Streaming SIMD Extensions 3 (Intel SSSE3) instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. While Intel believes our compilers and libraries are excellent choices to assist in obtaining the best performance on Intel and non-Intel microprocessors, Intel recommends that you evaluate other compilers and libraries to determine which best meet your requirements. We hope to win your business by striving to offer the best performance of any compiler or library; please let us know if you find we do not. Notice revision #20110228
17
Software & Services Group, Developer Products Division Copyright © 2010, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. Software & Services Group Developer Products Division Copyright© 2011, Intel Corporation. All rights reserved. *Other brands and names are the property of their respective owners. 8/23/201517 Legal Disclaimer 17 INFORMATION IN THIS DOCUMENT IS PROVIDED “AS IS”. NO LICENSE, EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. INTEL ASSUMES NO LIABILITY WHATSOEVER AND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO THIS INFORMATION INCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. Performance tests and ratings are measured using specific computer systems and/or components and reflect the approximate performance of Intel products as measured by those tests. Any difference in system hardware or software design or configuration may affect actual performance. Buyers should consult other sources of information to evaluate the performance of systems or components they are considering purchasing. For more information on performance tests and on the performance of Intel products, reference www.intel.com/software/products.www.intel.com/software/products BunnyPeople, Celeron, Celeron Inside, Centrino, Centrino Atom, Centrino Atom Inside, Centrino Inside, Centrino logo, Cilk, Core Inside, FlashFile, i960, InstantIP, Intel, the Intel logo, Intel386, Intel486, IntelDX2, IntelDX4, IntelSX2, Intel Atom, Intel Atom Inside, Intel Core, Intel Inside, Intel Inside logo, Intel. Leap ahead., Intel. Leap ahead. logo, Intel NetBurst, Intel NetMerge, Intel NetStructure, Intel SingleDriver, Intel SpeedStep, Intel StrataFlash, Intel Viiv, Intel vPro, Intel XScale, Itanium, Itanium Inside, MCS, MMX, Oplus, OverDrive, PDCharm, Pentium, Pentium Inside, skoool, Sound Mark, The Journey Inside, Viiv Inside, vPro Inside, VTune, Xeon, and Xeon Inside are trademarks of Intel Corporation in the U.S. and other countries. *Other names and brands may be claimed as the property of others. Copyright © 2011. Intel Corporation. http://intel.com/software/products
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.