Skip to content

Commit

Permalink
[fortran/en] do concurrent (#4531)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ily83 authored May 15, 2024
1 parent d6244e0 commit 7dce022
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions fortran.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,35 @@ contains
end function complex_abs
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
Expand Down

0 comments on commit 7dce022

Please sign in to comment.