Abstract

This chapter discusses vectorization via the use of Single Instruction Multiple Data (SIMD)-enabled functions in C, C++, and Fortran. Using a financial code problem as the example, the chapter discusses issues that impact optimal vectorization, then presents modified code and performance results. SIMD-enabled functions can greatly enhance application performance without making significant changes to a program. This chapter focuses on (1) the use of the OpenMP pragma SIMD directive that explicitly tells the compiler to turn a loop into an SIMD vector loop and (2) the use of the OpenMP SIMD processor() clause that tells the compiler to generate a vector loop for one or more CPU architecture types. In combination, these give us the ability to create portable libraries and executables containing efficient vector loops for multiple CPU architectures. The appropriate vector loops are selected automatically at runtime with no recompilation required.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.