With Intel® C++ Compiler 19.0 and newer and with Intel® Fortran Compiler 19.1 and newer including Intel® oneAPI DPC++/C++ Compiler and Intel® Fortran Compiler available in the oneAPI Toolkits, we have support for the SIMD implementation of the inclusive and exclusive scan. Starting with OpenMP* Version 5.0, the reduction clause supports scans patterns.
Explicit syntax for inclusive scan using C++
Explicit syntax for inclusive scan using Fortran
Explicit syntax for exclusive scan using C++
Explicit syntax for exclusive scan using Fortran
Below is a C++ code snippet which uses prefix sum with SIMD scan feature. The implementation offers serial version of the code, as well as, SIMD version of both Inclusive and Exclusive scans.
EXCLUSIVE SCAN
INCLUSIVE SCAN
Here is the Fortran version of the same code snippet.
EXCLUSIVE SCAN
INCLUSIVE SCAN
REFERENCES
Explicit Vector Programming in Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference
SIMD Directive for OpenMP in Intel Fortran Developer Guide and Reference
Notices and Disclaimers
Intel technologies may require enabled hardware, software or service activation.
No product or component can be absolutely secure.
Your costs and results may vary.
© Intel Corporation. Intel, the Intel logo, and other Intel marks are trademarks of Intel Corporation or its subsidiaries. Other names and brands may be claimed as the property of others.
No license (express or implied, by estoppel or otherwise) to any intellectual property rights is granted by this document.
The products described may contain design defects or errors known as errata which may cause the product to deviate from published specifications. Current characterized errata are available on request.
Intel disclaims all express and implied warranties, including without limitation, the implied warranties of merchantability, fitness for a particular purpose, and non-infringement, as well as any warranty arising from course of performance, course of dealing, or usage in trade.