Skip to content

Commit 75c0e69

Browse files
authored
Feature/add non blt option (#74)
* optional BLT and CAMP * introduce ModelBuilderBase::MAX_ORDER to avoid non-standard variable size c-array * modify bechmark script * add clang-format target
1 parent c5fefee commit 75c0e69

File tree

8 files changed

+48
-18
lines changed

8 files changed

+48
-18
lines changed

scripts/run_semproxy_benchmark.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -euo pipefail
55
EXS="100"
66
EYS="100"
77
EZS="100"
8-
IMPLEMS="classic optim geos shiva"
8+
IMPLEMS="geos shiva"
99
MESHES="cartesian ucartesian"
1010
ORDERS="1 2 3"
1111
SEMPROXY_BIN="bin/semproxy"
@@ -20,7 +20,7 @@ Options (space-separated lists allowed; quoted):
2020
--ex "100" # values for --ex
2121
--ey "100" # values for --ey
2222
--ez "100" # values for --ez
23-
--implem "classic" # {classic, optim, geos, shiva}
23+
--implem "geos" # {classic, optim, geos, shiva}
2424
--mesh "cartesian" # {cartesian, ucartesian}
2525
-o|--order "1 2 3" # polynomial orders
2626
--bin PATH # path to semproxy (default: bin/semproxy)
@@ -77,7 +77,9 @@ for order in $ORDERS; do
7777
--ex "$ex" --ey "$ey" --ez "$ez"
7878
--implem "$implem"
7979
--mesh "$mesh"
80-
-o "$order" )
80+
-o "$order"
81+
--timemax "1.5"
82+
--dt "0.001" )
8183
echo ">> ${cmd[*]}"
8284

8385
if [[ "$DRY_RUN" -eq 1 ]]; then

src/CMakeLists.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,32 @@ add_subdirectory(main)
66

77
if(ENABLE_PYWRAP)
88
install_pyproxys_package(model solver)
9-
endif()
9+
endif()
10+
11+
12+
# Collect all sources
13+
file(GLOB_RECURSE ALL_SOURCE_FILES
14+
"${CMAKE_SOURCE_DIR}/src/*.cpp"
15+
"${CMAKE_SOURCE_DIR}/src/*.hpp"
16+
"${CMAKE_SOURCE_DIR}/src/*.cxx"
17+
"${CMAKE_SOURCE_DIR}/src/*.hxx"
18+
"${CMAKE_SOURCE_DIR}/src/*.cc"
19+
"${CMAKE_SOURCE_DIR}/src/*.c"
20+
"${CMAKE_SOURCE_DIR}/src/*.h"
21+
"${CMAKE_SOURCE_DIR}/src/*.hh")
22+
23+
# Example: filter out files whose path contains "Shiva" or "SEMKernels"
24+
list(FILTER ALL_SOURCE_FILES EXCLUDE REGEX "Shiva")
25+
list(FILTER ALL_SOURCE_FILES EXCLUDE REGEX "SEMKernels")
26+
27+
# Make the format target
28+
if( NOT CLANG_FORMAT_EXECUTABLE )
29+
set( CLANG_FORMAT_EXECUTABLE clang-format )
30+
endif()
31+
32+
message( STATUS "Using clang-format executable: ${CLANG_FORMAT_EXECUTABLE}" )
33+
34+
add_custom_target( apply_clang_format
35+
COMMAND ${CLANG_FORMAT_EXECUTABLE} -i -style=file -fallback-style=none ${ALL_SOURCE_FILES}
36+
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
37+
)

src/discretization/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,14 @@ target_include_directories(discretization
44
INTERFACE
55
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fe/SEMKernels/src/>
66
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fe/SEMKernels/src/finiteElement/>
7-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fe/SEMKernels/src/Shiva/src/>
87
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fe>
98
# $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/fd>
109
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
1110
${CMAKE_BINARY_DIR}/include
1211
)
1312
message(STATUS "Binary include dir: ${CMAKE_BINARY_DIR}/include")
1413

15-
include( fe/SEMKernels/src/Shiva/tpl/camp/extern/blt/SetupBLT.cmake )
1614
add_subdirectory( fe/SEMKernels )
1715

18-
add_dependencies( discretization finiteElements shiva)
19-
20-
target_link_libraries(discretization
21-
INTERFACE
22-
proxy_utils
23-
)
16+
target_link_libraries( discretization INTERFACE proxy_utils )
17+
target_link_libraries( discretization INTERFACE Shiva::shiva )

src/discretization/fe/SEMKernels

src/main/fe/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
if(COMPILE_SEM)
22

3+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
4+
35
add_executable(semproxy
46
src/main.cc
57
src/sem_proxy.cc

src/model/api/include/builder.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class ModelBuilderBase
1313
ModelBuilderBase() = default;
1414
~ModelBuilderBase() = default;
1515

16+
static constexpr int MAX_ORDER = 5;
17+
1618
virtual std::shared_ptr<model::ModelApi<FloatType, ScalarType>> getModel()
1719
const = 0;
1820
};

src/model/impl/builder/cartesian/include/cartesian_unstruct_builder.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ template <typename FloatType, typename ScalarType>
1212
class CartesianUnstructBuilder : ModelBuilderBase<FloatType, ScalarType>
1313
{
1414
public:
15+
using ModelBuilderBase<FloatType, ScalarType>::MAX_ORDER;
16+
1517
CartesianUnstructBuilder() {}
1618

1719
CartesianUnstructBuilder(const CartesianParams<FloatType, ScalarType>& p)
@@ -115,7 +117,7 @@ class CartesianUnstructBuilder : ModelBuilderBase<FloatType, ScalarType>
115117

116118
void getCoordInOneDirection(const int& h, const int& n_element, float* coord)
117119
{
118-
float xi[order_ + 1];
120+
float xi[MAX_ORDER + 1];
119121

120122
switch (order_)
121123
{
@@ -188,9 +190,9 @@ class CartesianUnstructBuilder : ModelBuilderBase<FloatType, ScalarType>
188190
nodes_coords_z_ =
189191
allocateVector<VECTOR_REAL_VIEW>(total_nodes, "nodes coords z");
190192

191-
float coord_x[order_ + 1];
192-
float coord_y[order_ + 1];
193-
float coord_z[order_ + 1];
193+
float coord_x[MAX_ORDER + 1];
194+
float coord_y[MAX_ORDER + 1];
195+
float coord_z[MAX_ORDER + 1];
194196

195197
auto hx = lx_ / ex_;
196198
auto hy = ly_ / ey_;

src/solver/impl/include/sem_solver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SEMsolver : public SolverBase
7676
virtual void computeFEInit(model::ModelApi<float, int> &mesh,
7777
const float sponge_size[3],
7878
const bool surface_sponge,
79-
const float taper_delta_);
79+
const float taper_delta_) override final;
8080
/**
8181
* @brief Compute one time step of the SEM wave equation solver.
8282
*

0 commit comments

Comments
 (0)