diff --git a/src/main.cpp b/src/main.cpp index 064a382270a6834a2e27bf6e53b29e1cbc059c9f..941ed40e6348569a9952a5f8d5a1f36b038425fd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -87,38 +87,11 @@ int main(int argc, char *argv[]) std::cout << ")\n"; std::cout << "-------------------------------------------------------\n"; - Kokkos::initialize(argc, argv); + initialize(argc, argv); Kokkos::DefaultExecutionSpace::print_configuration(std::cout); std::map<std::string, double> method_cost_map; - // { // Basic function based acoustic solver - // Kokkos::Timer timer; - // timer.reset(); - // RawKokkos::AcousticSolver(number); - // method_cost_map["RawKokkos"] = timer.seconds(); - // } - - // { // class for acoustic solver (mesh less) - // Kokkos::Timer timer; - // timer.reset(); - // MeshLessAcousticSolver acoustic_solver(number); - // method_cost_map["MeshLessAcousticSolver"] = timer.seconds(); - // } - - // { // class for acoustic solver - // Kokkos::Timer timer; - // timer.reset(); - // AcousticSolverClass acoustic_solver(number); - // method_cost_map["AcousticSolverClass"] = timer.seconds(); - // } - - // { // class for acoustic solver test - // Kokkos::Timer timer; - // timer.reset(); - // AcousticSolverTest acoustic_solver(number); - // method_cost_map["AcousticSolverTest"] = timer.seconds(); - // } try { if (filename != "") { std::cout << "Reading (gmsh) " << rang::style::underline << filename << rang::style::reset << " ...\n"; @@ -444,7 +417,7 @@ int main(int argc, char *argv[]) std::exit(1); } - Kokkos::finalize(); + finalize(); std::string::size_type size=0; for (const auto& method_cost : method_cost_map) { @@ -453,14 +426,14 @@ int main(int argc, char *argv[]) for (const auto& method_cost : method_cost_map) { std::cout << "* [" - << rang::fgB::cyan - << std::setw(size) << std::left - << method_cost.first - << rang::fg::reset - << "] Execution time: " - << rang::style::bold - << method_cost.second - << rang::style::reset << '\n'; + << rang::fgB::cyan + << std::setw(size) << std::left + << method_cost.first + << rang::fg::reset + << "] Execution time: " + << rang::style::bold + << method_cost.second + << rang::style::reset << '\n'; } return 0; diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index ad047d0ea29d6f6bff9001ca880d1419f2595d20..3599d7ae878000f1c7f5251a050f8ca54bd986d7 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -8,6 +8,7 @@ add_library( BacktraceManager.cpp ConsoleManager.cpp FPEManager.cpp + PastisUtils.cpp RevisionInfo.cpp SignalManager.cpp) @@ -35,7 +36,7 @@ add_custom_command(TARGET PastisGitRevison DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp COMMENT "" ) - + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/pastis_git_revision.hpp PRE_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different diff --git a/src/utils/PastisUtils.cpp b/src/utils/PastisUtils.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c86974b81440953f2785ecca564df54def7e0716 --- /dev/null +++ b/src/utils/PastisUtils.cpp @@ -0,0 +1,12 @@ +#include <PastisUtils.hpp> +#include <Kokkos_Core.hpp> + +void initialize(int& argc, char* argv[]) +{ + Kokkos::initialize(argc,argv); +} + +void finalize() +{ + Kokkos::finalize(); +} diff --git a/src/utils/PastisUtils.hpp b/src/utils/PastisUtils.hpp index adf12176fa47847b439aa334a4f7f9d2ada1468f..939b76f0b9e3c3ee5516a8a7a1e9f6dece4577d5 100644 --- a/src/utils/PastisUtils.hpp +++ b/src/utils/PastisUtils.hpp @@ -26,4 +26,8 @@ void parallel_reduce(const size_t& size, Kokkos::parallel_reduce(label, size, array, value); } +void initialize(int& argc, char* argv[]); + +void finalize(); + #endif // PASTIS_UTILS_HPP