mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Merge pull request #4878 from nbehrnd/patch-3
[fortran/en] account for non-functional typo
This commit is contained in:
commit
191098e323
@ -436,6 +436,36 @@ contains
|
|||||||
|
|
||||||
end module fruity
|
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
|
### More Resources
|
||||||
|
Loading…
Reference in New Issue
Block a user