开发者

Understanding parallel usage of Fortran 90

开发者 https://www.devze.com 2023-03-26 20:36 出处:网络
y(1:n-1) = a*y(2:n) + x(1:n-1) y(n) = c In the above Fortran 90 code开发者_如何学编程 I want to know how it is executed in term of synchronization, communication and arithmetic.
y(1:n-1) = a*y(2:n) + x(1:n-1)
y(n) = c

In the above Fortran 90 code开发者_如何学编程 I want to know how it is executed in term of synchronization, communication and arithmetic.

What I understand is:

Communication is the need for different task to communication with each other. E.g. if there's some variable that have dependencies with some other variable. But the above code doesn't show that there is some communication. As it seems to be no dependencies, am I right?

Synchronization is somewhat related to communication, but it also involves if there has been some use of barriers. But in the above code there is no barrier. Therefore the only synchronization that is involved is if there are any data dependencies.

Arithmetic I have no clue regarding this point, and would be gladly if someone could explain it to me.


The rule in Fortran is fairly simple: the right hand side is completely evaluated before the result is assigned to the left. Thus you could claim there is a communication upon assigning (sending the result to y), which is at the same time a synchronization point. The actual evaluation of the right side could be vectorized/parallelized by the compiler, resulting in arbitrary orders of the evaluations for all entries in the array, except for the last one, which is only set after the first assignment. However, except for pipelining, there is no real parallelism introduced here by common compilers.


Without stopping too much at the given snippet, it looks you could perhaps be interested (tell me if I'm wrong) at for example, Using OpenMP book (presentation here). It is a nice gentle introduction to the world of parallel computing (memory shared). For larger systems you would do well to google "MPI" and its related subjects. There is really a plethora of material on the matter (a lot of them deal with fortran+mpi / fortran+openmp) so I'll skip giving examples here.

Is this what you were aiming for?

0

精彩评论

暂无评论...
验证码 换一张
取 消