Skip to content

Commit

Permalink
Logger (FireDynamics#74)
Browse files Browse the repository at this point in the history
added a logger an improved general code quality. closing FireDynamics#74
  • Loading branch information
n16h7hunt3r authored Sep 8, 2020
1 parent 0e5c44b commit ed02b50
Show file tree
Hide file tree
Showing 118 changed files with 2,680 additions and 1,843 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
- uses: actions/checkout@v2
- name: compile
run: |
git submodule update --init
./compile.sh --docker-build
docker run -i --rm -v $(pwd):/host_pwd -w /host_pwd artss_docker ./compile.sh -m --jobs 4
Expand All @@ -46,6 +47,7 @@ jobs:
- uses: actions/checkout@v2
- name: compile
run: |
git submodule update --init
./compile.sh --docker-build
docker run -i --rm -v $(pwd):/host_pwd -w /host_pwd artss_docker ./compile.sh --mb --jobs 4
Expand All @@ -56,6 +58,7 @@ jobs:
- uses: actions/checkout@v2
- name: compile
run: |
git submodule update --init
./compile.sh --docker-build
docker run -i --rm -v $(pwd):/host_pwd -w /host_pwd artss_docker ./compile.sh --jobs 4 -s
Expand All @@ -66,6 +69,7 @@ jobs:
- uses: actions/checkout@v2
- name: compile
run: |
git submodule update --init
./compile.sh --docker-build
docker run -i --rm -v $(pwd):/host_pwd -w /host_pwd artss_docker ./compile.sh --jobs 4 --sb
Expand All @@ -76,6 +80,7 @@ jobs:
- uses: actions/checkout@v2
- name: compile
run: |
git submodule update --init
./compile.sh --docker-build
docker run -i --rm -v $(pwd):/host_pwd -w /host_pwd artss_docker sh -c "./compile.sh --jobs 4 -s -m -d && cd build && make test"
Expand All @@ -86,5 +91,6 @@ jobs:
- uses: actions/checkout@v2
- name: compile
run: |
git submodule update --init
./compile.sh --docker-build
docker run -i --rm -v $(pwd):/host_pwd -w /host_pwd artss_docker sh -c "cd tools && pwd && ./test_xml-builder.sh"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.dat
*.vtk
*.ods
/Debug/
.idea/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/spdlog"]
path = external/spdlog
url = https://github.com/gabime/spdlog.git
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- repo: local
hooks:
- id: cpplint
name: cpplint
description: Check C++ code style using cpplint.py.
entry: cpplint
language: system
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx)$
45 changes: 40 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ endif()

# Initialize CXXFLAGS.
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(-Wno-unused-parameter)
add_compile_options(-Wno-unused-variable)
add_compile_options(-Wno-unknown-pragmas)
add_compile_options(-Wno-cpp)
add_compile_options(-Wno-shadow)

set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${warning_flags} -O0 -g -Wunused-variable -Wunused-parameter -Wunused-function -Wshadow -Wunused -DTRACE_LOGGING")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -w -DNDEBUG")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "PGI")
Expand All @@ -88,6 +95,12 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "PGI" OR CMAKE_C_COMPILER_ID STREQUAL "PGI
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fast -w -DNDEBUG")
endif()

if(CMAKE_CXX_COMPILER_ID MATCHES "PGI")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION --c++11)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION --c++14)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION --c++17)
endif()

#--------------------
if(NOT CMAKE_GENERATOR MATCHES "Xcode|Visual Studio")
include(CheckCXXCompilerFlag)
Expand Down Expand Up @@ -287,27 +300,49 @@ set(HEADER_FILES
link_directories( $ENV{CUDA_LIB} )
include_directories( $ENV{CUDA_INC} )

# find spdlog lib
if(NOT TARGET spdlog)
# Stand-alone build
find_package(spdlog, QUIET)
endif()
# use local fallback
if(NOT TARGET spdlog)
add_subdirectory(external/spdlog)
endif()


#Targets
add_executable( artss_serial ${SOURCE_FILES} src/main.cpp)
target_link_libraries(artss_serial PRIVATE spdlog::spdlog)

add_executable( artss_serial_benchmark ${SOURCE_FILES} src/main.cpp )
set_target_properties( artss_serial_benchmark PROPERTIES COMPILE_FLAGS "-DBENCHMARKING -DUSE_NVTX" )
target_link_libraries( artss_serial_benchmark )

add_executable( artss_multicore_cpu ${SOURCE_FILES} src/main.cpp )
set_target_properties( artss_multicore_cpu PROPERTIES COMPILE_FLAGS "-acc -ta=multicore" LINK_FLAGS "-acc -ta=multicore" )

add_executable(artss_multicore_cpu ${SOURCE_FILES} src/main.cpp)
set_target_properties(artss_multicore_cpu PROPERTIES COMPILE_FLAGS "-acc -ta=multicore" LINK_FLAGS "-acc -ta=multicore")
target_link_libraries(artss_multicore_cpu PRIVATE spdlog::spdlog)

add_executable( artss_multicore_cpu_benchmark ${SOURCE_FILES} src/main.cpp )
set_target_properties( artss_multicore_cpu_benchmark PROPERTIES COMPILE_FLAGS "-acc -ta=multicore -DBENCHMARKING -DUSE_NVTX" LINK_FLAGS "-acc -ta=multicore" )
target_link_libraries( artss_multicore_cpu_benchmark )

add_executable( artss_gpu ${SOURCE_FILES} src/main.cpp )
set_target_properties( artss_gpu PROPERTIES COMPILE_FLAGS "-acc -Minfo=accel -ta=${GPU_CC_TA},lineinfo,${CUDA_VERSION_TA}" LINK_FLAGS "-acc -ta=${GPU_CC_TA},lineinfo,${CUDA_VERSION_TA}" )

add_executable(artss_gpu ${SOURCE_FILES} src/main.cpp)
set_target_properties(artss_gpu PROPERTIES COMPILE_FLAGS "-acc -Minfo=accel -ta=${GPU_CC_TA},lineinfo,${CUDA_VERSION_TA}" LINK_FLAGS "-acc -ta=${GPU_CC_TA},lineinfo,${CUDA_VERSION_TA}")
target_link_libraries(artss_gpu PRIVATE spdlog::spdlog)

add_executable( artss_gpu_benchmark ${SOURCE_FILES} src/main.cpp )
set_target_properties( artss_gpu_benchmark PROPERTIES COMPILE_FLAGS "-acc -Minfo=accel -DBENCHMARKING -DUSE_NVTX -ta=${GPU_CC_TA},lineinfo,${CUDA_VERSION_TA}" LINK_FLAGS "-acc -ta=${GPU_CC_TA},lineinfo,${CUDA_VERSION_TA}" )
target_link_libraries( artss_gpu_benchmark )


spdlog_enable_warnings(artss_serial)
spdlog_enable_warnings(artss_multicore_cpu)
spdlog_enable_warnings(artss_gpu)


enable_testing()
file( COPY ${CMAKE_CURRENT_SOURCE_DIR}/tests DESTINATION ${CMAKE_BINARY_DIR} )

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ git clone https://github.com/FireDynamics/ARTSS.git
cd ARTSS
```

if you already have a local copy of ARTSS and are missing spdlog do a recursive submodul init.
```
git submodule update --init --recursive
```

2. Compiling the code
```
./compile.sh [OPTIONS]
Expand Down
31 changes: 17 additions & 14 deletions examples/Test_NavierStokesTempTurb_OpenPlume.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,46 +9,46 @@
<kappa> 3.31e-5 </kappa> <!-- thermal diffusion -->
</physical_parameters>

<solver description = "NSTempTurbSolver" >
<advection type = "SemiLagrangian" field = "u,v,w">
<solver description="NSTempTurbSolver" >
<advection type="SemiLagrangian" field="u,v,w">
</advection>
<diffusion type = "Jacobi" field = "u,v,w">
<diffusion type="Jacobi" field="u,v,w">
<max_iter> 100 </max_iter> <!-- max number of iterations -->
<tol_res> 1e-07 </tol_res> <!-- tolerance for residuum/ convergence -->
<w> 1 </w> <!-- relaxation parameter -->
</diffusion>
<turbulence type = "ConstSmagorinsky">
<turbulence type="ConstSmagorinsky">
<Cs> 0.2 </Cs>
</turbulence>
<source type = "ExplicitEuler" force_fct="Buoyancy" dir="y"> <!--Direction of force (x,y,z or combinations xy,xz,yz, xyz) -->
<source type="ExplicitEuler" force_fct="Buoyancy" dir="y"> <!--Direction of force (x,y,z or combinations xy,xz,yz, xyz) -->
</source>
<pressure type = "VCycleMG" field = "p">
<pressure type="VCycleMG" field="p">
<n_level> 6 </n_level> <!-- number of restriction levels -->
<n_cycle> 2 </n_cycle> <!-- number of cycles -->
<max_cycle> 100 </max_cycle> <!-- maximal number of cycles in first time step -->
<tol_res> 1e-07 </tol_res> <!-- tolerance for residuum/ convergence -->
<diffusion type = "Jacobi" field = "p">
<diffusion type="Jacobi" field="p">
<n_relax> 4 </n_relax> <!-- number of iterations -->
<max_solve> 100 </max_solve> <!-- maximal number of iterations in solving at lowest level -->
<tol_res> 1e-07 </tol_res> <!-- tolerance for residuum/ convergence -->
<w> 0.6666666667 </w> <!-- relaxation parameter -->
</diffusion>
</pressure>
<temperature>
<advection type = "SemiLagrangian" field = "T">
<advection type="SemiLagrangian" field="T">
</advection>
<diffusion type = "Jacobi" field = "T">
<diffusion type="Jacobi" field="T">
<max_iter> 100 </max_iter>
<tol_res> 1e-07 </tol_res>
<w> 1 </w>
</diffusion>
<turbulence include = "Yes">
<turbulence include="Yes">
<Pr_T> 0.5 </Pr_T>
</turbulence>
<source type = "ExplicitEuler" temp_fct="GaussST" ramp_fct= "RampTanh" dissipation="No">
<source type="ExplicitEuler" temp_fct="GaussST" ramp_fct= "RampTanh" dissipation="No">
<HRR> 2500. </HRR> <!-- Total heat release rate (in kW) -->
<cp> 1.023415823 </cp> <!-- specific heat capacity (in kJ/kgK)-->
<x0> 0. </x0>
<x0> 0. </x0>
<y0> 1. </y0>
<z0> 0.1 </z0>
<sigmax> 0.1 </sigmax>
Expand All @@ -57,7 +57,7 @@
<tau> 5. </tau>
</source>
</temperature>
<solution available = "No">
<solution available="No">
</solution>
</solver>

Expand Down Expand Up @@ -94,11 +94,14 @@

<surfaces enabled="No"/>

<initial_conditions usr_fct = "Uniform" random = "No">
<initial_conditions usr_fct="Uniform" random="No">
<val> 303.64 </val>
</initial_conditions>

<visualisation save_vtk="Yes" save_csv="No">
<vtk_nth_plot> 40 </vtk_nth_plot>
</visualisation>

<logging file="output_test_navierstokestempturb_openplume.log" level="info">
</logging>
</ARTSS>
21 changes: 12 additions & 9 deletions examples/Test_NavierStokesTurb_FlowAroundCube.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
<nu> 0.00001 </nu> <!-- kinematic viscosity -->
</physical_parameters>

<solver description = "NSTurbSolver" >
<advection type = "SemiLagrangian" field = "u,v,w">
<solver description="NSTurbSolver" >
<advection type="SemiLagrangian" field="u,v,w">
</advection>
<diffusion type = "Jacobi" field = "u,v,w">
<diffusion type="Jacobi" field="u,v,w">
<max_iter> 100 </max_iter> <!-- max number of iterations -->
<tol_res> 1e-07 </tol_res> <!-- tolerance for residuum/ convergence -->
<w> 1 </w> <!-- relaxation parameter -->
</diffusion>
<turbulence type = "ConstSmagorinsky">
<turbulence type="ConstSmagorinsky">
<Cs> 0.2 </Cs>
</turbulence>
<source type = "ExplicitEuler" force_fct="Zero" dir = "xyz"> <!--Direction of force (x,y,z or combinations xy,xz,yz, xyz) -->
<source type="ExplicitEuler" force_fct="Zero" dir="xyz"> <!--Direction of force (x,y,z or combinations xy,xz,yz, xyz) -->
</source>
<pressure type = "VCycleMG" field = "p">
<pressure type="VCycleMG" field="p">
<n_level> 5 </n_level> <!-- number of restriction levels -->
<n_cycle> 2 </n_cycle> <!-- number of cycles -->
<max_cycle> 4 </max_cycle> <!-- maximal number of cycles in first time step -->
<tol_res> 1e-07 </tol_res> <!-- tolerance for residuum/ convergence -->
<diffusion type = "Jacobi" field = "p">
<diffusion type="Jacobi" field="p">
<n_relax> 4 </n_relax> <!-- number of iterations -->
<max_solve> 100 </max_solve> <!-- maximal number of iterations in solving at lowest level -->
<tol_res> 1e-07 </tol_res> <!-- tolerance for residuum/ convergence -->
<w> 0.6666666667 </w> <!-- relaxation parameter -->
</diffusion>
</pressure>
<solution available = "No">
<solution available="No">
</solution>
</solver>

Expand Down Expand Up @@ -71,7 +71,7 @@

<surfaces enabled="No"/>

<initial_conditions usr_fct = "Drift" random = "No" >
<initial_conditions usr_fct="Drift" random="No">
<u_lin> 0.4 </u_lin> <!-- background velocity -->
<v_lin> 0.0 </v_lin> <!-- background velocity -->
<w_lin> 0.0 </w_lin> <!-- background velocity -->
Expand All @@ -81,4 +81,7 @@
<visualisation save_vtk="Yes" save_csv="No">
<vtk_nth_plot> 10 </vtk_nth_plot>
</visualisation>

<logging file="output_test_navierstokesturb_flowaroundcube.log" level="info">
</logging>
</ARTSS>
1 change: 1 addition & 0 deletions external/spdlog
Submodule spdlog added at 616caa
Loading

0 comments on commit ed02b50

Please sign in to comment.