Skip to content

Commit

Permalink
Merge pull request #1670 from DARMA-tasking/1667-config-includes-refa…
Browse files Browse the repository at this point in the history
…ctoring

#1667 refactor config includes
  • Loading branch information
PhilMiller authored Feb 15, 2022
2 parents c20e83c + 8d7ce4a commit c7e7832
Show file tree
Hide file tree
Showing 29 changed files with 69 additions and 180 deletions.
2 changes: 1 addition & 1 deletion cmake/trace_only_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(create_trace_only_target)

# vt/configs
vt/configs/generated/vt_git_revision.h vt/configs/error/hard_error.h
vt/configs/features/features_enableif.h vt/configs/features/features_featureswitch.h
vt/configs/features/features_featureswitch.h
vt/configs/features/features_defines.h vt/configs/types/types_type.h
vt/configs/error/pretty_print_message.h vt/configs/debug/debug_masterconfig.h
vt/configs/debug/debug_config.h
Expand Down
1 change: 1 addition & 0 deletions src/vt/collective/reduce/scoping/strong_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

#include "vt/configs/types/types_type.h"
#include "vt/configs/types/types_sentinels.h"
#include "vt/epoch/epoch_type.h"
#include "vt/utils/strong/strong_type.h"

namespace vt { namespace collective { namespace reduce { namespace detail {
Expand Down
1 change: 0 additions & 1 deletion src/vt/configs/debug/debug_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ struct Configuration {

#include "vt/configs/features/features_featureswitch.h"
#include "vt/configs/features/features_defines.h"
#include "vt/configs/features/features_enableif.h"
#include "vt/configs/debug/debug_printconst.h"

#endif /*INCLUDED_VT_CONFIGS_DEBUG_DEBUG_CONFIG_H*/
2 changes: 0 additions & 2 deletions src/vt/configs/debug/debug_masterconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
#if !defined INCLUDED_VT_CONFIGS_DEBUG_DEBUG_MASTERCONFIG_H
#define INCLUDED_VT_CONFIGS_DEBUG_DEBUG_MASTERCONFIG_H

#include <vt/cmake_config.h>

/*
* Define the compile-time configuration options. Eventually this will be
* partially defined with cmake options
Expand Down
2 changes: 0 additions & 2 deletions src/vt/configs/debug/debug_print.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#if !defined INCLUDED_VT_CONFIGS_DEBUG_DEBUG_PRINT_H
#define INCLUDED_VT_CONFIGS_DEBUG_DEBUG_PRINT_H

#include "vt/configs/arguments/app_config.h"
#include "vt/configs/types/types_headers.h"
#include "vt/configs/debug/debug_config.h"
#include "vt/configs/debug/debug_colorize.h"
Expand Down Expand Up @@ -273,7 +272,6 @@ extern runtime::Runtime* curRT;
} /* end namespace vt */

namespace vt { namespace debug {
arguments::AppConfig const* preConfig();
NodeType preNode();
}} /* end namespace vt::debug */

Expand Down
2 changes: 2 additions & 0 deletions src/vt/configs/debug/debug_var_unused.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#if !defined INCLUDED_VT_CONFIGS_DEBUG_DEBUG_VAR_UNUSED_H
#define INCLUDED_VT_CONFIGS_DEBUG_DEBUG_VAR_UNUSED_H

#include <utility>

#define vt_force_use(...) vt::debug::useVars(__VA_ARGS__);

namespace vt { namespace debug {
Expand Down
2 changes: 0 additions & 2 deletions src/vt/configs/error/code.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
#if !defined INCLUDED_VT_CONFIGS_ERROR_CODE_H
#define INCLUDED_VT_CONFIGS_ERROR_CODE_H

#include "vt/configs/error/code_class.h"

#include <cstdlib>

namespace vt { namespace error {
Expand Down
3 changes: 1 addition & 2 deletions src/vt/configs/error/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@
#if !defined INCLUDED_VT_CONFIGS_ERROR_COMMON_H
#define INCLUDED_VT_CONFIGS_ERROR_COMMON_H

#include "vt/configs/types/types_headers.h"
#include "vt/collective/basic.h"
#include "vt/configs/types/types_type.h"

#define INVERT_COND(cond) (!(cond))
#define DEBUG_LOCATION __FILE__,__LINE__,__func__
Expand Down
4 changes: 0 additions & 4 deletions src/vt/configs/error/config_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,8 @@
* build/runtime mode when the assertion breaks
*/

#include "vt/configs/debug/debug_config.h"
#include "vt/configs/types/types_type.h"
#include "vt/configs/error/common.h"
#include "vt/configs/error/assert_out.h"
#include "vt/configs/error/assert_out_info.h"
#include "vt/configs/error/keyval_printer.h"

#include <tuple>
#include <type_traits>
Expand Down
2 changes: 0 additions & 2 deletions src/vt/configs/error/error.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
#define INCLUDED_VT_CONFIGS_ERROR_ERROR_H

#include "vt/configs/types/types_headers.h"
#include "vt/configs/debug/debug_config.h"
#include "vt/configs/error/common.h"

#include <string>
#include <tuple>
Expand Down
1 change: 1 addition & 0 deletions src/vt/configs/error/error.impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "vt/configs/error/common.h"
#include "vt/configs/error/error.h"
#include "vt/configs/error/pretty_print_message.h"
#include "vt/collective/basic.h"

#include <string>
#include <tuple>
Expand Down
3 changes: 0 additions & 3 deletions src/vt/configs/error/keyval_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@
#if !defined INCLUDED_VT_CONFIGS_ERROR_KEYVAL_PRINTER_H
#define INCLUDED_VT_CONFIGS_ERROR_KEYVAL_PRINTER_H

#include "vt/configs/error/common.h"
#include "vt/configs/debug/debug_config.h"

#include <cstdlib>
#include <tuple>
#include <type_traits>
Expand Down
99 changes: 0 additions & 99 deletions src/vt/configs/error/pretty_print_stack.h

This file was deleted.

2 changes: 2 additions & 0 deletions src/vt/configs/error/soft_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@
* the cost of these checks can be fully optimized out.
*/

#include "vt/collective/basic.h"
#include "vt/configs/types/types_type.h"
#include "vt/configs/error/common.h"
#include "vt/configs/error/pretty_print_message.h"
#include "vt/configs/features/features_defines.h"

#include <string>

Expand Down
42 changes: 41 additions & 1 deletion src/vt/configs/error/stack_out.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#include <fmt/core.h>

#include "vt/configs/error/stack_out.h"
#include "vt/configs/debug/debug_colorize.h"
#include "vt/context/context.h"

#include <cstdlib>
#include <vector>
Expand Down Expand Up @@ -117,5 +119,43 @@ DumpStackType dumpStack(int skip) {
return std::make_tuple(trace_buf.str(),tuple);
}

}}} /* end namespace vt::debug::stack */
std::string prettyPrintStack(StackVectorType const& stack) {
auto green = ::vt::debug::green();
auto bred = ::vt::debug::bred();
auto reset = ::vt::debug::reset();
auto magenta = ::vt::debug::magenta();
auto yellow = ::vt::debug::yellow();
auto vt_pre = ::vt::debug::vtPre();
auto node = ::vt::theContext()->getNode();
auto node_str = ::vt::debug::proc(node);
auto prefix = vt_pre + node_str + " ";
auto seperator = fmt::format("{}{}{:-^120}{}\n", prefix, yellow, "", reset);
auto title_node = fmt::format("on Node {}", node);
auto title = fmt::format(" Dump Stack Backtrace {} ", title_node);

std::string out = "";

out += fmt::format("{}", seperator);
out += fmt::format("{}{}{:-^120}{}\n", prefix, yellow, title, reset);
out += fmt::format("{}", seperator);

int i = 0;
for (auto&& t : stack) {
auto ret_str = fmt::format(
"{}{}{:<3}{} {}{:<3} {:<13}{} {}{}{} + {}{}\n",
prefix,
bred, i, reset,
magenta, std::get<0>(t), std::get<1>(t), reset,
green, std::get<2>(t), reset,
std::get<3>(t), reset
);
out += ret_str;
i++;
}

//out += seperator + seperator + seperator;

return out;
}

}}} /* end namespace vt::debug::stack */
7 changes: 5 additions & 2 deletions src/vt/configs/error/stack_out.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,22 @@
#include <cstdlib>
#include <vector>
#include <tuple>
#include <string>

namespace vt { namespace debug { namespace stack {

using StackTupleType = std::tuple<int32_t,void*,std::string,std::size_t>;
using StackTupleType = std::tuple<int32_t, void *, std::string, std::size_t>;
using StackVectorType = std::vector<StackTupleType>;
using DumpStackType = std::tuple<std::string,StackVectorType>;
using DumpStackType = std::tuple<std::string, StackVectorType>;

/*
* This function automatically produce a backtrace of the stack with demangled
* function names and method name.
*/
DumpStackType dumpStack(int skip = 0);

std::string prettyPrintStack(StackVectorType const& stack);

}}} /* end namespace vt::debug::stack */

#endif /*INCLUDED_VT_CONFIGS_ERROR_STACK_OUT_H*/
4 changes: 4 additions & 0 deletions src/vt/configs/features/features_defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#if !defined INCLUDED_VT_CONFIGS_FEATURES_FEATURES_DEFINES_H
#define INCLUDED_VT_CONFIGS_FEATURES_FEATURES_DEFINES_H

#include <vt/cmake_config.h>

/*
* All the defined features/options for debugging and backend enable-ifs
*/
Expand Down Expand Up @@ -72,4 +74,6 @@
#define vt_feature_libfort 0 || vt_feature_cmake_libfort
#define vt_feature_production_build 0 || vt_feature_cmake_production_build

#define vt_check_enabled(test_option) (vt_feature_ ## test_option != 0)

#endif /*INCLUDED_VT_CONFIGS_FEATURES_FEATURES_DEFINES_H*/
51 changes: 0 additions & 51 deletions src/vt/configs/features/features_enableif.h

This file was deleted.

1 change: 1 addition & 0 deletions src/vt/configs/types/types_headers.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@
#include "vt/configs/types/types_rdma.h"
#include "vt/configs/types/types_size.h"
#include "vt/configs/types/types_sentinels.h"
#include "vt/epoch/epoch_type.h"

#endif /*INCLUDED_VT_CONFIGS_TYPES_TYPES_HEADERS_H*/
1 change: 0 additions & 1 deletion src/vt/configs/types/types_rdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#if !defined INCLUDED_VT_CONFIGS_TYPES_TYPES_RDMA_H
#define INCLUDED_VT_CONFIGS_TYPES_TYPES_RDMA_H

#include "vt/configs/debug/debug_masterconfig.h"
#include "vt/configs/types/types_type.h"

#include <cstdint>
Expand Down
1 change: 0 additions & 1 deletion src/vt/configs/types/types_sentinels.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#if !defined INCLUDED_VT_CONFIGS_TYPES_TYPES_SENTINELS_H
#define INCLUDED_VT_CONFIGS_TYPES_TYPES_SENTINELS_H

#include "vt/configs/debug/debug_masterconfig.h"
#include "vt/configs/types/types_type.h"
#include "vt/configs/types/types_rdma.h"

Expand Down
Loading

0 comments on commit c7e7832

Please sign in to comment.