- #1
Hemmer
- 16
- 0
Hi there,
I've been puzzling over the following code (which works in serial). It produces radically different answers if the (blank) WRITE(*,*) is included or not. Any help greatly appreciated!
I've been puzzling over the following code (which works in serial). It produces radically different answers if the (blank) WRITE(*,*) is included or not. Any help greatly appreciated!
Code:
eps = 0.0
!$omp parallel do default(none) private(i, j, current_angle, current_energy) &
!$omp shared(a, N, J_0, eps)
do j = 1, N
do i = 1, N
! find energy
current_angle = a(i,j)
call get_neighbouring_contrib(a, current_angle, i, j, current_energy, J_0, N)
[B]!if i have this (or any) WRITE statement, program gets answer correct
!otherwise get garbage results which vary each time[/B]
write(*,*)
! and sum
!$omp atomic
eps = eps + current_energy
end do
end do
!$omp end parallel do