-
Notifications
You must be signed in to change notification settings - Fork 1
parallel draw_pictures #564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -5,12 +5,22 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| namespace sim { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| void MetricsTable::draw_pictures(std::filesystem::path output_dir) const { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto& [metric_id, storage] : *this) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::filesystem::path plot_path = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output_dir / fmt::format("{}.svg", metric_id.name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storage->draw_plot( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| plot_path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| PlotMetadata{"Time, ns", metric_id.unit_name, metric_id.name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #pragma omp parallel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #pragma omp single | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (const auto& [metric_id, storage] : *this) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| std::filesystem::path plot_path = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output_dir / fmt::format("{}.svg", metric_id.name); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #pragma omp task firstprivate(metric_id, storage, plot_path) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| storage->draw_plot( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| plot_path, PlotMetadata{"Time, ns", metric_id.unit_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| metric_id.name}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #pragma omp taskwait | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+8
to
+23
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Даже посрпшивав нейроку, я только крайне относительно понял, как и что здесь работает:) Схема жесть перегруженная, и я бы советовал уменьшить количество приседаний для достижения в общем-то простой цели (распараллелить форик по unordered map). Да, OpenMP не умеет из коробки вот так просто в одну прагму параллелить такое, но зато умеет это делать с обычными фориками, где мы идем счетчиком, а не итератором:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,5 +1,7 @@ | ||||
| #include "connections_summary.hpp" | ||||
|
|
||||
| #include <omp.h> | ||||
|
|
||||
|
Comment on lines
+3
to
+4
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Выглядит лишним
Suggested change
|
||||
| #include "utils/filesystem.hpp" | ||||
|
|
||||
| namespace sim { | ||||
|
|
||||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,5 +1,7 @@ | ||||
| #include "network.hpp" | ||||
|
|
||||
| #include <omp.h> | ||||
|
|
||||
|
Comment on lines
+3
to
+4
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сейм
Suggested change
|
||||
| #include "connection/connections_summary/connections_summary.hpp" | ||||
| #include "metrics/metrics_table/combine_metrics_tables.hpp" | ||||
|
|
||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ты не доделал задачу. Классно, что распараллелились картинки, но еще остаются тектовые метрики. С ними немного сложно и неочевидно, но разобраться реально. Есть еще два основных файла, где нужны правки:
algnet/source/metrics/metrics_table/combine_metrics_tables.hpp
Line 29 in 8720cfd
algnet/source/network/network.cpp
Line 20 in 8720cfd