1. History of HPF:
Evolution: Fortran 77 Fortran 90 HPF
HPFF series of meetings during March 1992 – March 1993 lead to HPF version 1.0
2. Data parallelism: Exploitation of the concurrency that derives from the application of the
same operation to multiple elements of a data structure. Task: each operation on each element Granularity: small Locality: implicit
3. Required capabilities of data parallel language:
Express concurrency Express data distribution
4. Main features of HPF covered in this course:
Array assignment and array intrinsic functions (7.2)
Example:
Integer A(10,10), B(10,10), c A = B + c ……
A(1,1:7) = B(2,2:8) + 1.0 Example:
Before the execution of the following statement, X= [1.0, 20.0, 300.0, 4000.0, 50000.0], X(2:4) = X(1:3) + X(2:4) + X(3:5) What will X be after the execution?
Answer: X = [1.0, 321.0, 4320.0, 300.0, 50000.0]
Note that the execution is not the same as the execution of the following do loop: Do I = 2, 4
X(I) = X(I-1) + X(I) + X(I+1)
END DO
Constrains: all operant must be conformable. FORALL statement and construct (7.4.1)
FORALL statement:
FORALL (triplet, …, triplet, mask) assignment Example:
FORALL (I=1:m, j=1:n) X(I,j) = I+j FORALL (I=1:100) X(I,I) = 0.0 FORALL construct:
FORALL (triplet, …, triplet, mask) assignment \\
…… | forall-body
/
END FORALL Constrains:
1. Evaluate all elements in any order 2. Evaluate mask in any order
3. Evaluate the statements in the forall-body in the order they appear.
INDEPENDENT directive (7.4.2)
The guidance provides by the programmer to the compiler to assert that the iterations of a do-loop can be performed independently. It could be used in implementation of parallel tasks as shown in the example below. Example:
!HPF$ INDEPENDENT
Do I = 1, 4
CALL task (i) END DO ……
SUBROUTINE task(i) Integer I
IF (I.eq.1) THEN CALL action1 ELSEIF (I.eq.2) THEN CALL action2 ELSEIF (I.eq.3) THEN CALL action3 ELSE
CALL action4 ENDIF Return end
Data distribution directives (7.3)
Examples:
!HPF$ PROCESSORS prec(4)
!HPF$ ALIGN array( : ) WITH D( : , * )
!HPF$ DISTRIBUTE array(BLOCK) ONTO proc
Constrains:
Must specify all dimensions.
Distribution applies to all aligned arrays
Three ways of distribution could be mixed, but need to be conformable.
5. Reading assignment: Chapter 7.8
6. Discussion: Based on your understand of Gaussian elimination algorithm, how does the data
distribution affect the performance? What about using MPI for implementation?
因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- xiaozhentang.com 版权所有 湘ICP备2023022495号-4
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务