diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95b334ce46..33911ac61b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -69,6 +69,16 @@ if(HDF5_IS_PARALLEL)
message(STATUS "Using parallel HDF5")
endif()
+#===============================================================================
+# Enable interprocedural (link time) optimization if requested and supported
+#===============================================================================
+
+if (NOT (CMAKE_VERSION VERSION_LESS 3.9))
+ cmake_policy(SET CMP0069 NEW)
+ include(CheckIPOSupported)
+ check_ipo_supported(RESULT ipo_support_detected)
+endif()
+
#===============================================================================
# Set compile/link flags based on which compiler is being used
#===============================================================================
@@ -110,6 +120,7 @@ message(STATUS "OpenMC Linker flags: ${ldflags}")
endif()
+
#===============================================================================
# Update git submodules as needed
#===============================================================================
@@ -205,6 +216,7 @@ target_include_directories(faddeeva
)
target_compile_options(faddeeva PRIVATE ${cxxflags})
+
#===============================================================================
# libopenmc
#===============================================================================
@@ -313,6 +325,14 @@ endif()
set_target_properties(libopenmc PROPERTIES
OUTPUT_NAME openmc)
+
+# Enable interprocedural (link time) optimization if requested and supported
+if(optimize)
+ if(ipo_support_detected)
+ set_property(TARGET libopenmc PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
+ message(STATUS "LTO enabled for libopenmc")
+ endif()
+endif()
target_include_directories(libopenmc
PUBLIC
@@ -365,6 +385,14 @@ add_executable(openmc src/main.cpp)
target_compile_options(openmc PRIVATE ${cxxflags})
target_link_libraries(openmc libopenmc)
+# Enable interprocedural (link time) optimization if requested and supported
+if(optimize)
+ if(ipo_support_detected)
+ set_property(TARGET openmc PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
+ message(STATUS "LTO enabled for openmc executable")
+ endif()
+endif()
+
# Ensure C++14 standard is used. Starting with CMake 3.8, another way this could
# be done is using the cxx_std_14 compiler feature.
set_target_properties(
diff --git a/examples/xml/pincell/settings.xml b/examples/xml/pincell/settings.xml
index 741427460c..5845898c8d 100644
--- a/examples/xml/pincell/settings.xml
+++ b/examples/xml/pincell/settings.xml
@@ -3,7 +3,7 @@
eigenvalue
- 20
+ 100
10
1000
diff --git a/src/event.cpp b/src/event.cpp
index a40f67152c..4079d7790d 100644
--- a/src/event.cpp
+++ b/src/event.cpp
@@ -97,7 +97,9 @@ void process_calculate_xs_events(QueueItem* queue, int64_t n)
{
simulation::time_event_calculate_xs.start();
- // TODO: Sort queue by particle type, material type, and energy
+ // TODO: If using C++17, perform a parallel sort of the queue
+ // by particle type, material type, and then energy, in order to
+ // improve cache locality and reduce thread divergence on GPU.
//std::sort(queue, queue+n);
// Save last_ members, find grid index