Skip to content

Commit

Permalink
Replace all instances of PeleC, PELEC by ERF and pelec by erf.
Browse files Browse the repository at this point in the history
This version builds with both gmake and cmake.
  • Loading branch information
asalmgren committed Oct 24, 2020
1 parent 183bac4 commit a1d5913
Show file tree
Hide file tree
Showing 123 changed files with 1,228 additions and 1,642 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml.DISABLED
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PeleC-CI
name: ERF-CI

on:
push:
Expand Down Expand Up @@ -70,10 +70,10 @@ jobs:
-DCMAKE_CXX_COMPILER:STRING=${{env.CXX_COMPILER}} \
-DCMAKE_C_COMPILER:STRING=${{env.C_COMPILER}} \
-DCMAKE_Fortran_COMPILER:STRING=${{env.FORTRAN_COMPILER}} \
-DPELEC_ENABLE_MPI:BOOL=ON \
-DPELEC_ENABLE_TESTS:BOOL=ON \
-DPELEC_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DPELEC_ENABLE_MASA:BOOL=ON \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_TESTS:BOOL=ON \
-DERF_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DERF_ENABLE_MASA:BOOL=ON \
-DMASA_DIR:STRING=${{runner.workspace}}/deps/install/MASA \
${GITHUB_WORKSPACE}
- name: make
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plt*
chk*
tmp_build_dir
.ccls-cache
PeleC*.ex
ERF*.ex
extern_parameters.H
extern_parameters.cpp
extern_parameters_F.H
16 changes: 8 additions & 8 deletions Build/cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ cmake -DCMAKE_INSTALL_PREFIX:PATH=./install \
-DCMAKE_Fortran_COMPILER:STRING=mpifort \
-DMPIEXEC_PREFLAGS:STRING=--oversubscribe \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DPELEC_DIM:STRING=3 \
-DPELEC_ENABLE_MPI:BOOL=ON \
-DPELEC_ENABLE_AMREX_EB:BOOL=ON \
-DPELEC_ENABLE_TESTS:BOOL=ON \
-DPELEC_ENABLE_MASA:BOOL=ON \
-DPELEC_ENABLE_FCOMPARE:BOOL=ON \
-DPELEC_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DERF_DIM:STRING=3 \
-DERF_ENABLE_MPI:BOOL=ON \
-DERF_ENABLE_AMREX_EB:BOOL=ON \
-DERF_ENABLE_TESTS:BOOL=ON \
-DERF_ENABLE_MASA:BOOL=ON \
-DERF_ENABLE_FCOMPARE:BOOL=ON \
-DERF_ENABLE_FCOMPARE_FOR_TESTS:BOOL=OFF \
-DMASA_DIR:STRING=$(spack location -i masa) \
-DPELEC_ENABLE_DOCUMENTATION:BOOL=OFF \
-DERF_ENABLE_DOCUMENTATION:BOOL=OFF \
-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON \
.. && make -j8
117 changes: 117 additions & 0 deletions CMake/BuildERFExe.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
function(build_erf_exe erf_exe_name)

set(SRC_DIR ${CMAKE_SOURCE_DIR}/SourceCpp)
set(BIN_DIR ${CMAKE_BINARY_DIR}/SourceCpp/${erf_exe_name})

include(${CMAKE_SOURCE_DIR}/CMake/SetERFCompileFlags.cmake)

add_subdirectory(${SRC_DIR}/Params ${BIN_DIR}/Params/${erf_exe_name})

set(ERF_EOS_DIR "${CMAKE_SOURCE_DIR}/SourceCpp/GammaLaw")
target_sources(${erf_exe_name} PRIVATE
${ERF_EOS_DIR}/EOS.H)
target_include_directories(${erf_exe_name} SYSTEM PRIVATE ${ERF_EOS_DIR})

if(ERF_ENABLE_MASA)
target_sources(${erf_exe_name} PRIVATE
${SRC_DIR}/MMS.cpp)
target_compile_definitions(${erf_exe_name} PRIVATE ERF_USE_MASA)
endif()

target_sources(${erf_exe_name}
PRIVATE
${SRC_DIR}/Advance.cpp
${SRC_DIR}/BCfill.cpp
${SRC_DIR}/Bld.cpp
${SRC_DIR}/Constants.H
${SRC_DIR}/Derive.H
${SRC_DIR}/Derive.cpp
${SRC_DIR}/Diffterm.H
${SRC_DIR}/Diffterm.cpp
${SRC_DIR}/Diffusion.H
${SRC_DIR}/Diffusion.cpp
${SRC_DIR}/External.cpp
${SRC_DIR}/Filter.H
${SRC_DIR}/Filter.cpp
${SRC_DIR}/Forcing.H
${SRC_DIR}/Forcing.cpp
${SRC_DIR}/GradUtil.H
${SRC_DIR}/Hydro.H
${SRC_DIR}/Hydro.cpp
${SRC_DIR}/IndexDefines.H
${SRC_DIR}/IndexDefines.cpp
${SRC_DIR}/IO.H
${SRC_DIR}/IO.cpp
${SRC_DIR}/LES.H
${SRC_DIR}/Transport.H
${SRC_DIR}/TransportParams.H
${SRC_DIR}/LES.cpp
${SRC_DIR}/MOL.H
${SRC_DIR}/MOL.cpp
${SRC_DIR}/ERF.H
${SRC_DIR}/ERF.cpp
${SRC_DIR}/Problem.H
${SRC_DIR}/ProblemDerive.H
${SRC_DIR}/Riemann.H
${SRC_DIR}/Setup.cpp
${SRC_DIR}/Sources.cpp
${SRC_DIR}/SumIQ.cpp
${SRC_DIR}/SumUtils.cpp
${SRC_DIR}/Tagging.H
${SRC_DIR}/Tagging.cpp
${SRC_DIR}/Timestep.H
${SRC_DIR}/Timestep.cpp
${SRC_DIR}/Utilities.H
${SRC_DIR}/Utilities.cpp
${SRC_DIR}/Transport.cpp
${SRC_DIR}/TransportParams.cpp
)

if(NOT "${erf_exe_name}" STREQUAL "erf_unit_tests")
target_sources(${erf_exe_name}
PRIVATE
${SRC_DIR}/main.cpp
)
endif()

include(AMReXBuildInfo)
generate_buildinfo(${erf_exe_name} ${CMAKE_SOURCE_DIR})
target_include_directories(${erf_exe_name} PUBLIC ${AMREX_SUBMOD_LOCATION}/Tools/C_scripts)

if(ERF_ENABLE_MASA)
if(MASA_FOUND)
#Link our executable to the MASA libraries, etc
target_link_libraries(${erf_exe_name} PRIVATE ${MASA_LIBRARY})
target_compile_definitions(${erf_exe_name} PRIVATE USE_MASA DO_PROBLEM_POST_TIMESTEP DO_PROBLEM_POST_INIT)
target_include_directories(${erf_exe_name} SYSTEM PRIVATE ${MASA_INCLUDE_DIRS})
target_include_directories(${erf_exe_name} SYSTEM PRIVATE ${MASA_MOD_DIRS})
endif()
endif()

if(ERF_ENABLE_MPI)
target_link_libraries(${erf_exe_name} PUBLIC $<$<BOOL:${MPI_CXX_FOUND}>:MPI::MPI_CXX>)
endif()

#ERF include directories
target_include_directories(${erf_exe_name} PRIVATE ${SRC_DIR})
target_include_directories(${erf_exe_name} PRIVATE ${CMAKE_BINARY_DIR})

#Link to amrex library
target_link_libraries(${erf_exe_name} PRIVATE amrex)

if(ERF_ENABLE_CUDA)
set(pctargets "${erf_exe_name}")
foreach(tgt IN LISTS pctargets)
get_target_property(ERF_SOURCES ${tgt} SOURCES)
list(FILTER ERF_SOURCES INCLUDE REGEX "\\.cpp")
set_source_files_properties(${ERF_SOURCES} PROPERTIES LANGUAGE CUDA)
endforeach()
endif()

#Define what we want to be installed during a make install
install(TARGETS ${erf_exe_name}
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib)

endfunction()
117 changes: 0 additions & 117 deletions CMake/BuildPeleCExe.cmake

This file was deleted.

12 changes: 6 additions & 6 deletions CMake/SetAmrexOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#Set amrex options
set(USE_XSDK_DEFAULTS OFF)
set(DIM "${PELEC_DIM}" CACHE STRING "Number of physical dimensions" FORCE)
set(DIM "${ERF_DIM}" CACHE STRING "Number of physical dimensions" FORCE)
set(ENABLE_PIC OFF)
set(ENABLE_MPI ${PELEC_ENABLE_MPI})
set(ENABLE_OMP ${PELEC_ENABLE_OPENMP})
set(ENABLE_MPI ${ERF_ENABLE_MPI})
set(ENABLE_OMP ${ERF_ENABLE_OPENMP})
set(ENABLE_DP ON)
set(ENABLE_EB ${PELEC_ENABLE_AMREX_EB})
set(ENABLE_EB ${ERF_ENABLE_AMREX_EB})
set(ENABLE_FORTRAN_INTERFACES OFF)
set(ENABLE_LINEAR_SOLVERS OFF)
set(ENABLE_AMRDATA OFF)
Expand All @@ -22,7 +22,7 @@ set(ENABLE_MEM_PROFILE OFF)
set(ENABLE_COMM_PROFILE OFF)
set(ENABLE_BACKTRACE OFF)
set(ENABLE_PROFPARSER OFF)
set(ENABLE_CUDA ${PELEC_ENABLE_CUDA})
set(ENABLE_CUDA ${ERF_ENABLE_CUDA})
set(ENABLE_ACC OFF)
set(ENABLE_PLOTFILE_TOOLS ${PELEC_ENABLE_FCOMPARE})
set(ENABLE_PLOTFILE_TOOLS ${ERF_ENABLE_FCOMPARE})
#set(ENABLE_FORTRAN OFF)
38 changes: 38 additions & 0 deletions CMake/SetERFCompileFlags.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Logic for handling warnings
if(ERF_ENABLE_ALL_WARNINGS)
# GCC, Clang, and Intel seem to accept these
list(APPEND ERF_CXX_FLAGS "-Wall" "-Wextra" "-pedantic")
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# ifort doesn't like -Wall
list(APPEND ERF_Fortran_FLAGS "-Wall")
else()
# Intel always reports some diagnostics we don't necessarily care about
list(APPEND ERF_CXX_FLAGS "-diag-disable:11074,11076")
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0)
# Avoid notes about -faligned-new with GCC > 7
list(APPEND ERF_CXX_FLAGS "-faligned-new")
endif()
endif()

# Add our extra flags according to language
separate_arguments(ERF_CXX_FLAGS)
target_compile_options(${erf_exe_name} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${ERF_CXX_FLAGS}>)

if(ERF_ENABLE_CUDA)
list(APPEND ERF_CUDA_FLAGS "--expt-relaxed-constexpr")
list(APPEND ERF_CUDA_FLAGS "--expt-extended-lambda")
list(APPEND ERF_CUDA_FLAGS "--Wno-deprecated-gpu-targets")
list(APPEND ERF_CUDA_FLAGS "-m64")
if(ENABLE_CUDA_FASTMATH)
list(APPEND ERF_CUDA_FLAGS "--use_fast_math")
endif()
separate_arguments(ERF_CUDA_FLAGS)
target_compile_options(${erf_exe_name} PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:${ERF_CUDA_FLAGS}>)
# Add arch flags to both compile and linker to avoid warnings about missing arch
set(CMAKE_CUDA_FLAGS ${NVCC_ARCH_FLAGS})
set_target_properties(
${erf_exe_name} PROPERTIES
CUDA_SEPARABLE_COMPILATION ON
CUDA_RESOLVE_DEVICE_SYMBOLS OFF)
endif()
38 changes: 0 additions & 38 deletions CMake/SetPeleCCompileFlags.cmake

This file was deleted.

Loading

0 comments on commit a1d5913

Please sign in to comment.