next up previous contents
Next: LOCAL_LINDEX(ARRAYDIM, PROC) Up: HPF Local Routine Library Previous: LOCAL_BLKCNT(ARRAYDIM, PROC)

LOCAL_BLKCNT(ARRAY, DIM, PROC)

Optional arguments. DIM, PROC.

Description. Returns the number of blocks of elements in each dimension, or of a specific dimension of the array on a given processor.

Class. Pure function.

Arguments.

ARRAY may be of any type; it must be a dummy array that is associated with a global HPF array actual argument.

DIM (optional) must be scalar and of type integer with a value in the range 1 < DIM n, where n is the rank of ARRAY. The corresponding actual argument must not be an optional dummy argument.

PROC (optional) must be scalar and of type integer. It must be a valid processor number.

Result Type, Type Parameter, and Shape. The result is of type default integer. It is scalar if DIM is present; otherwise the result is an array of rank one and size , where is the rank of ARRAY.

Result Value.

Case (i): The value of LOCAL_BLKCNT(ARRAY, DIM, PROC) is the number of blocks of the ultimate align target of ARRAY in dimension DIM that are mapped to processor PROC and which have at least one element of ARRAY aligned to them.

Case (ii): LOCAL_BLKCNT(ARRAY, DIM) returns the same value as
LOCAL_BLKCNT(ARRAY, DIM, PROC=MY_PROCESSOR()).

Case (iii): LOCAL_BLKCNT(ARRAY) has a value whose component is equal to
LOCAL_BLKCNT(ARRAY, ), for , where is the rank of ARRAY.


Examples. Given the declarations

        REAL A(20,20), B(10)
!HPF$   TEMPLATE T(100,100)
!HPF$   ALIGN B(J) WITH A(*,J)
!HPF$   ALIGN A(I,J) WITH T(3*I, 2*J)
!HPF$   PROCESSORS PR(5,5)
!HPF$   DISTRIBUTE T(CYCLIC(3), CYCLIC(3)) ONTO PR
!HPF$   CALL LOCAL_COMPUTE(A, B)
        ...
        ...
        ...
        EXTRINSIC(HPF_LOCAL) SUBROUTINE LOCAL_COMPUTE(X, Y)
        USE HPF_LOCAL_LIBRARY
        REAL X(:,:), Y(:)
        INTEGER NBY(1), NBX(2)
        NBX = LOCAL_BLKCNT(X)
        NBY = LOCAL_BLKCNT(Y)

the values returned on the physical processor corresponding to PR(2,4) in NBX is [4 3] and in NBY is [1].


next up previous contents
Next: LOCAL_LINDEX(ARRAYDIM, PROC) Up: HPF Local Routine Library Previous: LOCAL_BLKCNT(ARRAYDIM, PROC)