Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Review update.
  • Loading branch information
pratikvn committed Oct 1, 2020
commit 78c47e51064e6a20791a6dcc5064a1e72843fdea
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ stages:
-DGINKGO_BUILD_HIP=${BUILD_HIP}
-DGINKGO_BUILD_TESTS=ON -DGINKGO_BUILD_EXAMPLES=ON
-DGINKGO_CONFIG_LOG_DETAILED=${CONFIG_LOG}
-DGINKGO_RUN_EXAMPLES=${RUN_EXAMPLES}
- ninja -j${NUM_CORES} -l${CI_LOAD_LIMIT} install
- |
(( $(ctest -N | tail -1 | sed 's/Total Tests: //') != 0 )) || exit 1
Expand Down
34 changes: 20 additions & 14 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
option(GINKGO_BUILD_EXTLIB_EXAMPLE "Build the external-lib-interfacing with deal.II, you need to link the deal.II library." OFF)
option(GINKGO_RUN_EXAMPLES " Compile run and validation targets for the examples." ON)

set(EXAMPLES_EXEC_LIST
adaptiveprecision-blockjacobi
Expand Down Expand Up @@ -32,19 +33,24 @@ endif()

foreach(example ${EXAMPLES_LIST})
add_subdirectory(${example})
add_custom_target("run-${example}"
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example} > ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command "#!/bin/bash
diff <(sed -n '7,$p' ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out | sed -E 's/([0-9]+.)//g') <(sed -n '6,$p' ${CMAKE_SOURCE_DIR}/examples/${example}/doc/results.dox | head -n -4 | sed -E 's/([0-9]+.)//g')")
add_custom_target("validate-${example}"
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command && ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
endforeach()

add_custom_target(run_all_examples)
add_custom_target(validate_all_examples)
foreach(run_ex ${EXAMPLES_EXEC_LIST})
add_dependencies(run_all_examples "run-${run_ex}")
add_dependencies(validate_all_examples "validate-${run_ex}")
endforeach()
if(GINKGO_RUN_EXAMPLES)
foreach(example ${EXAMPLES_LIST})
add_custom_target("run-${example}"
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example} > ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command "#!/bin/bash
diff <(sed -n '7,$p' ${CMAKE_CURRENT_BINARY_DIR}/${example}/${example}.out | sed -E 's/([0-9]+.)//g') <(sed -n '6,$p' ${CMAKE_SOURCE_DIR}/examples/${example}/doc/results.dox | head -n -4 | sed -E 's/([0-9]+.)//g')")
Comment thread
upsj marked this conversation as resolved.
Outdated
add_custom_target("validate-${example}"
COMMAND chmod +x ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command && ${CMAKE_CURRENT_BINARY_DIR}/${example}/diff-command
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${example})
endforeach()

add_custom_target(run_all_examples)
add_custom_target(validate_all_examples)
foreach(run_ex ${EXAMPLES_EXEC_LIST})
add_dependencies(run_all_examples "run-${run_ex}")
add_dependencies(validate_all_examples "validate-${run_ex}")
endforeach()
endif()
1 change: 0 additions & 1 deletion examples/nine-pt-stencil-solver/doc/results.dox
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ The expected output should be

@code{.cpp}

Usage: executable DISCRETIZATION_POINTS [executor] [stencil_alpha] [stencil_beta] [stencil_gamma]
The average relative error is 6.35715e-06
The runtime is 167.320520 ms

Expand Down
8 changes: 1 addition & 7 deletions examples/nine-pt-stencil-solver/nine-pt-stencil-solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,6 @@ int main(int argc, char *argv[])
{
// Print version information
std::cout << gko::version_info::get() << std::endl;

if (argc < 2) {
std::cout << "Usage: executable DISCRETIZATION_POINTS [executor]"
<< " [stencil_alpha] [stencil_beta] [stencil_gamma]"
<< std::endl;
}
using ValueType = double;
using IndexType = int;

Expand All @@ -314,7 +308,7 @@ int main(int argc, char *argv[])
// clang-format off
std::array<ValueType, 9> coefs{
gamma_c, beta_c, gamma_c,
beta_c, alpha_c, beta_c,
beta_c, alpha_c, beta_c,
gamma_c, beta_c, gamma_c};
// clang-format on

Expand Down
12 changes: 6 additions & 6 deletions examples/papi-logging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
if (GINKGO_HAVE_PAPI_SDE)
set(target_name "papi-logging")
Comment thread
pratikvn marked this conversation as resolved.
add_executable(${target_name} ${target_name}.cpp)
target_link_libraries(${target_name} ginkgo PAPI::PAPI)
target_include_directories(${target_name} PRIVATE ${PROJECT_SOURCE_DIR})
configure_file(data/A.mtx data/A.mtx COPYONLY)
configure_file(data/b.mtx data/b.mtx COPYONLY)
configure_file(data/x0.mtx data/x0.mtx COPYONLY)
add_executable(${target_name} ${target_name}.cpp)
target_link_libraries(${target_name} ginkgo PAPI::PAPI)
target_include_directories(${target_name} PRIVATE ${PROJECT_SOURCE_DIR})
configure_file(data/A.mtx data/A.mtx COPYONLY)
configure_file(data/b.mtx data/b.mtx COPYONLY)
configure_file(data/x0.mtx data/x0.mtx COPYONLY)
endif()
1 change: 0 additions & 1 deletion examples/three-pt-stencil-solver/doc/results.dox
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ This is the expected output:

@code{.cpp}

Usage: executable DISCRETIZATION_POINTS [executor]
The average relative error is 2.52236e-11

@endcode
Expand Down
5 changes: 0 additions & 5 deletions examples/three-pt-stencil-solver/three-pt-stencil-solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,6 @@ int main(int argc, char *argv[])
// Print version information
std::cout << gko::version_info::get() << std::endl;

if (argc < 2) {
std::cout << "Usage: executable DISCRETIZATION_POINTS [executor]"
<< std::endl;
}

const IndexType discretization_points =
argc >= 2 ? std::atoi(argv[1]) : 100;
const auto executor_string = argc >= 3 ? argv[2] : "reference";
Expand Down