next up previous index
Next: Subroutine minpower2 Up: Answers to Assignment 2 Previous: Dumping rasters

Subroutine factor_nodes

This subroutine finds about the number of processors that the job runs on: 

    n2 = NUMBER_OF_PROCESSORS()
and then simply checks if that number can be represented as

\begin{displaymath}2^h\times3^i\times5^j\times7^k\times11^m
\end{displaymath}

where h, i, j, k, and m are integers and j, k, and m are restricted to be 0 or 1, i is restricted to be 0, 1, or 2, and h is an integer between 1 and 25 inclusive.

The subroutine goes about its business by trying to divide the returned number of nodes by 11, then by 7, then by 5, and finally by 3. Because in the latter case i can be 0, 1, or 2, the logic is a little more convoluted, i.e., we have to check both for 31 and 32.

The subroutine also checks if there is a 2h factor in n2, but it does not check if h is less than 25, which is going to cause problems on machines with more than 225 = 33,554,432 processors. That check is done by calling function minpower2.

The resulting powers are returned on an array pn_fac:

\begin{displaymath}\hbox{{\tt pn\_fac}} = [h, i, j, k, m]
\end{displaymath}

If the number of nodes is not of the form

\begin{displaymath}2^h\times3^i\times5^j\times7^k\times11^m
\end{displaymath}

the subroutine writes an advisory error message and bails out.


next up previous index
Next: Subroutine minpower2 Up: Answers to Assignment 2 Previous: Dumping rasters
Zdzislaw Meglicki
2001-02-26