Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Parallel Programming Guide for HP-UX Systems > Chapter 5 Loop and cross-module optimization features

Strip mining

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Strip mining is a fundamental +O3 transformation. Used by itself, strip mining is not profitable. However, it is used by loop blocking, loop unroll and jam, and, in a sense, by parallelization.

Strip mining involves splitting a single loop into a nested loop. The resulting inner loop iterates over a section or strip of the original loop, and the new outer loop runs the inner loop enough times to cover all the strips, achieving the necessary total number of iterations. The number of iterations of the inner loop is known as the loop’s strip length.

Example 5-1 Strip mining

This example begins with the Fortran code below:

DO I = 1, 10000
A(I) = A(I) * B(I)
ENDDO

Strip mining this loop using a strip length of 1000 yields the following loop nest:

DO IOUTER = 1, 10000, 1000
DO ISTRIP = IOUTER, IOUTER+999
A(ISTRIP) = A(ISTRIP) * B(ISTRIP)
ENDDO
ENDDO

In this loop, the strip length integrally divides the number of iterations, so the loop is evenly split up. If the iteration count was not an integral multiple of the strip length—if I went from 1 to 10500 rather than 1 to 10000, for example—the final iteration of the strip loop would execute 500 iterations instead of 1000.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.