Files
rocm-systems/source/lib/omnitrace/library/causal/components/progress_point.hpp
T
Jonathan R. Madsen e7d3125459 restructure libomnitrace + tasking and omnitrace-causal updates (#237)
* restructured libomnitrace

- this is necessary to incorporate some of the binary analysis capabilities into omnitrace exe
- created libomnitrace-core (static)
- created libomnitrace-binary (static)
- created libomnitrace (static)
- omnitrace-avail links to libomnitrace.a
- omnitrace-critical-trace links to libomnitrace.a
- tweaked the testing
  - reduced verbosity on some of MPI tests
  - excluded trace-time-window from tests on Ubuntu 18.04
  - reduced causal e2e iterations
- minor tweak to tasking
  - manually create `PTL::UserTaskQueue` instance instead of relying on `PTL::ThreadPool` to create it

* Update formatting workflow

- source formatting uses ubuntu-22.04
- check-includes doesn't generate false positive for 'include "timemory.hpp"'

* omnitrace-causal --generate-configs

- fix config generation in omnitrace causal
- add test for omnitrace-causal + generating configs

* Fix omnitrace-object-library build

- accidentally included rocm sources in non-rocm builds

* Fix rocm compilation w/o rocprofiler

* update timemory submodule with mpi_get warning messages

* sampling offload file updates

- more verbose messages
- disable offload before stopping

* testing updates

- increase causal e2e iterations to 12
- increase lock_environment verbose to 2 (for sampling offload messages)
- fix return for omnitrace_add_validation_test
2023-02-04 10:59:50 -06:00

158 righe
5.2 KiB
C++

// MIT License
//
// Copyright (c) 2022 Advanced Micro Devices, Inc. All Rights Reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#pragma once
#include "core/common.hpp"
#include "core/components/fwd.hpp"
#include "core/defines.hpp"
#include <timemory/components/base.hpp>
#include <timemory/hash/types.hpp>
#include <timemory/mpl/concepts.hpp>
#include <timemory/mpl/type_traits.hpp>
#include <timemory/tpls/cereal/cereal.hpp>
#include <timemory/utility/types.hpp>
#include <cstdint>
#include <unordered_map>
namespace omnitrace
{
namespace causal
{
namespace component
{
struct progress_point : comp::base<progress_point, void>
{
using base_type = comp::base<progress_point, void>;
using value_type = int64_t;
using hash_type = tim::hash_value_t;
using iterator_type = progress_point*;
static std::string label();
static std::string description();
OMNITRACE_DEFAULT_OBJECT(progress_point)
void start();
void stop();
void mark();
void set_value(int64_t);
progress_point& operator+=(const progress_point&);
progress_point& operator-=(const progress_point&);
bool is_throughput_point() const;
bool is_latency_point() const;
void print(std::ostream& os) const;
void set_hash(hash_type _v) { m_hash = _v; }
void set_iterator(iterator_type _v) { m_iterator = _v; }
auto get_iterator() const { return m_iterator; }
auto get_hash() const { return m_hash; }
int64_t get_delta() const;
int64_t get_arrival() const;
int64_t get_departure() const;
int64_t get_latency_delta() const;
int64_t get_laps() const;
template <typename ArchiveT>
void load(ArchiveT& ar, const unsigned)
{
namespace cereal = ::tim::cereal;
auto _name = std::string{};
ar(cereal::make_nvp("name", _name));
ar(cereal::make_nvp("delta", m_delta));
ar(cereal::make_nvp("arrival", m_arrival));
ar(cereal::make_nvp("departure", m_departure));
m_hash = tim::hash::add_hash_id(_name);
}
template <typename ArchiveT>
void save(ArchiveT& ar, const unsigned) const
{
namespace cereal = ::tim::cereal;
ar(cereal::make_nvp("hash", m_hash));
ar(cereal::make_nvp("name", std::string{ tim::get_hash_identifier(m_hash) }));
ar(cereal::make_nvp("delta", m_delta));
ar(cereal::make_nvp("arrival", m_arrival));
ar(cereal::make_nvp("departure", m_departure));
}
static std::unordered_map<tim::hash_value_t, progress_point> get_progress_points();
private:
hash_type m_hash = 0;
int64_t m_delta = 0;
int64_t m_arrival = 0;
int64_t m_departure = 0;
progress_point* m_iterator = nullptr;
};
} // namespace component
} // namespace causal
} // namespace omnitrace
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_storage, causal::component::progress_point,
false_type)
OMNITRACE_DEFINE_CONCRETE_TRAIT(flat_storage, causal::component::progress_point,
true_type)
OMNITRACE_DEFINE_CONCRETE_TRAIT(uses_timing_units, causal::component::progress_point,
true_type)
OMNITRACE_DEFINE_CONCRETE_TRAIT(is_timing_category, causal::component::progress_point,
true_type)
namespace tim
{
namespace operation
{
template <>
struct push_node<omnitrace::causal::component::progress_point>
{
using type = omnitrace::causal::component::progress_point;
OMNITRACE_DEFAULT_OBJECT(push_node)
push_node(type& _obj, scope::config _scope, hash_value_t _hash,
int64_t _tid = threading::get_id())
{
(*this)(_obj, _scope, _hash, _tid);
}
void operator()(type& _obj, scope::config, hash_value_t _hash,
int64_t _tid = threading::get_id()) const;
};
template <>
struct pop_node<omnitrace::causal::component::progress_point>
{
using type = omnitrace::causal::component::progress_point;
OMNITRACE_DEFAULT_OBJECT(pop_node)
pop_node(type& _obj, int64_t _tid = threading::get_id()) { (*this)(_obj, _tid); }
void operator()(type& _obj, int64_t _tid = threading::get_id()) const;
};
} // namespace operation
} // namespace tim