Rename threadprivate global tally variables and add a few comments

This commit is contained in:
Paul Romano 2015-07-02 20:27:09 +07:00
parent 2bdd579ba5
commit f698e9d31c
5 changed files with 29 additions and 22 deletions

View file

@ -175,20 +175,20 @@ contains
!$omp parallel
!$omp critical
global_tallies(K_TRACKLENGTH) % value = &
global_tallies(K_TRACKLENGTH) % value + tally_tracklength
global_tallies(K_TRACKLENGTH) % value + global_tally_tracklength
global_tallies(K_COLLISION) % value = &
global_tallies(K_COLLISION) % value + tally_collision
global_tallies(K_COLLISION) % value + global_tally_collision
global_tallies(LEAKAGE) % value = &
global_tallies(LEAKAGE) % value + tally_leakage
global_tallies(LEAKAGE) % value + global_tally_leakage
global_tallies(K_ABSORPTION) % value = &
global_tallies(K_ABSORPTION) % value + tally_absorption
global_tallies(K_ABSORPTION) % value + global_tally_absorption
!$omp end critical
! reset private tallies
tally_tracklength = 0
tally_collision = 0
tally_leakage = 0
tally_absorption = 0
global_tally_tracklength = 0
global_tally_collision = 0
global_tally_leakage = 0
global_tally_absorption = 0
!$omp end parallel
#ifdef _OPENMP

View file

@ -320,7 +320,7 @@ contains
! Score to global leakage tally
if (tallies_on) then
tally_leakage = tally_leakage + p % wgt
global_tally_leakage = global_tally_leakage + p % wgt
end if
! Display message

View file

@ -112,16 +112,23 @@ module global
! Global tallies
! 1) collision estimate of k-eff
! 2) track-length estimate of k-eff
! 3) leakage fraction
! 2) absorption estimate of k-eff
! 3) track-length estimate of k-eff
! 4) leakage fraction
type(TallyResult), allocatable, target :: global_tallies(:)
real(8) :: tally_tracklength = 0
real(8) :: tally_collision = 0
real(8) :: tally_leakage = 0
real(8) :: tally_absorption = 0
!$omp threadprivate(tally_tracklength, tally_collision, tally_leakage, &
!$omp& tally_absorption)
! It is possible to protect accumulate operations on global tallies by using
! an atomic update. However, when multiple threads accumulate to the same
! global tally, it can cause a higher cache miss rate due to
! invalidation. Thus, we use threadprivate variables to accumulate global
! tallies and then reduce at the end of a generation.
real(8) :: global_tally_collision = ZERO
real(8) :: global_tally_absorption = ZERO
real(8) :: global_tally_tracklength = ZERO
real(8) :: global_tally_leakage = ZERO
!$omp threadprivate(global_tally_collision, global_tally_absorption, &
!$omp& global_tally_tracklength, global_tally_leakage)
! Tally map structure
type(TallyMap), allocatable :: tally_maps(:)

View file

@ -254,7 +254,7 @@ contains
! Score implicit absorption estimate of keff
if (run_mode == MODE_EIGENVALUE) then
tally_absorption = tally_absorption + p % absorb_wgt * &
global_tally_absorption = global_tally_absorption + p % absorb_wgt * &
micro_xs(i_nuclide) % nu_fission / micro_xs(i_nuclide) % absorption
end if
else
@ -263,7 +263,7 @@ contains
prn() * micro_xs(i_nuclide) % total) then
! Score absorption estimate of keff
if (run_mode == MODE_EIGENVALUE) then
tally_absorption = tally_absorption + p % wgt * &
global_tally_absorption = global_tally_absorption + p % wgt * &
micro_xs(i_nuclide) % nu_fission / micro_xs(i_nuclide) % absorption
end if

View file

@ -112,8 +112,8 @@ contains
! Score track-length estimate of k-eff
if (run_mode == MODE_EIGENVALUE) then
tally_tracklength = tally_tracklength + p % wgt * distance * &
material_xs % nu_fission
global_tally_tracklength = global_tally_tracklength + p % wgt * &
distance * material_xs % nu_fission
end if
if (d_collision > d_boundary) then
@ -140,7 +140,7 @@ contains
! Score collision estimate of keff
if (run_mode == MODE_EIGENVALUE) then
tally_collision = tally_collision + p % wgt * &
global_tally_collision = global_tally_collision + p % wgt * &
material_xs % nu_fission / material_xs % total
end if