Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove pybind completely #671

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 0 additions & 3 deletions docs/source/_static/front_page_schematic/frontpageschem.tex
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@
\newcommand{\pymor}{$\mathbf{pyMOR}$}
\newcommand{\pyrom}{$\mathbf{pyROM}$}
\newcommand{\librom}{$\mathbf{libROM}$}
\newcommand{\pybind}{$\mathbf{pybind11}$}
\newcommand{\pybindarr}{\code{pybind11::array\_t}}

% math macros general
\newcommand{\defeq}{\vcentcolon =}
\newcommand*{\difftime}[1]{\dot{#1}}
Expand Down
74 changes: 2 additions & 72 deletions include/pressio/utils/logger/utils_logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ using logger = spdlog::logger;

namespace log{

#if !defined PRESSIO_ENABLE_TPL_PYBIND11
template<typename ...Args>
void initialize(::pressio::logto en, Args && ... args)
{
Expand All @@ -33,51 +32,6 @@ void initialize(::pressio::logto en, Args && ... args)
#endif
}

#else //PRESSIO_ENABLE_TPL_PYBIND11

// need this because for pybind11 cannot use variadic directly
void initialize(::pressio::logto en, std::string fileName)
{
#if PRESSIO_LOG_ACTIVE_MIN_LEVEL != PRESSIO_LOG_LEVEL_OFF
auto logger = ::pressio::log::impl::create(en, fileName);
// logger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] [%s:%#] [fnc=%!] : %v");

// note that the sinks can have different levels. By using trace for the
// main logger we make sure it is up to the sinks or the global
// define to set the minlevel of output.
logger->set_level(spdlog::level::trace);

// set the singleton
spdlog::set_default_logger(logger);
logger->log(spdlog::level::info, "Initializing pressio logger");
#endif
}

// need this because for pybind11 cannot use variadic directly
void initialize2(::pressio::logto en)
{
#if PRESSIO_LOG_ACTIVE_MIN_LEVEL != PRESSIO_LOG_LEVEL_OFF
if (en != ::pressio::logto::terminal){
throw std::runtime_error("logger: this overload of initialize is only for terminal output");
}

auto logger = ::pressio::log::impl::create(en, "null");
// logger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%^%l%$] [%s:%#] [fnc=%!] : %v");

// note that the sinks can have different levels. By using trace for the
// main logger we make sure it is up to the sinks or the global
// define to set the minlevel of output.
logger->set_level(spdlog::level::trace);

// set the singleton
spdlog::set_default_logger(logger);
logger->log(spdlog::level::info, "Initializing pressio logger");
#endif
}

#endif//PRESSIO_ENABLE_TPL_PYBIND11


// Return an existing logger or nullptr if a logger with such name doesn't exist.
// example: spdlog::get("my_logger")->info("hello {}", "world");

Expand Down Expand Up @@ -116,11 +70,8 @@ void finalize()
}


#ifdef PRESSIO_ENABLE_TPL_PYBIND11
template <typename T> void setVerbosity(T levels)
#else
template <typename T= void> void setVerbosity(std::initializer_list<::pressio::log::level> levels)
#endif
template <typename T= void>
void setVerbosity(std::initializer_list<::pressio::log::level> levels)
{
#if PRESSIO_LOG_ACTIVE_MIN_LEVEL != PRESSIO_LOG_LEVEL_OFF
auto logger = ::pressio::log::get("pressioLogger");
Expand Down Expand Up @@ -188,27 +139,6 @@ inline void critical(const FormatString &fmt, Args&&...args)
#endif
}

// #ifdef PRESSIO_ENABLE_TPL_PYBIND11
// template<typename... Args>
// inline void print4py(spdlog::source_loc loc, spdlog::level::level_enum lvl, Args&&...args)
// {
// {
// pybind11::scoped_ostream_redirect stream
// (
// std::cout, // std::ostream&
// pybind11::module_::import("sys").attr("stdout") // Python output
// );

// spdlog::memory_buf_t buf;
// fmt::format_to(buf, std::forward<Args>(args)...);
// pybind11::print(buf.data());
// fmt::print(buf.data());
// pybind11::print("\n");
// //fmt::print(std::string(loc.filename) + " " + a + "\n");
// }
// }
// #endif

}} // namespace pressio::log


Expand Down
7 changes: 0 additions & 7 deletions tests/cmake/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ option(PRESSIO_ENABLE_TPL_EIGEN "Enable Eigen TPL" ON)
option(PRESSIO_ENABLE_TPL_TRILINOS "Enable Trilinos TPL" OFF)
option(PRESSIO_ENABLE_TPL_KOKKOS "Enable Kokkos TPL" OFF)
option(PRESSIO_ENABLE_TPL_MPI "Enable MPI" OFF)
option(PRESSIO_ENABLE_TPL_PYBIND11 "Enable Pybind11 TPL" OFF)


if(PRESSIO_ENABLE_TPL_EIGEN)
message(">> Eigen is currently enabled by default via PRESSIO_ENABLE_TPL_EIGEN=ON")
Expand Down Expand Up @@ -91,11 +89,6 @@ if(PRESSIO_ENABLE_TPL_MPI)
include_directories(SYSTEM ${MPI_CXX_INCLUDE_DIRS})
endif()

if(PRESSIO_ENABLE_TPL_Pybind11)
message(">> Enabling Pybind11 since PRESSIO_ENABLE_TPL_PYBIND11=ON")
add_definitions(-DPRESSIO_ENABLE_TPL_Pybind11)
endif()

if(PRESSIO_ENABLE_TPL_BLAS)
message(">> Enabling BLAS since PRESSIO_ENABLE_TPL_BLAS=ON")
add_definitions(-DPRESSIO_ENABLE_TPL_BLAS)
Expand Down