Skip to content

Commit

Permalink
Update CMake for Soot, Spray, and Radiation (AMReX-Combustion#331)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrood-nrel authored Jan 9, 2024
1 parent 45c8ab1 commit 33320fc
Show file tree
Hide file tree
Showing 102 changed files with 875 additions and 839 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Checks: 'bugprone-*,
-readability-static-accessed-through-instance,
-readability-identifier-length,
-readability-function-cognitive-complexity,
-readability-convert-member-functions-to-static,
-readability-make-member-function-const,
-readability-function-size'
WarningsAsErrors: ''
HeaderFilterRegex: 'PeleLMeX\/Source|PeleLMeX\/Exec|PeleLMeX\/Submodules\/PelePhysics\/Source|PeleLMeX\/Submodules\/PelePhysics\/Mechanism'
Expand Down
42 changes: 19 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,10 @@ jobs:
-DCMAKE_INSTALL_PREFIX:PATH=${{runner.workspace}}/install-${DIM}d-${{matrix.os}}-${{matrix.build_type}}-${{matrix.enable_eb}} \
-DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DPELELMEX_DIM:STRING=${DIM} \
-DPELELMEX_ENABLE_MPI:BOOL=ON \
-DPELELMEX_ENABLE_EB:BOOL=${{matrix.use_eb}} \
-DPELELMEX_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELELMEX_ENABLE_MASA:BOOL=OFF \
-DPELE_DIM:STRING=${DIM} \
-DPELE_ENABLE_MPI:BOOL=ON \
-DPELE_ENABLE_EB:BOOL=${{matrix.use_eb}} \
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}; \
if [ $? -ne 0 ]; then exit 1; fi \
Expand Down Expand Up @@ -254,8 +253,8 @@ jobs:
cmake -Bbuild-${{matrix.cuda_pkg}} \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DPELELMEX_ENABLE_MPI:BOOL=OFF \
-DPELELMEX_ENABLE_CUDA:BOOL=ON \
-DPELE_ENABLE_MPI:BOOL=OFF \
-DPELE_ENABLE_CUDA:BOOL=ON \
-DAMReX_CUDA_ERROR_CAPTURE_THIS:BOOL=ON \
-DCMAKE_CUDA_ARCHITECTURES:STRING=70 \
-DCMAKE_CUDA_COMPILER_LAUNCHER:STRING=ccache \
Expand Down Expand Up @@ -319,14 +318,14 @@ jobs:
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_CXX_COMPILER:STRING=$(which clang++) \
-DCMAKE_C_COMPILER:STRING=$(which clang) \
-DPELELMEX_ENABLE_MPI:BOOL=OFF \
-DPELELMEX_ENABLE_HIP:BOOL=ON \
-DPELE_ENABLE_MPI:BOOL=OFF \
-DPELE_ENABLE_HIP:BOOL=ON \
-DAMReX_AMD_ARCH:STRING=gfx90a \
-DCMAKE_HIP_ARCHITECTURES:STRING=gfx90a \
-DAMDGPU_TARGETS:STRING=gfx90a \
-DGPU_TARGETS:STRING=gfx90a \
-DAMReX_GPU_RDC:BOOL=OFF \
-DPELELMEX_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}
- name: Build
Expand Down Expand Up @@ -388,10 +387,9 @@ jobs:
-DCMAKE_CXX_COMPILER:STRING=$(which icpx) \
-DCMAKE_C_COMPILER:STRING=$(which icx) \
-DCMAKE_CXX_FLAGS:STRING=-fsycl \
-DPELELMEX_ENABLE_MPI:BOOL=OFF \
-DPELELMEX_ENABLE_MASA:BOOL=OFF \
-DPELELMEX_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELELMEX_ENABLE_SYCL:BOOL=ON \
-DPELE_ENABLE_MPI:BOOL=OFF \
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELE_ENABLE_SYCL:BOOL=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}
- name: Build
Expand Down Expand Up @@ -447,11 +445,10 @@ jobs:
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_CXX_COMPILER:STRING=clang++ \
-DCMAKE_C_COMPILER:STRING=clang \
-DPELELMEX_ENABLE_EB:BOOL=${{matrix.use_eb}} \
-DPELELMEX_ENABLE_MPI:BOOL=OFF \
-DPELELMEX_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELELMEX_ENABLE_MASA:BOOL=OFF \
-DPELELMEX_ENABLE_CLANG_TIDY:BOOL=ON \
-DPELE_ENABLE_EB:BOOL=${{matrix.use_eb}} \
-DPELE_ENABLE_MPI:BOOL=OFF \
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELE_ENABLE_CLANG_TIDY:BOOL=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=ccache \
${{github.workspace}}
- name: Check
Expand Down Expand Up @@ -499,10 +496,9 @@ jobs:
-DCMAKE_BUILD_TYPE:STRING=Debug \
-DCMAKE_CXX_COMPILER:STRING=clang++ \
-DCMAKE_C_COMPILER:STRING=clang \
-DPELELMEX_ENABLE_MPI:BOOL=OFF \
-DPELELMEX_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELELMEX_ENABLE_MASA:BOOL=OFF \
-DPELELMEX_ENABLE_CLANG_TIDY:BOOL=OFF \
-DPELE_ENABLE_MPI:BOOL=OFF \
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELE_ENABLE_CLANG_TIDY:BOOL=OFF \
${{github.workspace}}
- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
# env:
# AMREX_HOME: ${GITHUB_WORKSPACE}/build/amrex
# PELE_PHYSICS_HOME: ${GITHUB_WORKSPACE}/build/PelePhysics
# PELELMEX_HOME: ${GITHUB_WORKSPACE}
# PELE_HOME: ${GITHUB_WORKSPACE}
# AMREX_HYDRO_HOME: ${GITHUB_WORKSPACE}/build/AMReX-Hydro
# SUNDIALS_HOME : ${GITHUB_WORKSPACE}/build/sundials
# working-directory: ./Exec/RegTests/EB_FlowPastCylinder/
Expand Down
18 changes: 9 additions & 9 deletions Build/cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ cmake -DCMAKE_INSTALL_PREFIX:PATH=./install \
-DCMAKE_C_COMPILER:STRING=clang \
-DMPIEXEC_PREFLAGS:STRING=--oversubscribe \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DPELELMEX_DIM:STRING=3 \
-DPELELMEX_ENABLE_MPI:BOOL=OFF \
-DPELELMEX_ENABLE_FCOMPARE:BOOL=OFF \
-DPELELMEX_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELELMEX_ENABLE_MASA:BOOL=OFF \
-DPELELMEX_ENABLE_CPPCHECK:BOOL=OFF \
-DPELELMEX_ENABLE_CLANG_TIDY:BOOL=OFF \
-DPELELMEX_ENABLE_CUDA:BOOL=OFF \
-DPELE_DIM:STRING=3 \
-DPELE_ENABLE_MPI:BOOL=OFF \
-DPELE_ENABLE_FCOMPARE:BOOL=OFF \
-DPELE_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELE_ENABLE_MASA:BOOL=OFF \
-DPELE_ENABLE_CPPCHECK:BOOL=OFF \
-DPELE_ENABLE_CLANG_TIDY:BOOL=OFF \
-DPELE_ENABLE_CUDA:BOOL=OFF \
-DAMReX_CUDA_ARCH=Volta \
-DPYTHON_EXECUTABLE=$(which python3) \
-DPELELMEX_PRECISION:STRING=DOUBLE \
-DPELE_PRECISION:STRING=DOUBLE \
..
#make
cmake --build . --parallel $(sysctl -n hw.ncpu) #&> output.txt
Expand Down
12 changes: 6 additions & 6 deletions CMake/BuildExeAndLib.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
get_filename_component(DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
set(pelelmex_lib_name PelePhysics-Lib-${PELELMEX_EOS_MODEL}-${PELELMEX_CHEMISTRY_MODEL}-${PELELMEX_TRANSPORT_MODEL})
set(pelelmex_exe_name ${PROJECT_NAME}-${DIR_NAME})
include(BuildPeleLMeXLib)
include(BuildPeleLMeXExe)
build_pelelmex_lib(${pelelmex_lib_name})
build_pelelmex_exe(${pelelmex_exe_name} ${pelelmex_lib_name})
set(pele_physics_lib_name "PelePhysicsLib-${PELE_PHYSICS_EOS_MODEL}-${PELE_PHYSICS_CHEMISTRY_MODEL}-${PELE_PHYSICS_TRANSPORT_MODEL}-Spray${PELE_PHYSICS_ENABLE_SPRAY}-Soot${PELE_PHYSICS_ENABLE_SOOT}-Radiation${PELE_PHYSICS_ENABLE_RADIATION}")
set(pele_exe_name "${PROJECT_NAME}-${DIR_NAME}")
include(BuildPelePhysicsLib)
include(BuildPeleExe)
build_pele_physics_lib(${pele_physics_lib_name})
build_pele_exe(${pele_exe_name} ${pele_physics_lib_name})
112 changes: 112 additions & 0 deletions CMake/BuildPeleExe.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
function(build_pele_exe pele_exe_name pele_physics_lib_name)

set(SRC_DIR ${CMAKE_SOURCE_DIR}/Source)

add_executable(${pele_exe_name} "")

if(CLANG_TIDY_EXE)
set_target_properties(${pele_exe_name} PROPERTIES CXX_CLANG_TIDY
"${CLANG_TIDY_EXE};--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy")
endif()

target_sources(${pele_exe_name}
PRIVATE
pelelmex_prob_parm.H
pelelmex_prob.H
pelelmex_prob.cpp
)

target_include_directories(${pele_exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
target_include_directories(${pele_exe_name} PRIVATE ${SRC_DIR})
target_include_directories(${pele_exe_name} PRIVATE ${CMAKE_BINARY_DIR})

target_sources(${pele_exe_name}
PRIVATE
${SRC_DIR}/PeleLMeX_DeriveUserDefined.cpp
${SRC_DIR}/PeleLMeX_DiffusionOp.H
${SRC_DIR}/PeleLMeX_DiffusionOp.cpp
${SRC_DIR}/PeleLMeX_EBUserDefined.H
${SRC_DIR}/PeleLMeX_FlowControllerData.H
${SRC_DIR}/PeleLMeX.H
${SRC_DIR}/PeleLMeX.cpp
${SRC_DIR}/PeleLMeX_Advance.cpp
${SRC_DIR}/PeleLMeX_Advection.cpp
${SRC_DIR}/PeleLMeX_BC.cpp
${SRC_DIR}/PeleLMeX_BCfill.H
${SRC_DIR}/PeleLMeX_Data.cpp
${SRC_DIR}/PeleLMeX_Derive.H
${SRC_DIR}/PeleLMeX_Derive.cpp
${SRC_DIR}/PeleLMeX_DeriveFunc.H
${SRC_DIR}/PeleLMeX_DeriveFunc.cpp
${SRC_DIR}/PeleLMeX_Diagnostics.cpp
${SRC_DIR}/PeleLMeX_Diffusion.cpp
${SRC_DIR}/PeleLMeX_EB.cpp
${SRC_DIR}/PeleLMeX_Eos.cpp
${SRC_DIR}/PeleLMeX_Evaluate.cpp
${SRC_DIR}/PeleLMeX_Evolve.cpp
${SRC_DIR}/PeleLMeX_FlowController.cpp
${SRC_DIR}/PeleLMeX_Forces.cpp
${SRC_DIR}/PeleLMeX_Init.cpp
${SRC_DIR}/PeleLMeX_Plot.cpp
${SRC_DIR}/PeleLMeX_Projection.cpp
${SRC_DIR}/PeleLMeX_Reactions.cpp
${SRC_DIR}/PeleLMeX_Regrid.cpp
${SRC_DIR}/PeleLMeX_Setup.cpp
${SRC_DIR}/PeleLMeX_Tagging.cpp
${SRC_DIR}/PeleLMeX_Temporals.cpp
${SRC_DIR}/PeleLMeX_Timestep.cpp
${SRC_DIR}/PeleLMeX_TransportProp.cpp
${SRC_DIR}/PeleLMeX_UMac.cpp
${SRC_DIR}/PeleLMeX_UserKeys.H
${SRC_DIR}/PeleLMeX_Utils.H
${SRC_DIR}/PeleLMeX_Utils.cpp
${SRC_DIR}/PeleLMeX_Index.H
${SRC_DIR}/PeleLMeX_K.H
${SRC_DIR}/main.cpp
)

if(PELE_PHYSICS_ENABLE_SOOT)
target_sources(${pele_exe_name}
PRIVATE
${SRC_DIR}/PeleLMeX_Soot.cpp)
endif()

if(PELE_PHYSICS_ENABLE_SPRAY)
target_sources(${pele_exe_name}
PRIVATE
${SRC_DIR}/PeleLMeX_SprayParticles.cpp
SprayParticlesInitInsert.cpp)
endif()

if(PELE_PHYSICS_ENABLE_RADIATION)
target_sources(${pele_exe_name}
PRIVATE
${SRC_DIR}/PeleLMeX_Radiation.cpp)
endif()

if(NOT "${pele_exe_name}" STREQUAL "${PROJECT_NAME}-UnitTests")
target_sources(${pele_exe_name}
PRIVATE
${CMAKE_SOURCE_DIR}/Source/main.cpp
)
endif()

if(PELE_ENABLE_CUDA)
set(pctargets "${pele_exe_name};${pele_physics_lib_name}")
foreach(tgt IN LISTS pctargets)
get_target_property(PELE_SOURCES ${tgt} SOURCES)
list(FILTER PELE_SOURCES INCLUDE REGEX "\\.cpp")
set_source_files_properties(${PELE_SOURCES} PROPERTIES LANGUAGE CUDA)
endforeach()
set_target_properties(${pele_exe_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON)
target_compile_options(${pele_exe_name} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-Xptxas --disable-optimizer-constants>)
endif()

target_link_libraries(${pele_exe_name} PRIVATE ${pele_physics_lib_name} AMReX-Hydro::amrex_hydro_api AMReX::amrex)

install(TARGETS ${pele_exe_name}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)

endfunction()
Loading

0 comments on commit 33320fc

Please sign in to comment.