Remove declaration of global_tally_* values on Fortran side

No more OpenMP in Fortran code!
This commit is contained in:
Paul Romano 2019-02-19 23:09:10 -06:00
parent 4f0c217c18
commit 1542cf7bfd
3 changed files with 11 additions and 20 deletions

View file

@ -90,9 +90,8 @@ if(openmp)
# Requires CMake 3.1+
find_package(OpenMP)
if(OPENMP_FOUND)
list(APPEND f90flags ${OpenMP_Fortran_FLAGS})
list(APPEND cxxflags ${OpenMP_CXX_FLAGS})
list(APPEND ldflags ${OpenMP_Fortran_FLAGS})
list(APPEND ldflags ${OpenMP_CXX_FLAGS})
endif()
endif()
@ -422,7 +421,7 @@ add_library(libopenmc SHARED
set_target_properties(libopenmc PROPERTIES
OUTPUT_NAME openmc
LINKER_LANGUAGE Fortran)
LINKER_LANGUAGE CXX)
target_include_directories(libopenmc
PUBLIC include

View file

@ -114,11 +114,15 @@ extern std::vector<int> active_surface_tallies;
} // namespace model
// Threadprivate variables
extern "C" double global_tally_absorption;
extern "C" double global_tally_collision;
extern "C" double global_tally_tracklength;
extern "C" double global_tally_leakage;
// 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.
extern double global_tally_absorption;
extern double global_tally_collision;
extern double global_tally_tracklength;
extern double global_tally_leakage;
#pragma omp threadprivate(global_tally_absorption, global_tally_collision, \
global_tally_tracklength, global_tally_leakage)

View file

@ -155,18 +155,6 @@ module tally_header
real(C_DOUBLE), public, allocatable, target :: global_tallies(:,:)
! 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(C_DOUBLE), public, bind(C) :: global_tally_collision
real(C_DOUBLE), public, bind(C) :: global_tally_absorption
real(C_DOUBLE), public, bind(C) :: global_tally_tracklength
real(C_DOUBLE), public, bind(C) :: global_tally_leakage
!$omp threadprivate(global_tally_collision, global_tally_absorption, &
!$omp& global_tally_tracklength, global_tally_leakage)
! Normalization for statistics
integer(C_INT32_T), public, bind(C) :: n_realizations = 0 ! # of independent realizations
real(C_DOUBLE), public, bind(C) :: total_weight ! total starting particle weight in realization