Changed style of some headers (#3898)
This commit is contained in:
parent
07f95e37b1
commit
7ea2d668ad
|
|
@ -37,107 +37,103 @@ namespace ngraph
|
|||
{
|
||||
namespace event
|
||||
{
|
||||
class Duration;
|
||||
class Object;
|
||||
class Manager;
|
||||
//
|
||||
// This class records timestamps for a given user defined event and
|
||||
// produces output in the chrome tracing format that can be used to view
|
||||
// the events of a running program
|
||||
//
|
||||
// Following is the format of a trace event
|
||||
//
|
||||
// {
|
||||
// "name": "myName",
|
||||
// "cat": "category,list",
|
||||
// "ph": "B",
|
||||
// "ts": 12345,
|
||||
// "pid": 123,
|
||||
// "tid": 456,
|
||||
// "args": {
|
||||
// "someArg": 1,
|
||||
// "anotherArg": {
|
||||
// "value": "my value"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// The trace file format is defined here:
|
||||
// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
||||
//
|
||||
// The trace file can be viewed by Chrome browser using the
|
||||
// URL: chrome://tracing/
|
||||
//
|
||||
// More information about this is at:
|
||||
// http://dev.chromium.org/developers/how-tos/trace-event-profiling-tool
|
||||
|
||||
class Manager
|
||||
{
|
||||
friend class Duration;
|
||||
friend class Object;
|
||||
|
||||
public:
|
||||
static void open(const std::string& path = "runtime_event_trace.json");
|
||||
static void close();
|
||||
static bool is_tracing_enabled() { return s_tracing_enabled; }
|
||||
static void enable_event_tracing();
|
||||
static void disable_event_tracing();
|
||||
static bool is_event_tracing_enabled();
|
||||
|
||||
private:
|
||||
static std::ofstream& get_output_stream();
|
||||
static const std::string& get_process_id();
|
||||
static size_t get_current_microseconds()
|
||||
{
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch().count() / 1000;
|
||||
}
|
||||
static std::string get_thread_id();
|
||||
static std::mutex& get_mutex() { return s_file_mutex; }
|
||||
static std::ostream s_ostream;
|
||||
static std::mutex s_file_mutex;
|
||||
static bool s_tracing_enabled;
|
||||
};
|
||||
|
||||
class NGRAPH_API Duration
|
||||
{
|
||||
public:
|
||||
explicit Duration(const std::string& name,
|
||||
const std::string& category,
|
||||
const std::string& args = "");
|
||||
~Duration() { write(); }
|
||||
/// \brief stop the timer without writing the data to the log file. To write the data
|
||||
/// call the `write` method
|
||||
/// Calls to stop() are optional
|
||||
void stop();
|
||||
|
||||
/// \brief write the log data to the log file for this event
|
||||
/// This funtion has an implicit stop() if stop() has not been previously called
|
||||
void write();
|
||||
|
||||
Duration(const Duration&) = delete;
|
||||
Duration& operator=(Duration const&) = delete;
|
||||
|
||||
private:
|
||||
std::string to_json() const;
|
||||
size_t m_start{0};
|
||||
size_t m_stop{0};
|
||||
std::string m_name;
|
||||
std::string m_category;
|
||||
std::string m_args;
|
||||
};
|
||||
|
||||
class Object
|
||||
{
|
||||
public:
|
||||
Object(const std::string& name, const std::string& args);
|
||||
void snapshot(const std::string& args);
|
||||
void destroy();
|
||||
|
||||
private:
|
||||
void write_snapshot(std::ostream& out, const std::string& args);
|
||||
const std::string m_name;
|
||||
size_t m_id{0};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This class records timestamps for a given user defined event and
|
||||
// produces output in the chrome tracing format that can be used to view
|
||||
// the events of a running program
|
||||
//
|
||||
// Following is the format of a trace event
|
||||
//
|
||||
// {
|
||||
// "name": "myName",
|
||||
// "cat": "category,list",
|
||||
// "ph": "B",
|
||||
// "ts": 12345,
|
||||
// "pid": 123,
|
||||
// "tid": 456,
|
||||
// "args": {
|
||||
// "someArg": 1,
|
||||
// "anotherArg": {
|
||||
// "value": "my value"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// The trace file format is defined here:
|
||||
// https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview
|
||||
//
|
||||
// The trace file can be viewed by Chrome browser using the
|
||||
// URL: chrome://tracing/
|
||||
//
|
||||
// More information about this is at:
|
||||
// http://dev.chromium.org/developers/how-tos/trace-event-profiling-tool
|
||||
|
||||
class ngraph::event::Manager
|
||||
{
|
||||
friend class Duration;
|
||||
friend class Object;
|
||||
|
||||
public:
|
||||
static void open(const std::string& path = "runtime_event_trace.json");
|
||||
static void close();
|
||||
static bool is_tracing_enabled() { return s_tracing_enabled; }
|
||||
static void enable_event_tracing();
|
||||
static void disable_event_tracing();
|
||||
static bool is_event_tracing_enabled();
|
||||
|
||||
private:
|
||||
static std::ofstream& get_output_stream();
|
||||
static const std::string& get_process_id();
|
||||
static size_t get_current_microseconds()
|
||||
{
|
||||
return std::chrono::high_resolution_clock::now().time_since_epoch().count() / 1000;
|
||||
}
|
||||
static std::string get_thread_id();
|
||||
static std::mutex& get_mutex() { return s_file_mutex; }
|
||||
static std::ostream s_ostream;
|
||||
static std::mutex s_file_mutex;
|
||||
static bool s_tracing_enabled;
|
||||
};
|
||||
|
||||
class NGRAPH_API ngraph::event::Duration
|
||||
{
|
||||
public:
|
||||
explicit Duration(const std::string& name,
|
||||
const std::string& category,
|
||||
const std::string& args = "");
|
||||
~Duration() { write(); }
|
||||
/// \brief stop the timer without writing the data to the log file. To write the data
|
||||
/// call the `write` method
|
||||
/// Calls to stop() are optional
|
||||
void stop();
|
||||
|
||||
/// \brief write the log data to the log file for this event
|
||||
/// This funtion has an implicit stop() if stop() has not been previously called
|
||||
void write();
|
||||
|
||||
Duration(const Duration&) = delete;
|
||||
Duration& operator=(Duration const&) = delete;
|
||||
|
||||
private:
|
||||
std::string to_json() const;
|
||||
size_t m_start{0};
|
||||
size_t m_stop{0};
|
||||
std::string m_name;
|
||||
std::string m_category;
|
||||
std::string m_args;
|
||||
};
|
||||
|
||||
class ngraph::event::Object
|
||||
{
|
||||
public:
|
||||
Object(const std::string& name, const std::string& args);
|
||||
void snapshot(const std::string& args);
|
||||
void destroy();
|
||||
|
||||
private:
|
||||
void write_snapshot(std::ostream& out, const std::string& args);
|
||||
const std::string m_name;
|
||||
size_t m_id{0};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -13,43 +13,47 @@ namespace ngraph
|
|||
{
|
||||
namespace pass
|
||||
{
|
||||
class NGRAPH_API LowLatency;
|
||||
/**
|
||||
* @brief The transformation finds all TensorIterator layers in the network, processes all
|
||||
* back
|
||||
* edges that describe a connection between Result and Parameter of the TensorIterator body,
|
||||
* and inserts ReadValue layer between Parameter and the next layers after this Parameter,
|
||||
* and Assign layer after the layers before the Result layer.
|
||||
* Supported platforms: CPU, GNA.
|
||||
*
|
||||
* The example below describes the changes to the inner part (body, back edges) of the
|
||||
* Tensor
|
||||
* Iterator layer.
|
||||
* [] - TensorIterator body
|
||||
* () - new layer
|
||||
*
|
||||
* before applying the transformation:
|
||||
* back_edge_1 -> [Parameter -> some layers ... -> Result ] -> back_edge_1
|
||||
*
|
||||
* after applying the transformation:
|
||||
* back_edge_1 -> [Parameter -> (ReadValue layer) -> some layers ... -> (Assign layer) ]
|
||||
* \
|
||||
* -> Result ] -> back_edge_1
|
||||
*
|
||||
* It is recommended to use this transformation in conjunction with the Reshape feature to
|
||||
* set
|
||||
* sequence dimension to 1 and with the UnrollTensorIterator transformation.
|
||||
* For convenience, we have already enabled the unconditional execution of the
|
||||
* UnrollTensorIterator
|
||||
* transformation when using the LowLatency transformation for CPU, GNA plugins, no action
|
||||
* is
|
||||
* required here.
|
||||
* After applying both of these transformations, the resulting network can be inferred step
|
||||
* by
|
||||
* step, the states will store between inferences.
|
||||
*
|
||||
*/
|
||||
|
||||
class NGRAPH_API LowLatency : public ngraph::pass::MatcherPass
|
||||
{
|
||||
public:
|
||||
NGRAPH_RTTI_DECLARATION;
|
||||
LowLatency();
|
||||
};
|
||||
} // namespace pass
|
||||
} // namespace ngraph
|
||||
|
||||
/**
|
||||
* @brief The transformation finds all TensorIterator layers in the network, processes all back
|
||||
* edges that describe a connection between Result and Parameter of the TensorIterator body,
|
||||
* and inserts ReadValue layer between Parameter and the next layers after this Parameter,
|
||||
* and Assign layer after the layers before the Result layer.
|
||||
* Supported platforms: CPU, GNA.
|
||||
*
|
||||
* The example below describes the changes to the inner part (body, back edges) of the Tensor
|
||||
* Iterator layer.
|
||||
* [] - TensorIterator body
|
||||
* () - new layer
|
||||
*
|
||||
* before applying the transformation:
|
||||
* back_edge_1 -> [Parameter -> some layers ... -> Result ] -> back_edge_1
|
||||
*
|
||||
* after applying the transformation:
|
||||
* back_edge_1 -> [Parameter -> (ReadValue layer) -> some layers ... -> (Assign layer) ]
|
||||
* \
|
||||
* -> Result ] -> back_edge_1
|
||||
*
|
||||
* It is recommended to use this transformation in conjunction with the Reshape feature to set
|
||||
* sequence dimension to 1 and with the UnrollTensorIterator transformation.
|
||||
* For convenience, we have already enabled the unconditional execution of the UnrollTensorIterator
|
||||
* transformation when using the LowLatency transformation for CPU, GNA plugins, no action is
|
||||
* required here.
|
||||
* After applying both of these transformations, the resulting network can be inferred step by
|
||||
* step, the states will store between inferences.
|
||||
*
|
||||
*/
|
||||
|
||||
class ngraph::pass::LowLatency : public ngraph::pass::MatcherPass
|
||||
{
|
||||
public:
|
||||
NGRAPH_RTTI_DECLARATION;
|
||||
LowLatency();
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue