Quantcast
Viewing latest article 5
Browse Latest Browse All 33

Advantage DO CONCURRENT against DO

Maybe this is a dumb question:

What advantage has a DO CONCURRENT loop compared to a normal DO loop? I understand that in DO CONCURRENT you are not allowed to use an index (i-1), but basically every DO CONCURRENT can be written as a normal DO loop (but not the other way round).

In the documentation the following sample code is shown

   DO CONCURRENT (I = 1:N)
      Q = B(I) + C(I)
      D(I) = Q + SIN(Q) + 2
   END DO

which can be written as

   DO I = 1,N
      Q = B(I) + C(I)
      D(I) = Q + SIN(Q) + 2
   END DO

Is the DO CONCURRENT construct faster or what is the advantage?

Another question: I remember that for parallel reasons it would be more effective to declare Q(N) too, so the DO loop can access Q(I) instead of just Q. Is that right?

Markus


Viewing latest article 5
Browse Latest Browse All 33

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>