next up previous contents
Next: ACTIVE_PROCS_SHAPE() Up: Specifications of Extended Intrinsic Previous: ACTIVE_NUM_PROCS(DIM)

ACTIVE_NUM_PROCS(DIM)

Optional Argument. DIM

Description. Returns the total number of processors currently executing the program or the number of processors currently executing the program along a specified dimension of the processor array, as determined by the innermost ON block.

Class. Processors inquiry function.

Arguments.

DIM (optional) must be scalar and of type integer with a value in the range 1 < DIM n where n is the rank of the processor array.

Result Type, Type Parameter, and Shape. Default integer scalar.

Result Value. The result has a value equal to the extent of dimension DIM of the processor array determined by the innermost containing ON block or, if DIM is absent, the total number of elements of this processor array. The result is always greater than zero. Outside of any ON block, the result is the same as that returned by NUMBER_OF_PROCESSORS().

Examples. The program fragment

        INTEGER X(16, 3)
        !hpf$ TEMPLATE T(16, 8)
        !hpf$ PROCESSORS PROCS(4, 4)
        !hpf$ ALIGN X(I, J) WITH T(I, 3*J-1)
        !hpf$ DISTRIBUTE T(CYCLIC(2), BLOCK) ONTO PROCS
        !hpf$ ON     (PROCS(:,:)) BEGIN
        !hpf$ ON HOME(X(2:12:10, :)) BEGIN
        PRINT *, ACTIVE_NUM_PROCS()
        PRINT *, ACTIVE_NUM_PROCS(DIM=1)
        PRINT *, ACTIVE_NUM_PROCS(DIM=2)
        !hpf$ END ON
        !hpf$ END ON

prints 6, 2 and 3 regardless of the size or shape of the hardware processor array on which the program is running,