From 8c78bb13d93806ee78508b55aae79b2cfa05f1dc Mon Sep 17 00:00:00 2001 From: Ily <90933947+Ily83@users.noreply.github.com> Date: Fri, 4 Nov 2022 01:16:03 +0100 Subject: [PATCH 1/3] Update fortran90.html.markdown added DO CONCURRENT --- fortran90.html.markdown | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/fortran90.html.markdown b/fortran90.html.markdown index 2f2cfdfd..8ba0de5b 100644 --- a/fortran90.html.markdown +++ b/fortran90.html.markdown @@ -436,6 +436,34 @@ 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 From 1f71450a4c8f222bf646ed326359881807626d4b Mon Sep 17 00:00:00 2001 From: Ily <90933947+Ily83@users.noreply.github.com> Date: Fri, 4 Nov 2022 23:31:59 +0100 Subject: [PATCH 2/3] Update fortran90.html.markdown Requested change done --- fortran90.html.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fortran90.html.markdown b/fortran90.html.markdown index 8ba0de5b..434f1c02 100644 --- a/fortran90.html.markdown +++ b/fortran90.html.markdown @@ -437,7 +437,8 @@ contains end module fruity -! ISO Standard Fortran 2008 introduced the DO CONCURRENT construct to allow you to express loop-level parallelism +! ISO Standard Fortran 2008 introduced the DO CONCURRENT construct to allow you +! to express loop-level parallelis integer :: i real :: array(100) @@ -447,7 +448,8 @@ DO CONCURRENT (i = 1:size(array)) END DO -! Only calls to pure functions are allowed inside the loop and we can declare multiple indices: +! Only calls to pure functions are allowed inside the loop and we can declare +! multiple indices: integer :: x, y real :: array(8, 16) From 4c3a442457ca30c02b4593f681b4d9cd5ee63ee1 Mon Sep 17 00:00:00 2001 From: nbehrnd Date: Thu, 4 Apr 2024 17:36:04 +0200 Subject: [PATCH 3/3] correct typo --- fortran90.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fortran90.html.markdown b/fortran90.html.markdown index 434f1c02..3730f8b0 100644 --- a/fortran90.html.markdown +++ b/fortran90.html.markdown @@ -438,7 +438,7 @@ end module fruity ! ISO Standard Fortran 2008 introduced the DO CONCURRENT construct to allow you -! to express loop-level parallelis +! to express loop-level parallelism integer :: i real :: array(100)