mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
added IPO/LTO to cmake build commands, to be included when optimization is enabled.
This commit is contained in:
parent
539c68cee8
commit
494dc0382a
3 changed files with 32 additions and 2 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
<!-- Define how many particles to run and for how many batches -->
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<batches>20</batches>
|
||||
<batches>100</batches>
|
||||
<inactive>10</inactive>
|
||||
<particles>1000</particles>
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue