diff --git a/caliper-config.h.in b/caliper-config.h.in index 366c407e..05747c3a 100644 --- a/caliper-config.h.in +++ b/caliper-config.h.in @@ -26,13 +26,12 @@ #cmakedefine CALIPER_HAVE_UMPIRE #cmakedefine CALIPER_HAVE_CRAYPAT #cmakedefine CALIPER_HAVE_LDMS +#cmakedefine CALIPER_HAVE_KOKKOS #cmakedefine CALIPER_HAVE_ARCH "@CALIPER_HAVE_ARCH@" #ifdef CALIPER_HAVE_PAPI #cmakedefine CALIPER_WITH_PAPI_RDPMC #endif -#cmakedefine CALIPER_REDUCED_CONSTEXPR_USAGE - #cmakedefine CALIPER_MPIWRAP_USE_GOTCHA #cmakedefine CALIPER_ENABLE_HISTOGRAMS diff --git a/examples/apps/cxx-example.cpp b/examples/apps/cxx-example.cpp index aa2d58c2..15ddce7a 100644 --- a/examples/apps/cxx-example.cpp +++ b/examples/apps/cxx-example.cpp @@ -50,6 +50,7 @@ int main(int argc, char* argv[]) // The ConfigManager manages built-in or custom Caliper measurement // configurations, and provides an API to control performance profiling. cali::ConfigManager mgr; + mgr.set_default_parameter("aggregate_across_ranks", "false"); // Parse command-line arguments. Let users choose a Caliper performance // profiling configuration via the "-P" command-line argument. diff --git a/include/caliper/AnnotationBinding.h b/include/caliper/AnnotationBinding.h index a5912d1a..0267b89f 100644 --- a/include/caliper/AnnotationBinding.h +++ b/include/caliper/AnnotationBinding.h @@ -6,13 +6,10 @@ #pragma once -#include "caliper/CaliperService.h" - -#include "caliper/caliper-config.h" #include "caliper/Caliper.h" +#include "caliper/CaliperService.h" #include "caliper/common/Log.h" -#include "caliper/common/RuntimeConfig.h" #include #include @@ -72,15 +69,11 @@ class Node; class AnnotationBinding { - ConfigSet m_config; Attribute m_marker_attr; std::unique_ptr m_filter; - std::vector m_trigger_attr_names; - static const ConfigSet::Entry s_configdata[]; - void mark_attribute(Caliper*, Channel*, const Attribute&); void check_attribute(Caliper*, Channel*, const Attribute&); diff --git a/include/caliper/Caliper.h b/include/caliper/Caliper.h index e9d15be2..3ace960e 100644 --- a/include/caliper/Caliper.h +++ b/include/caliper/Caliper.h @@ -10,10 +10,7 @@ #include "SnapshotRecord.h" -#include "common/Attribute.h" #include "common/CaliperMetadataAccessInterface.h" -#include "common/Entry.h" -#include "common/Variant.h" #include "common/callback.hpp" #include diff --git a/include/caliper/ConfigManager.h b/include/caliper/ConfigManager.h index 4a0e1969..5057c85e 100644 --- a/include/caliper/ConfigManager.h +++ b/include/caliper/ConfigManager.h @@ -5,15 +5,16 @@ /// %Caliper ConfigManager class definition #pragma once +#ifndef CALI_CONFIGMANAGER_H +#define CALI_CONFIGMANAGER_H + +#include "ChannelController.h" #include #include #include #include -#include "ChannelController.h" - -#include "common/StringConverter.h" namespace cali { @@ -96,7 +97,7 @@ class ConfigManager /// \brief Return the value for \a option, or \a default_value /// if it is not set in the options list. - StringConverter get(const char* option, const char* default_value = "") const; + std::string get(const char* option, const char* default_value = "") const; /// \brief Perform a validity check. std::string check() const; @@ -524,3 +525,5 @@ class ConfigManager void add_global_config_specs(const ConfigManager::ConfigInfo** configs); } // namespace cali + +#endif \ No newline at end of file diff --git a/include/caliper/SnapshotRecord.h b/include/caliper/SnapshotRecord.h index 3441789e..46e45dda 100644 --- a/include/caliper/SnapshotRecord.h +++ b/include/caliper/SnapshotRecord.h @@ -24,22 +24,17 @@ class SnapshotView public: SnapshotView() : m_data { nullptr }, m_len { 0 } {} - SnapshotView(size_t len, const Entry* data) : m_data { data }, m_len { len } {} - SnapshotView(const Entry& e) : m_data { &e }, m_len { 1 } {} using iterator = Entry*; using const_iterator = const Entry*; const_iterator begin() const { return m_data; } - const_iterator end() const { return m_data + m_len; } size_t size() const { return m_len; } - const Entry* data() const { return m_data; } - bool empty() const { return m_len == 0; } const Entry& operator[] (std::size_t n) const { return m_data[n]; } @@ -78,7 +73,6 @@ class SnapshotBuilder public: SnapshotBuilder() : m_data { nullptr }, m_capacity { 0 }, m_len { 0 }, m_skipped { 0 } {} - SnapshotBuilder(size_t capacity, Entry* data) : m_data { data }, m_capacity { capacity }, m_len { 0 }, m_skipped { 0 } {} @@ -90,9 +84,7 @@ class SnapshotBuilder SnapshotBuilder& operator= (const SnapshotBuilder&) = delete; size_t capacity() const { return m_capacity; } - size_t size() const { return m_len; } - size_t skipped() const { return m_skipped; } void append(const Entry& e) @@ -112,7 +104,6 @@ class SnapshotBuilder } void append(const Attribute& attr, const Variant& val) { append(Entry(attr, val)); } - void append(SnapshotView view) { append(view.size(), view.data()); } SnapshotView view() const { return SnapshotView { m_len, m_data }; } @@ -133,7 +124,6 @@ class FixedSizeSnapshotRecord FixedSizeSnapshotRecord operator= (const FixedSizeSnapshotRecord&) = delete; SnapshotBuilder& builder() { return m_builder; } - SnapshotView view() const { return m_builder.view(); } void reset() { m_builder = SnapshotBuilder(N, m_data); } diff --git a/include/caliper/common/Attribute.h b/include/caliper/common/Attribute.h index 62e8c517..c6f0045b 100644 --- a/include/caliper/common/Attribute.h +++ b/include/caliper/common/Attribute.h @@ -6,11 +6,10 @@ * \brief Attribute class declaration */ +#pragma once #ifndef CALI_ATTRIBUTE_H #define CALI_ATTRIBUTE_H -#include "caliper/common/cali_types.h" - #include "caliper/common/Node.h" #include "caliper/common/Variant.h" @@ -45,9 +44,7 @@ class Attribute std::string name() const; const char* name_c_str() const; - cali_attr_type type() const; - int properties() const; /// \brief Return the context tree node pointer that represents @@ -57,15 +54,10 @@ class Attribute Variant get(const Attribute& attr) const; bool store_as_value() const { return properties() & CALI_ATTR_ASVALUE; } - bool is_autocombineable() const { return !store_as_value() && !(properties() & CALI_ATTR_NOMERGE); } - bool skip_events() const { return properties() & CALI_ATTR_SKIP_EVENTS; } - bool is_hidden() const { return properties() & CALI_ATTR_HIDDEN; } - bool is_nested() const { return properties() & CALI_ATTR_NESTED; } - bool is_global() const { return properties() & CALI_ATTR_GLOBAL; } int level() const { return (properties() & CALI_ATTR_LEVEL_MASK) >> 16; } diff --git a/include/caliper/common/Node.h b/include/caliper/common/Node.h index 9ee9650b..d5c62c35 100644 --- a/include/caliper/common/Node.h +++ b/include/caliper/common/Node.h @@ -9,8 +9,6 @@ #ifndef CALI_NODE_H #define CALI_NODE_H -#include "cali_types.h" - #include "lockfree-tree.hpp" #include "Variant.h" diff --git a/include/caliper/common/RuntimeConfig.h b/include/caliper/common/RuntimeConfig.h index 06de6d9a..f7d3d9b0 100644 --- a/include/caliper/common/RuntimeConfig.h +++ b/include/caliper/common/RuntimeConfig.h @@ -49,7 +49,6 @@ class ConfigSet class RuntimeConfig { struct RuntimeConfigImpl; - std::shared_ptr mP; public: diff --git a/include/caliper/common/Variant.h b/include/caliper/common/Variant.h index 60c3019a..6ae6b917 100644 --- a/include/caliper/common/Variant.h +++ b/include/caliper/common/Variant.h @@ -6,9 +6,7 @@ #pragma once -#include "cali_types.h" #include "cali_variant.h" -#include "caliper/caliper-config.h" #include #include @@ -39,19 +37,15 @@ class Variant Variant(const cali_variant_t& v) : m_v(v) {} Variant(bool val) : m_v(cali_make_variant_from_bool(val)) {} - Variant(int val) : m_v(cali_make_variant_from_int(val)) {} - Variant(double val) : m_v(cali_make_variant_from_double(val)) {} + Variant(const char* val) : m_v(cali_make_variant_from_string(val)) {} + Variant(cali_attr_type val) : m_v(cali_make_variant_from_type(val)) {} template ::value, int>::type = 0> Variant(U val) : m_v(cali_make_variant_from_uint(val)) {} - Variant(const char* val) : m_v(cali_make_variant_from_string(val)) {} - - Variant(cali_attr_type val) : m_v(cali_make_variant_from_type(val)) {} - Variant(cali_attr_type type, const void* data, std::size_t size) { m_v = cali_make_variant(type, data, size); } bool empty() const { return (m_v.type_and_size & CALI_VARIANT_TYPE_MASK) == CALI_TYPE_INV; }; @@ -65,27 +59,17 @@ class Variant } cali_variant_t c_variant() const { return m_v; } - cali_attr_type type() const { return cali_variant_get_type(m_v); } - const void* data() const { return cali_variant_get_data(&m_v); } - size_t size() const { return cali_variant_get_size(m_v); } - void* get_ptr() const { return cali_variant_get_ptr(m_v); } cali_id_t to_id(bool* okptr = nullptr) const; - int to_int(bool* okptr = nullptr) const { return cali_variant_to_int(m_v, okptr); } - int64_t to_int64(bool* okptr = nullptr) const { return cali_variant_to_int64(m_v, okptr); } - uint64_t to_uint(bool* okptr = nullptr) const { return cali_variant_to_uint(m_v, okptr); } - bool to_bool(bool* okptr = nullptr) const { return cali_variant_to_bool(m_v, okptr); } - double to_double(bool* okptr = nullptr) const { return cali_variant_to_double(m_v, okptr); } - cali_attr_type to_attr_type(bool* okptr = nullptr) const { return cali_variant_to_type(m_v, okptr); } std::string to_string() const; diff --git a/include/caliper/reader/QueryProcessor.h b/include/caliper/reader/QueryProcessor.h index a9837447..5d2817d6 100644 --- a/include/caliper/reader/QueryProcessor.h +++ b/include/caliper/reader/QueryProcessor.h @@ -6,7 +6,6 @@ #pragma once -#include "QuerySpec.h" #include "RecordProcessor.h" #include @@ -17,6 +16,7 @@ namespace cali class CaliperMetadataAccessInterface; class OutputStream; +class QuerySpec; /// \brief Execute a given query (filter, aggregation, and output formatting) /// on a series of snapshot records. @@ -32,7 +32,6 @@ class QueryProcessor ~QueryProcessor(); void process_record(CaliperMetadataAccessInterface&, const EntryList&); - void flush(CaliperMetadataAccessInterface&); void operator() (CaliperMetadataAccessInterface& db, const EntryList& rec) { process_record(db, rec); } diff --git a/src/caliper/Annotation.cpp b/src/caliper/Annotation.cpp index e0275862..24e0b037 100644 --- a/src/caliper/Annotation.cpp +++ b/src/caliper/Annotation.cpp @@ -6,10 +6,8 @@ #include "caliper/Annotation.h" #include "caliper/Caliper.h" -#include "caliper/cali.h" #include "caliper/common/Log.h" -#include "caliper/common/Variant.h" #include #include diff --git a/src/caliper/AnnotationBinding.cpp b/src/caliper/AnnotationBinding.cpp index f8e707d3..d3d97b17 100644 --- a/src/caliper/AnnotationBinding.cpp +++ b/src/caliper/AnnotationBinding.cpp @@ -10,6 +10,8 @@ #include "caliper/common/Node.h" #include "caliper/common/Log.h" +#include "caliper/common/RuntimeConfig.h" + using namespace cali; @@ -17,7 +19,15 @@ using namespace cali; // --- Static data // -const cali::ConfigSet::Entry AnnotationBinding::s_configdata[] = { +namespace cali +{ +extern Attribute subscription_event_attr; +} + +namespace +{ + +const cali::ConfigSet::Entry annotation_binding_configdata[] = { { "include_regions", CALI_TYPE_STRING, @@ -40,14 +50,6 @@ const cali::ConfigSet::Entry AnnotationBinding::s_configdata[] = { cali::ConfigSet::Terminator }; -namespace cali -{ -extern Attribute subscription_event_attr; -} - -namespace -{ - bool has_marker(const Attribute& attr, const Attribute& marker_attr) { cali_id_t marker_attr_id = marker_attr.id(); @@ -133,11 +135,11 @@ void AnnotationBinding::base_pre_initialize(Caliper* c, Channel* chn) const char* tag = service_tag(); std::string cfgname = std::string(tag) + "_binding"; - m_config = chn->config().init(cfgname.c_str(), s_configdata); + auto cfg = chn->config().init(cfgname.c_str(), ::annotation_binding_configdata); { - std::string i_filter = m_config.get("include_regions").to_string(); - std::string e_filter = m_config.get("exclude_regions").to_string(); + std::string i_filter = cfg.get("include_regions").to_string(); + std::string e_filter = cfg.get("exclude_regions").to_string(); auto p = RegionFilter::from_config(i_filter, e_filter); @@ -148,7 +150,7 @@ void AnnotationBinding::base_pre_initialize(Caliper* c, Channel* chn) } } - m_trigger_attr_names = m_config.get("trigger_attributes").to_stringlist(",:"); + m_trigger_attr_names = cfg.get("trigger_attributes").to_stringlist(",:"); std::string marker_attr_name("cali.binding."); marker_attr_name.append(tag); diff --git a/src/caliper/Blackboard.h b/src/caliper/Blackboard.h index 32ebfc98..b2fa0bea 100644 --- a/src/caliper/Blackboard.h +++ b/src/caliper/Blackboard.h @@ -6,12 +6,7 @@ #ifndef CALI_BLACKBOARD_H #define CALI_BLACKBOARD_H -#include "caliper/common/Attribute.h" #include "caliper/common/Entry.h" -#include "caliper/common/Node.h" -#include "caliper/common/Variant.h" - -#include "caliper/caliper-config.h" #include "../common/util/spinlock.hpp" diff --git a/src/caliper/ConfigManager.cpp b/src/caliper/ConfigManager.cpp index 95b34096..2b3f20af 100644 --- a/src/caliper/ConfigManager.cpp +++ b/src/caliper/ConfigManager.cpp @@ -6,6 +6,7 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" +#include "caliper/common/StringConverter.h" #include "../src/common/util/format_util.h" #include "../src/common/util/parse_util.h" @@ -60,7 +61,7 @@ ChannelController* make_basic_channel_controller( { // Hacky way to handle "output" option if (opts.is_set("output")) { - std::string output = opts.get("output").to_string(); + std::string output = opts.get("output"); config()["CALI_RECORDER_FILENAME"] = output; config()["CALI_REPORT_FILENAME"] = output; @@ -829,7 +830,7 @@ std::vector ConfigManager::Options::enabled_options() const return ret; } -StringConverter ConfigManager::Options::get(const char* option, const char* default_val) const +std::string ConfigManager::Options::get(const char* option, const char* default_val) const { std::string ostr(option); auto it = std::find_if(mP->args.begin(), mP->args.end(), [&ostr](const std::pair& p) { @@ -837,9 +838,9 @@ StringConverter ConfigManager::Options::get(const char* option, const char* defa }); if (it != mP->args.end()) - return StringConverter(it->second); + return it->second; - return StringConverter(default_val); + return std::string(default_val); } std::string ConfigManager::Options::check() const @@ -1378,7 +1379,6 @@ struct ConfigManager::ConfigManagerImpl { ConfigManagerImpl() : builtin_option_specs_list({ - builtin_base_option_specs, #ifdef CALIPER_HAVE_GOTCHA builtin_gotcha_option_specs, #endif @@ -1403,7 +1403,10 @@ struct ConfigManager::ConfigManagerImpl { #ifdef CALIPER_HAVE_UMPIRE builtin_umpire_option_specs, #endif - builtin_kokkos_option_specs +#ifdef CALIPER_HAVE_KOKKOS + builtin_kokkos_option_specs, +#endif + builtin_base_option_specs }) { #ifdef CALIPER_HAVE_PAPI diff --git a/src/caliper/MetadataTree.cpp b/src/caliper/MetadataTree.cpp index 988311a5..e9939ef1 100644 --- a/src/caliper/MetadataTree.cpp +++ b/src/caliper/MetadataTree.cpp @@ -7,11 +7,7 @@ #include "MetadataTree.h" -#include "MemoryPool.h" - #include "caliper/common/Attribute.h" -#include "caliper/common/Node.h" -#include "caliper/common/RuntimeConfig.h" #include "caliper/common/Variant.h" #include "../common/util/spinlock.hpp" diff --git a/src/caliper/MetadataTree.h b/src/caliper/MetadataTree.h index 0e3205e7..e38a7205 100644 --- a/src/caliper/MetadataTree.h +++ b/src/caliper/MetadataTree.h @@ -3,10 +3,8 @@ #pragma once -#include "caliper/common/Attribute.h" #include "caliper/common/Node.h" #include "caliper/common/RuntimeConfig.h" -#include "caliper/common/Variant.h" #include "MemoryPool.h" @@ -16,6 +14,9 @@ namespace cali { +class Attribute; +class Variant; + namespace internal { diff --git a/src/caliper/OutputCommMpi.h b/src/caliper/OutputCommMpi.h index 766d1fce..9f4c8440 100644 --- a/src/caliper/OutputCommMpi.h +++ b/src/caliper/OutputCommMpi.h @@ -9,7 +9,7 @@ #ifndef CALI_OUTPUT_COMM_MPI_H #define CALI_OUTPUT_COMM_MPI_H -#include "../caliper/CustomOutputController.h" +#include "CustomOutputController.h" #include diff --git a/src/caliper/api.cpp b/src/caliper/api.cpp index 1a1e95eb..6ae98253 100644 --- a/src/caliper/api.cpp +++ b/src/caliper/api.cpp @@ -5,10 +5,6 @@ #include "caliper/Caliper.h" -#include "caliper/common/Attribute.h" - -#include "caliper/common/cali_types.h" - cali_id_t cali_class_aggregatable_attr_id = CALI_INV_ID; cali_id_t cali_class_symboladdress_attr_id = CALI_INV_ID; cali_id_t cali_class_memoryaddress_attr_id = CALI_INV_ID; diff --git a/src/caliper/controllers/CudaActivityProfileController.cpp b/src/caliper/controllers/CudaActivityProfileController.cpp index d8457904..ebe28e84 100644 --- a/src/caliper/controllers/CudaActivityProfileController.cpp +++ b/src/caliper/controllers/CudaActivityProfileController.cpp @@ -7,7 +7,6 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" -#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -32,7 +31,7 @@ class CudaActivityProfileController : public cali::ChannelController ) : ChannelController(name, 0, initial_cfg) { - std::string output(opts.get("output", "cuda_profile").to_string()); + std::string output(opts.get("output", "cuda_profile")); if (output != "stdout" && output != "stderr") { auto pos = output.find_last_of('.'); @@ -54,7 +53,7 @@ class CudaActivityProfileController : public cali::ChannelController if (have_adiak) { config()["CALI_SERVICES_ENABLE"].append(",adiak_import"); - config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3").to_string(); + config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3"); } if (use_mpi) { @@ -92,7 +91,7 @@ std::string check_args(const cali::ConfigManager::Options& opts) { // Check if output.format is valid - std::string format = opts.get("output.format", "cali").to_string(); + std::string format = opts.get("output.format", "cali"); std::set allowed_formats = { "cali", "json", "json-split", "hatchet" }; if (allowed_formats.find(format) == allowed_formats.end()) @@ -107,7 +106,7 @@ cali::ChannelController* make_controller( const cali::ConfigManager::Options& opts ) { - std::string format = opts.get("output.format", "cali").to_string(); + std::string format = opts.get("output.format", "cali"); if (format == "hatchet") format = "json-split"; diff --git a/src/caliper/controllers/CudaActivityReportController.cpp b/src/caliper/controllers/CudaActivityReportController.cpp index a2e2455a..8e2c31b5 100644 --- a/src/caliper/controllers/CudaActivityReportController.cpp +++ b/src/caliper/controllers/CudaActivityReportController.cpp @@ -9,6 +9,7 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" +#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -61,8 +62,8 @@ class CudaActivityReportController : public cali::ChannelController if (use_mpi) { config()["CALI_SERVICES_ENABLE"].append(",mpi,mpireport"); - config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append"); config()["CALI_MPIREPORT_WRITE_ON_FINALIZE"] = "false"; config()["CALI_MPIREPORT_LOCAL_CONFIG"] = opts.build_query("local", { { "select", local_select }, { "group by", groupby } }); @@ -72,8 +73,8 @@ class CudaActivityReportController : public cali::ChannelController ); } else { config()["CALI_SERVICES_ENABLE"].append(",report"); - config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_REPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_REPORT_APPEND"] = opts.get("output.append"); config()["CALI_REPORT_CONFIG"] = opts.build_query( "local", { { "select", serial_select }, { "group by", groupby }, { "format", format } } @@ -95,7 +96,7 @@ bool use_mpi(const cali::ConfigManager::Options& opts) bool use_mpi = have_mpireport; if (opts.is_set("aggregate_across_ranks")) - use_mpi = opts.get("aggregate_across_ranks").to_bool(); + use_mpi = StringConverter(opts.get("aggregate_across_ranks")).to_bool(); if (use_mpi && !have_mpireport) { use_mpi = false; diff --git a/src/caliper/controllers/HatchetRegionProfileController.cpp b/src/caliper/controllers/HatchetRegionProfileController.cpp index 650e9265..1660f908 100644 --- a/src/caliper/controllers/HatchetRegionProfileController.cpp +++ b/src/caliper/controllers/HatchetRegionProfileController.cpp @@ -7,7 +7,6 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" -#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -32,7 +31,7 @@ class HatchetRegionProfileController : public cali::ChannelController ) : ChannelController(name, 0, initial_cfg) { - std::string output(opts.get("output", "region_profile").to_string()); + std::string output(opts.get("output", "region_profile")); if (output != "stdout" && output != "stderr") { auto pos = output.find_last_of('.'); @@ -54,7 +53,7 @@ class HatchetRegionProfileController : public cali::ChannelController if (have_adiak) { config()["CALI_SERVICES_ENABLE"].append(",adiak_import"); - config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3").to_string(); + config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3"); } if (use_mpi) { @@ -90,7 +89,7 @@ std::string check_args(const cali::ConfigManager::Options& opts) { // Check if output.format is valid - std::string format = opts.get("output.format", "json-split").to_string(); + std::string format = opts.get("output.format", "json-split"); std::set allowed_formats = { "cali", "json", "json-split", "hatchet" }; if (allowed_formats.find(format) == allowed_formats.end()) @@ -105,7 +104,7 @@ cali::ChannelController* make_controller( const cali::ConfigManager::Options& opts ) { - std::string format = opts.get("output.format", "cali").to_string(); + std::string format = opts.get("output.format", "cali"); if (format == "hatchet") format = "cali"; diff --git a/src/caliper/controllers/HatchetSampleProfileController.cpp b/src/caliper/controllers/HatchetSampleProfileController.cpp index cdae1e5d..f07b5717 100644 --- a/src/caliper/controllers/HatchetSampleProfileController.cpp +++ b/src/caliper/controllers/HatchetSampleProfileController.cpp @@ -7,7 +7,6 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" -#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -32,7 +31,7 @@ class HatchetSampleProfileController : public cali::ChannelController ) : ChannelController(name, 0, initial_cfg) { - std::string freqstr = opts.get("sample.frequency", "200").to_string(); + std::string freqstr = opts.get("sample.frequency", "200"); config()["CALI_SAMPLER_FREQUENCY"] = freqstr; @@ -45,7 +44,7 @@ class HatchetSampleProfileController : public cali::ChannelController select.append(") as time unit sec"); } - std::string output(opts.get("output", "sample_profile").to_string()); + std::string output(opts.get("output", "sample_profile")); if (output != "stdout" && output != "stderr") { auto pos = output.find_last_of('.'); @@ -68,7 +67,7 @@ class HatchetSampleProfileController : public cali::ChannelController if (have_adiak) { config()["CALI_SERVICES_ENABLE"].append(",adiak_import"); - config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3").to_string(); + config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3"); } if (have_pthread) @@ -110,7 +109,7 @@ std::string check_args(const cali::ConfigManager::Options& opts) // Check if output.format is valid // - std::string format = opts.get("output.format", "json-split").to_string(); + std::string format = opts.get("output.format", "json-split"); std::set allowed_formats = { "cali", "json", "json-split" }; if (allowed_formats.find(format) == allowed_formats.end()) @@ -125,7 +124,7 @@ cali::ChannelController* make_controller( const cali::ConfigManager::Options& opts ) { - std::string format = opts.get("output.format", "cali").to_string(); + std::string format = opts.get("output.format", "cali"); if (format == "hatchet") format = "cali"; diff --git a/src/caliper/controllers/LoopReportController.cpp b/src/caliper/controllers/LoopReportController.cpp index 2e527b22..c8031227 100644 --- a/src/caliper/controllers/LoopReportController.cpp +++ b/src/caliper/controllers/LoopReportController.cpp @@ -185,7 +185,7 @@ class LoopReportController : public cali::internal::CustomOutputController int nblocks = 20; if (m_opts.is_set("timeseries.maxrows")) - nblocks = m_opts.get("timeseries.maxrows").to_int(); + nblocks = StringConverter(m_opts.get("timeseries.maxrows")).to_int(); if (nblocks <= 0) nblocks = rec_count; @@ -211,7 +211,7 @@ class LoopReportController : public cali::internal::CustomOutputController OutputStream create_stream() { - std::string output = m_opts.get("output", "stdout").to_string(); + std::string output = m_opts.get("output", "stdout"); Caliper c; OutputStream stream; @@ -241,7 +241,7 @@ class LoopReportController : public cali::internal::CustomOutputController bool print_summary = true; if (m_opts.is_set("summary")) - print_summary = m_opts.get("summary").to_bool(); + print_summary = StringConverter(m_opts.get("summary")).to_bool(); if (print_summary) { *os << "\nLoop summary:\n------------\n\n"; @@ -254,7 +254,7 @@ class LoopReportController : public cali::internal::CustomOutputController bool print_timeseries = true; if (m_opts.is_set("timeseries")) - print_timeseries = m_opts.get("timeseries").to_bool(); + print_timeseries = StringConverter(m_opts.get("timeseries")).to_bool(); if (print_timeseries) { std::vector infovec; @@ -279,14 +279,14 @@ class LoopReportController : public cali::internal::CustomOutputController : cali::internal::CustomOutputController(name, 0, initial_cfg), m_opts(opts) { if (opts.is_set("iteration_interval")) - config()["CALI_LOOP_MONITOR_ITERATION_INTERVAL"] = opts.get("iteration_interval").to_string(); + config()["CALI_LOOP_MONITOR_ITERATION_INTERVAL"] = opts.get("iteration_interval"); else if (opts.is_set("time_interval")) - config()["CALI_LOOP_MONITOR_TIME_INTERVAL"] = opts.get("time_interval").to_string(); + config()["CALI_LOOP_MONITOR_TIME_INTERVAL"] = opts.get("time_interval"); else config()["CALI_LOOP_MONITOR_TIME_INTERVAL"] = "0.5"; if (opts.is_set("target_loops")) - config()["CALI_LOOP_MONITOR_TARGET_LOOPS"] = opts.get("target_loops").to_string(); + config()["CALI_LOOP_MONITOR_TARGET_LOOPS"] = opts.get("target_loops"); opts.update_channel_config(config()); opts.update_channel_metadata(metadata()); diff --git a/src/caliper/controllers/OpenMPReportController.cpp b/src/caliper/controllers/OpenMPReportController.cpp index bd64ebe4..00333030 100644 --- a/src/caliper/controllers/OpenMPReportController.cpp +++ b/src/caliper/controllers/OpenMPReportController.cpp @@ -7,6 +7,7 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" +#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -78,7 +79,7 @@ class OpenMPReportController : public cali::ChannelController if (use_mpi) { config()["CALI_SERVICES_ENABLE"].append(",mpi,mpireport"); - config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr").to_string(); + config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr"); config()["CALI_MPIREPORT_WRITE_ON_FINALIZE"] = "false"; config()["CALI_MPIREPORT_LOCAL_CONFIG"] = opts.build_query("local", { { "let", let }, { "select", local_select }, { "group by", groupby } }); @@ -88,7 +89,7 @@ class OpenMPReportController : public cali::ChannelController ); } else { config()["CALI_SERVICES_ENABLE"].append(",report"); - config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr").to_string(); + config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr"); config()["CALI_REPORT_CONFIG"] = opts.build_query( "local", { { "let", let }, { "select", serial_select }, { "group by", groupby }, { "format", format } } @@ -110,7 +111,7 @@ bool use_mpi(const cali::ConfigManager::Options& opts) bool use_mpi = have_mpireport; if (opts.is_set("aggregate_across_ranks")) - use_mpi = opts.get("aggregate_across_ranks").to_bool(); + use_mpi = StringConverter(opts.get("aggregate_across_ranks")).to_bool(); if (use_mpi && !have_mpireport) { use_mpi = false; diff --git a/src/caliper/controllers/ROCmActivityProfileController.cpp b/src/caliper/controllers/ROCmActivityProfileController.cpp index a3772f71..e2e8469f 100644 --- a/src/caliper/controllers/ROCmActivityProfileController.cpp +++ b/src/caliper/controllers/ROCmActivityProfileController.cpp @@ -7,7 +7,6 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" -#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -32,7 +31,7 @@ class RocmActivityProfileController : public cali::ChannelController ) : ChannelController(name, 0, initial_cfg) { - std::string output(opts.get("output", "rocm_profile").to_string()); + std::string output(opts.get("output", "rocm_profile")); if (output != "stdout" && output != "stderr") { auto pos = output.find_last_of('.'); @@ -54,7 +53,7 @@ class RocmActivityProfileController : public cali::ChannelController if (have_adiak) { config()["CALI_SERVICES_ENABLE"].append(",adiak_import"); - config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3").to_string(); + config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3"); } if (use_mpi) { @@ -92,7 +91,7 @@ std::string check_args(const cali::ConfigManager::Options& opts) { // Check if output.format is valid - std::string format = opts.get("output.format", "cali").to_string(); + std::string format = opts.get("output.format", "cali"); std::set allowed_formats = { "cali", "json", "json-split", "hatchet" }; if (allowed_formats.find(format) == allowed_formats.end()) @@ -107,7 +106,7 @@ cali::ChannelController* make_controller( const cali::ConfigManager::Options& opts ) { - std::string format = opts.get("output.format", "cali").to_string(); + std::string format = opts.get("output.format", "cali"); if (format == "hatchet") format = "json-split"; diff --git a/src/caliper/controllers/ROCmActivityReportController.cpp b/src/caliper/controllers/ROCmActivityReportController.cpp index 554c2ab9..b6f873a4 100644 --- a/src/caliper/controllers/ROCmActivityReportController.cpp +++ b/src/caliper/controllers/ROCmActivityReportController.cpp @@ -9,6 +9,7 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" +#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -61,8 +62,8 @@ class RocmActivityReportController : public cali::ChannelController if (use_mpi) { config()["CALI_SERVICES_ENABLE"].append(",mpi,mpireport"); - config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append"); config()["CALI_MPIREPORT_WRITE_ON_FINALIZE"] = "false"; config()["CALI_MPIREPORT_LOCAL_CONFIG"] = opts.build_query("local", { { "select", local_select }, { "group by", groupby } }); @@ -72,8 +73,8 @@ class RocmActivityReportController : public cali::ChannelController ); } else { config()["CALI_SERVICES_ENABLE"].append(",report"); - config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_REPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_REPORT_APPEND"] = opts.get("output.append"); config()["CALI_REPORT_CONFIG"] = opts.build_query( "local", { { "select", serial_select }, { "group by", groupby }, { "format", format } } @@ -95,7 +96,7 @@ bool use_mpi(const cali::ConfigManager::Options& opts) bool use_mpi = have_mpireport; if (opts.is_set("aggregate_across_ranks")) - use_mpi = opts.get("aggregate_across_ranks").to_bool(); + use_mpi = StringConverter(opts.get("aggregate_across_ranks")).to_bool(); if (use_mpi && !have_mpireport) { use_mpi = false; diff --git a/src/caliper/controllers/RuntimeReportController.cpp b/src/caliper/controllers/RuntimeReportController.cpp index 7efda475..bd34f2d9 100644 --- a/src/caliper/controllers/RuntimeReportController.cpp +++ b/src/caliper/controllers/RuntimeReportController.cpp @@ -9,6 +9,7 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" +#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -60,8 +61,8 @@ class RuntimeReportController : public cali::ChannelController if (use_mpi) { config()["CALI_SERVICES_ENABLE"].append(",mpi,mpireport"); - config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append"); config()["CALI_MPIREPORT_WRITE_ON_FINALIZE"] = "false"; config()["CALI_MPIREPORT_LOCAL_CONFIG"] = opts.build_query("local", { { "let", local_let }, { "select", local_select }, { "group by", "path" } }); @@ -69,8 +70,8 @@ class RuntimeReportController : public cali::ChannelController opts.build_query("cross", { { "select", cross_select }, { "group by", "path" }, { "format", format } }); } else { config()["CALI_SERVICES_ENABLE"].append(",report"); - config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_REPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_REPORT_APPEND"] = opts.get("output.append"); config()["CALI_REPORT_CONFIG"] = opts.build_query( "local", { { "let", local_let }, { "select", serial_select }, { "group by", "path" }, { "format", format } } @@ -92,7 +93,7 @@ bool use_mpi(const cali::ConfigManager::Options& opts) bool use_mpi = have_mpireport; if (opts.is_set("aggregate_across_ranks")) - use_mpi = opts.get("aggregate_across_ranks").to_bool(); + use_mpi = StringConverter(opts.get("aggregate_across_ranks")).to_bool(); if (use_mpi && !have_mpireport) { use_mpi = false; diff --git a/src/caliper/controllers/SampleReportController.cpp b/src/caliper/controllers/SampleReportController.cpp index e089c3b3..b0045721 100644 --- a/src/caliper/controllers/SampleReportController.cpp +++ b/src/caliper/controllers/SampleReportController.cpp @@ -9,6 +9,7 @@ #include "caliper/ConfigManager.h" #include "caliper/common/Log.h" +#include "caliper/common/StringConverter.h" #include "../../services/Services.h" @@ -31,7 +32,7 @@ class SampleReportController : public cali::ChannelController ) : ChannelController(name, 0, initial_cfg) { - double freq = std::max(1.0, std::stod(opts.get("sample.frequency", "200").to_string())); + double freq = std::max(1.0, std::stod(opts.get("sample.frequency", "200"))); config()["CALI_SAMPLER_FREQUENCY"] = std::to_string(freq); @@ -67,8 +68,8 @@ class SampleReportController : public cali::ChannelController if (use_mpi) { config()["CALI_SERVICES_ENABLE"].append(",mpi,mpireport"); - config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_MPIREPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_MPIREPORT_APPEND"] = opts.get("output.append"); config()["CALI_MPIREPORT_WRITE_ON_FINALIZE"] = "false"; config()["CALI_MPIREPORT_LOCAL_CONFIG"] = opts.build_query("local", { { "select", local_select }, { "group by", groupby } }); @@ -78,8 +79,8 @@ class SampleReportController : public cali::ChannelController ); } else { config()["CALI_SERVICES_ENABLE"].append(",report"); - config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr").to_string(); - config()["CALI_REPORT_APPEND"] = opts.get("output.append").to_string(); + config()["CALI_REPORT_FILENAME"] = opts.get("output", "stderr"); + config()["CALI_REPORT_APPEND"] = opts.get("output.append"); config()["CALI_REPORT_CONFIG"] = opts.build_query( "local", { { "select", local_select }, { "group by", groupby }, { "format", format } } @@ -101,7 +102,7 @@ bool use_mpi(const cali::ConfigManager::Options& opts) bool use_mpi = have_mpireport; if (opts.is_set("aggregate_across_ranks")) - use_mpi = opts.get("aggregate_across_ranks").to_bool(); + use_mpi = StringConverter(opts.get("aggregate_across_ranks")).to_bool(); if (use_mpi && !have_mpireport) { use_mpi = false; diff --git a/src/caliper/controllers/SpotController.cpp b/src/caliper/controllers/SpotController.cpp index bc4f5bef..5b71ebb5 100644 --- a/src/caliper/controllers/SpotController.cpp +++ b/src/caliper/controllers/SpotController.cpp @@ -80,7 +80,7 @@ void convert_timeseries_option(const ConfigManager::Options& opts, const char* t target.append(ts_opt_name); target.append("="); - target.append(opts.get(spot_opt_name.c_str()).to_string()); + target.append(opts.get(spot_opt_name.c_str())); } } @@ -92,7 +92,7 @@ std::string get_timeseries_config_string(const ConfigManager::Options& opts) std::string tsopts; if (opts.is_set("timeseries.metrics")) - tsopts.append(opts.get("timeseries.metrics").to_string()); + tsopts.append(opts.get("timeseries.metrics")); convert_timeseries_option(opts, "iteration_interval", tsopts); convert_timeseries_option(opts, "time_interval", tsopts); @@ -206,14 +206,14 @@ class SpotTimeseriesController : public cali::ChannelController : ChannelController(name, 0, initial_cfg), m_opts(opts) { if (m_opts.is_set("iteration_interval")) - config()["CALI_LOOP_MONITOR_ITERATION_INTERVAL"] = m_opts.get("iteration_interval").to_string(); + config()["CALI_LOOP_MONITOR_ITERATION_INTERVAL"] = m_opts.get("iteration_interval"); else if (m_opts.is_set("time_interval")) - config()["CALI_LOOP_MONITOR_TIME_INTERVAL"] = m_opts.get("time_interval").to_string(); + config()["CALI_LOOP_MONITOR_TIME_INTERVAL"] = m_opts.get("time_interval"); else config()["CALI_LOOP_MONITOR_TIME_INTERVAL"] = "0.5"; if (m_opts.is_set("target_loops")) - config()["CALI_LOOP_MONITOR_TARGET_LOOPS"] = m_opts.get("target_loops").to_string(); + config()["CALI_LOOP_MONITOR_TARGET_LOOPS"] = m_opts.get("target_loops"); m_opts.update_channel_config(config()); } @@ -295,7 +295,7 @@ class SpotController : public cali::internal::CustomOutputController int nblocks = 20; if (m_opts.is_set("timeseries.maxrows")) - nblocks = m_opts.get("timeseries.maxrows").to_int(); + nblocks = StringConverter(m_opts.get("timeseries.maxrows")).to_int(); if (nblocks <= 0) nblocks = rec_count; @@ -469,8 +469,8 @@ class SpotController : public cali::internal::CustomOutputController OutputStream create_output_stream() { - std::string outdir = m_opts.get("outdir", "").to_string(); - std::string output = m_opts.get("output", "").to_string(); + std::string outdir = m_opts.get("outdir"); + std::string output = m_opts.get("output"); if (output.empty()) output = cali::util::create_filename(); @@ -517,7 +517,7 @@ class SpotController : public cali::internal::CustomOutputController #ifdef CALIPER_HAVE_ADIAK config()["CALI_SERVICES_ENABLE"].append(",adiak_import"); - config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3").to_string(); + config()["CALI_ADIAK_IMPORT_CATEGORIES"] = opts.get("adiak.import_categories", "2,3"); #endif if (opts.is_enabled("timeseries")) { diff --git a/src/caliper/controllers/util.cpp b/src/caliper/controllers/util.cpp index 900886d9..b5acc98a 100644 --- a/src/caliper/controllers/util.cpp +++ b/src/caliper/controllers/util.cpp @@ -14,7 +14,7 @@ std::string util::build_tree_format_spec(config_map_t& config, const ConfigManag std::string format = initial; if (opts.is_set("max_column_width")) - format.append("column-width=").append(opts.get("max_column_width").to_string()); + format.append("column-width=").append(opts.get("max_column_width")); if (opts.is_enabled("print.metadata")) { auto avail_services = services::get_available_services(); bool have_adiak = diff --git a/src/caliper/test/test_configmanager.cpp b/src/caliper/test/test_configmanager.cpp index 3ad0701b..e9e46f8f 100644 --- a/src/caliper/test/test_configmanager.cpp +++ b/src/caliper/test/test_configmanager.cpp @@ -132,7 +132,7 @@ class TestController : public cali::ChannelController public: - std::string get_opt(const char* name) { return opts.get(name).to_string(); } + std::string get_opt(const char* name) { return opts.get(name); } bool is_set(const char* name) { return opts.is_set(name); } diff --git a/src/common/CompressedSnapshotRecord.cpp b/src/common/CompressedSnapshotRecord.cpp index 0a91bbb0..4d010582 100644 --- a/src/common/CompressedSnapshotRecord.cpp +++ b/src/common/CompressedSnapshotRecord.cpp @@ -9,7 +9,6 @@ #include "util/vlenc.h" #include "caliper/common/CaliperMetadataAccessInterface.h" -#include "caliper/common/Entry.h" #include "caliper/common/Node.h" #include diff --git a/src/common/CompressedSnapshotRecord.h b/src/common/CompressedSnapshotRecord.h index 4d448daa..5dd85303 100644 --- a/src/common/CompressedSnapshotRecord.h +++ b/src/common/CompressedSnapshotRecord.h @@ -7,7 +7,6 @@ #pragma once #include "caliper/common/Entry.h" -#include "caliper/common/Variant.h" #include diff --git a/src/reader/Aggregator.cpp b/src/reader/Aggregator.cpp index 1ebc79cd..04ea6ca5 100644 --- a/src/reader/Aggregator.cpp +++ b/src/reader/Aggregator.cpp @@ -12,8 +12,6 @@ #include "caliper/common/Log.h" #include "caliper/common/Node.h" -#include "caliper/common/cali_types.h" - #include "../common/util/vlenc.h" #include diff --git a/src/services/Services.cpp b/src/services/Services.cpp index 1f73fe88..0ee6836e 100644 --- a/src/services/Services.cpp +++ b/src/services/Services.cpp @@ -9,8 +9,6 @@ #include "caliper/CaliperService.h" #include "caliper/common/Log.h" -#include "caliper/common/RuntimeConfig.h" -#include "caliper/common/StringConverter.h" #include #include