mirror of
https://github.com/OpenMP/Examples.git
synced 2025-04-10 08:22:11 +01:00
22 lines
539 B
Fortran
22 lines
539 B
Fortran
! @@name: atomic.4
|
|
! @@type: F-free
|
|
! @@operation: compile
|
|
! @@expect: success
|
|
! @@version: omp_5.0
|
|
subroutine boxster(box_totals, vals, box, N)
|
|
use omp_lib
|
|
external calc_val
|
|
real, intent(inout) :: box_totals(:)
|
|
real, intent(in) :: vals(:)
|
|
integer, intent(in) :: box(:)
|
|
integer :: N, idx
|
|
|
|
!$omp parallel do
|
|
do idx=1,N
|
|
call calc_val(vals(idx))
|
|
!$omp atomic hint(omp_sync_hint_uncontended)
|
|
box_totals( box(idx) ) = box_totals( box(idx) ) + vals(idx)
|
|
enddo
|
|
|
|
end subroutine
|