summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBoris Verkhovskiy <boris.verk@gmail.com>2024-04-04 09:19:24 -0700
committerGitHub <noreply@github.com>2024-04-04 09:19:24 -0700
commit191098e32397aab27f7ff87fde1a2d94a1d025c2 (patch)
tree453d8dd5d88fd9fd753ff0c838bf0127f1e2955a
parent4d6309b2bde3c927691b15d049ef7a31c678e1f1 (diff)
parent4c3a442457ca30c02b4593f681b4d9cd5ee63ee1 (diff)
Merge pull request #4878 from nbehrnd/patch-3mribeirodantas-patch-1
[fortran/en] account for non-functional typo
-rw-r--r--fortran90.html.markdown30
1 files changed, 30 insertions, 0 deletions
diff --git a/fortran90.html.markdown b/fortran90.html.markdown
index 2f2cfdfd..3730f8b0 100644
--- a/fortran90.html.markdown
+++ b/fortran90.html.markdown
@@ -436,6 +436,36 @@ contains
end module fruity
+
+! ISO Standard Fortran 2008 introduced the DO CONCURRENT construct to allow you
+! to express loop-level parallelism
+
+integer :: i
+real :: array(100)
+
+DO CONCURRENT (i = 1:size(array))
+ array(i) = sqrt(i**i)
+END DO
+
+
+! Only calls to pure functions are allowed inside the loop and we can declare
+! multiple indices:
+
+integer :: x, y
+real :: array(8, 16)
+
+do concurrent (x = 1:size(array, 1), y = 1:size(array, 2))
+ array(x, y) = real(x)
+end do
+
+! loop indices can also declared inside the contruct:
+
+real :: array(8, 16)
+
+do concurrent (integer :: x = 1:size(array, 1), y = 1:size(array, 2))
+ array(x, y) = real(x)
+end do
+
```
### More Resources