11#include <Kokkos_Macros.hpp>
16#if defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG
)
30ChunkPrinter::~ChunkPrinter() =
default;
32ChunkPrinter::ChunkPrinter() =
default;
34void ChunkPrinter::saveformat(std::ostream& os)
39std::ostream& ChunkPrinter::align(std::ostream& os,
int const level)
41 for (
int i = 0; i <= level; ++i) {
47ChunkPrinter& ChunkPrinter::get_instance()
49 static ChunkPrinter instance;
53void print_demangled_type_name(std::ostream& os,
char const*
const mangled_name)
55#if defined(KOKKOS_COMPILER_GNU) || defined(KOKKOS_COMPILER_CLANG
)
58 std::unique_ptr<
char,
decltype(std::free)*>
const
59 demangled_name(abi::__cxa_demangle(mangled_name,
nullptr,
nullptr, &status), std::free);
61 std::cerr <<
"Error demangling dimension name: " << status <<
'\n' << std::flush;
64 os << demangled_name.get();
72void print_single_dim_name(
74 char const*
const dim,
75 DiscreteVectorElement
const size)
77 print_demangled_type_name(os, dim);
78 os <<
'(' << size <<
')';
83 char const*
const*
const dims,
84 DiscreteVectorElement
const*
const sizes,
90 print_single_dim_name(os, dims[0], sizes[0]);
91 for (std::size_t i = 1; i < n; ++i) {
93 print_single_dim_name(os, dims[i], sizes[i]);
102 ddc::detail::ChunkPrinter& printer =
ddc::detail::ChunkPrinter::get_instance();
107 std::scoped_lock
const lock(printer.m_global_lock);
111 printer.m_options = options;
113 std::cerr <<
"DDC Printer: invalid values " << options
.edgeitems <<
" for edgeitems and "
114 << options
.threshold <<
" for threshold have been ignored\n"
115 <<
"threshold needs to be at least twice as big as edgeitems\n";
123 ddc::detail::ChunkPrinter
const& printer =
ddc::detail::ChunkPrinter::get_instance();
124 return printer.m_options;
The top-level namespace of DDC.
PrinterOptions get_print_options()
Return the currently used format options.
bool operator==(PrinterOptions const &rhs) const noexcept