scope-profiler 0.6.4__tar.gz → 0.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/CMakeLists.txt +1 -1
- {scope_profiler-0.6.4/src/scope_profiler.egg-info → scope_profiler-0.7.0}/PKG-INFO +67 -4
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/README.md +65 -2
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/pyproject.toml +2 -2
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/__init__.py +35 -1
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/__main__.py +91 -23
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/h5reader.py +9 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/h5writer.py +21 -1
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/json_export.py +3 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/profile_manager.py +590 -27
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/region.py +16 -1
- scope_profiler-0.7.0/src/scope_profiler/tests/conftest.py +13 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_api_shortcuts.py +309 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_app.py +3 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_json_export.py +5 -5
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_main_cli.py +114 -2
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_h5_roundtrip.py +1 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0/src/scope_profiler.egg-info}/PKG-INFO +67 -4
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler.egg-info/SOURCES.txt +1 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/LICENSE.txt +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/MANIFEST.in +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/cmake/scope-profilerConfig.cmake.in +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/cmake/CMakeLists.txt +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/cmake/main.cpp +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/cmake/mpi.cpp +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/cmake/native.c +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/ex_mpi_numpy_wrappers.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/ex_mpi_profiling_options.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/examples/ex_mpi_wrappers.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/setup.cfg +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/_assets/__init__.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/_assets/scope-profiler-plotly-0.2.0.js +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/benchmark.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/Makefile +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/example.c +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/scope_profiler.c +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/scope_profiler.h +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/scope_profiler.hpp +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/scope_profiler_hdf5.h +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/scope_profiler_impl.h +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/c/scope_profiler_mpi.hpp +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/call_stack.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/chrome_trace_export.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/concurrency.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/diff.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/fortran/Makefile +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/fortran/example.f90 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/fortran/scope_profiler.f90 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/gpu_timing.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/h5schema.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/html_report.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/inspection.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/ipython_magics.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/likwid_data.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/line_profile_cli.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mcp_server/__init__.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mcp_server/__main__.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mcp_server/server.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mcp_server/tools.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/memray.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/metadata.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mpi_launch.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mpi_region.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/mpi_wrappers.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/native_trace.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/perf_events.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/__init__.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/_utils.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/callgraph.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/duration_timeseries.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/durations.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/flame.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/gantt.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/heatmap.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/histogram.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/imbalance.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/likwid.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/perf_events.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/roofline.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/scaling.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/statistics.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/plotting_scripts/timeline.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/post_processing.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/prof_export.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/profile_config.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/profile_io.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/py.typed +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/pytest_plugin.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/region_profiler.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/results.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/speedscope_export.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/summary.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/__init__.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/check_mpi_launch.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/check_parallel_hdf5.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/examples.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/examples_pylikwid.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/README.md +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/hdf5-schema-1.h5.gz.b64 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/hdf5-schema-2.h5.gz.b64 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/hdf5-schema-3.h5.gz.b64 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/json-v1.json +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/native-v1.spt.b64 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/fixtures/compatibility/native-v2.spt.b64 +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/pylikwid_readme.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_aggregation.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_async_profiling.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_benchmark.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_buffer_growth.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_c_api.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_c_hdf5_output.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_chrome_trace_export.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_compatibility_fixtures.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_diff.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_documented_formats.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_fortran_api.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_html_report.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_in_memory_results.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_inspection.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_ipython_magics.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_label.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_likwid_data.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_line_profile_cli.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_mcp_server.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_mcp_tools.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_memray.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_metadata.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_mixed_language.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_mpi.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_multiple_sessions.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_multiprocessing.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_output_size.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_overhead.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_overhead_io.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_perf_events.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_post_processing.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_prof_export.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_profile_config_toml.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_profiling_options.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_pytest_plugin.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_readme.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_region_source.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_repeated_finalize.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_results_api.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_set_version.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_speedscope_export.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_storage_size.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_summary_likwid.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_threading.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/test_tui.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/__init__.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_call_stack.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_call_stack_properties.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_callgraph_plot.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_concurrency.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_gpu_timing.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_h5_failure_paths.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_h5writer.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_lazy_config.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_likwid_child_env.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_merge_results.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_mpi_launch.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_mpi_wrappers.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_native_hdf5_inputs.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_native_trace_versions.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_payload_collection.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_recursive_tracer.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tests/unit/test_region_variants.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler/tui.py +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler.egg-info/dependency_links.txt +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler.egg-info/entry_points.txt +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler.egg-info/requires.txt +0 -0
- {scope_profiler-0.6.4 → scope_profiler-0.7.0}/src/scope_profiler.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scope-profiler
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: Profile code regions in python, optionally with LIKWID markers.
|
|
5
5
|
Author: Max
|
|
6
6
|
License-Expression: MIT
|
|
7
7
|
Project-URL: Source, https://github.com/max-models/scope-profiler
|
|
8
8
|
Keywords: python
|
|
9
|
-
Classifier: Development Status ::
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
10
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -156,15 +156,78 @@ for task in run.results.tasks[0]:
|
|
|
156
156
|
print(task.name, task.running_time, task.awaiting_time)
|
|
157
157
|
```
|
|
158
158
|
|
|
159
|
-
You can also profile a script without changing its source:
|
|
159
|
+
You can also recursively profile a script without changing its source:
|
|
160
160
|
|
|
161
161
|
```bash
|
|
162
|
-
scope-profiler run my_script.py
|
|
162
|
+
scope-profiler run --recursive my_script.py
|
|
163
163
|
scope-profiler inspect profiling_data.h5
|
|
164
164
|
scope-profiler plot default profiling_data.h5 -o figures
|
|
165
165
|
scope-profiler report profiling_data.h5 -o report.html
|
|
166
166
|
```
|
|
167
167
|
|
|
168
|
+
The runner also activates regions already defined in the script, so
|
|
169
|
+
application code can keep its instrumentation without owning the
|
|
170
|
+
profiling lifecycle:
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
import scope_profiler as sp
|
|
174
|
+
|
|
175
|
+
@sp.profile("main")
|
|
176
|
+
def main():
|
|
177
|
+
with sp.region("iteration"):
|
|
178
|
+
work()
|
|
179
|
+
|
|
180
|
+
main()
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Run it through Scope Profiler to collect those regions and finalize the
|
|
184
|
+
output:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
scope-profiler run app.py
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Running the same file with `python app.py` leaves profiling disabled and
|
|
191
|
+
creates no output file. Existing `session()`, `setup()`, and
|
|
192
|
+
`finalize()` workflows remain available when application code needs
|
|
193
|
+
direct lifecycle control.
|
|
194
|
+
|
|
195
|
+
For a one-line in-source lifecycle, setup can finalize automatically at
|
|
196
|
+
normal process exit:
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
sp.setup(file_path="profile.h5", auto_finalize=True)
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Or apply a session directly to the application entry point:
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
@sp.session(file_path="profile.h5")
|
|
206
|
+
def main():
|
|
207
|
+
...
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`sp.is_configured()` and `sp.is_active()` report lifecycle state.
|
|
211
|
+
`sp.registered_regions()` lists known instrumentation points, while
|
|
212
|
+
`sp.recorded_regions()` includes only regions that have measured calls.
|
|
213
|
+
|
|
214
|
+
Reusable handles stay bound to the current run across repeated sessions:
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
iteration = sp.define_region("iteration", tags=["solver"])
|
|
218
|
+
|
|
219
|
+
with iteration:
|
|
220
|
+
work()
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Scoped metadata is stored per call:
|
|
224
|
+
|
|
225
|
+
```python
|
|
226
|
+
with sp.metadata(step=42, phase="solve"):
|
|
227
|
+
with iteration:
|
|
228
|
+
work()
|
|
229
|
+
```
|
|
230
|
+
|
|
168
231
|
## Profile a pytest suite
|
|
169
232
|
|
|
170
233
|
The installed package provides an opt-in pytest plugin. It records one
|
|
@@ -75,15 +75,78 @@ for task in run.results.tasks[0]:
|
|
|
75
75
|
print(task.name, task.running_time, task.awaiting_time)
|
|
76
76
|
```
|
|
77
77
|
|
|
78
|
-
You can also profile a script without changing its source:
|
|
78
|
+
You can also recursively profile a script without changing its source:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
scope-profiler run my_script.py
|
|
81
|
+
scope-profiler run --recursive my_script.py
|
|
82
82
|
scope-profiler inspect profiling_data.h5
|
|
83
83
|
scope-profiler plot default profiling_data.h5 -o figures
|
|
84
84
|
scope-profiler report profiling_data.h5 -o report.html
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
The runner also activates regions already defined in the script, so
|
|
88
|
+
application code can keep its instrumentation without owning the
|
|
89
|
+
profiling lifecycle:
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import scope_profiler as sp
|
|
93
|
+
|
|
94
|
+
@sp.profile("main")
|
|
95
|
+
def main():
|
|
96
|
+
with sp.region("iteration"):
|
|
97
|
+
work()
|
|
98
|
+
|
|
99
|
+
main()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Run it through Scope Profiler to collect those regions and finalize the
|
|
103
|
+
output:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
scope-profiler run app.py
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Running the same file with `python app.py` leaves profiling disabled and
|
|
110
|
+
creates no output file. Existing `session()`, `setup()`, and
|
|
111
|
+
`finalize()` workflows remain available when application code needs
|
|
112
|
+
direct lifecycle control.
|
|
113
|
+
|
|
114
|
+
For a one-line in-source lifecycle, setup can finalize automatically at
|
|
115
|
+
normal process exit:
|
|
116
|
+
|
|
117
|
+
```python
|
|
118
|
+
sp.setup(file_path="profile.h5", auto_finalize=True)
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Or apply a session directly to the application entry point:
|
|
122
|
+
|
|
123
|
+
```python
|
|
124
|
+
@sp.session(file_path="profile.h5")
|
|
125
|
+
def main():
|
|
126
|
+
...
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
`sp.is_configured()` and `sp.is_active()` report lifecycle state.
|
|
130
|
+
`sp.registered_regions()` lists known instrumentation points, while
|
|
131
|
+
`sp.recorded_regions()` includes only regions that have measured calls.
|
|
132
|
+
|
|
133
|
+
Reusable handles stay bound to the current run across repeated sessions:
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
iteration = sp.define_region("iteration", tags=["solver"])
|
|
137
|
+
|
|
138
|
+
with iteration:
|
|
139
|
+
work()
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Scoped metadata is stored per call:
|
|
143
|
+
|
|
144
|
+
```python
|
|
145
|
+
with sp.metadata(step=42, phase="solve"):
|
|
146
|
+
with iteration:
|
|
147
|
+
work()
|
|
148
|
+
```
|
|
149
|
+
|
|
87
150
|
## Profile a pytest suite
|
|
88
151
|
|
|
89
152
|
The installed package provides an opt-in pytest plugin. It records one
|
|
@@ -5,7 +5,7 @@ requires = [ "setuptools", "wheel" ]
|
|
|
5
5
|
|
|
6
6
|
[project]
|
|
7
7
|
name = "scope-profiler"
|
|
8
|
-
version = "0.
|
|
8
|
+
version = "0.7.0"
|
|
9
9
|
description = "Profile code regions in python, optionally with LIKWID markers."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
keywords = [ "python" ]
|
|
@@ -14,7 +14,7 @@ license-files = [ "LICENSE.txt" ]
|
|
|
14
14
|
authors = [ { name = "Max" } ]
|
|
15
15
|
requires-python = ">=3.10"
|
|
16
16
|
classifiers = [
|
|
17
|
-
"Development Status ::
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
18
|
"Programming Language :: Python :: 3 :: Only",
|
|
19
19
|
"Programming Language :: Python :: 3.10",
|
|
20
20
|
"Programming Language :: Python :: 3.11",
|
|
@@ -43,7 +43,12 @@ from scope_profiler.profile_io import (
|
|
|
43
43
|
sniff_profile_format,
|
|
44
44
|
write_profile,
|
|
45
45
|
)
|
|
46
|
-
from scope_profiler.profile_manager import
|
|
46
|
+
from scope_profiler.profile_manager import (
|
|
47
|
+
ProfileManager,
|
|
48
|
+
ProfilingRun,
|
|
49
|
+
RegionFactory,
|
|
50
|
+
RegionHandle,
|
|
51
|
+
)
|
|
47
52
|
from scope_profiler.region import EventDataUnavailableError, Region
|
|
48
53
|
from scope_profiler.results import ProfilingResults, merge_results
|
|
49
54
|
|
|
@@ -61,10 +66,23 @@ from scope_profiler.results import ProfilingResults, merge_results
|
|
|
61
66
|
#: extra frame there is measurable overhead. They act on the same global
|
|
62
67
|
#: manager state the class methods do.
|
|
63
68
|
finalize = ProfileManager.finalize
|
|
69
|
+
define_region = ProfileManager.define_region
|
|
70
|
+
is_active = ProfileManager.is_active
|
|
71
|
+
is_configured = ProfileManager.is_configured
|
|
72
|
+
instrument = ProfileManager.instrument
|
|
73
|
+
last_results = ProfileManager.last_results
|
|
74
|
+
metadata = ProfileManager.metadata
|
|
75
|
+
profile_command = ProfileManager.profile_command
|
|
76
|
+
profile_script = ProfileManager.profile_script
|
|
64
77
|
profile = ProfileManager.profile
|
|
78
|
+
region_factory = ProfileManager.region_factory
|
|
79
|
+
recorded_regions = ProfileManager.recorded_regions
|
|
65
80
|
region = ProfileManager.region
|
|
81
|
+
registered_regions = ProfileManager.registered_regions
|
|
66
82
|
session = ProfileManager.session
|
|
67
83
|
setup = ProfileManager.setup
|
|
84
|
+
setup_from_env = ProfileManager.setup_from_env
|
|
85
|
+
run = ProfileManager.run
|
|
68
86
|
|
|
69
87
|
try:
|
|
70
88
|
__version__ = version("scope-profiler")
|
|
@@ -123,7 +141,10 @@ __all__ = [
|
|
|
123
141
|
"ProfiledMPIRequest",
|
|
124
142
|
"ProfilingOptions",
|
|
125
143
|
"ProfilingResults",
|
|
144
|
+
"ProfilingRun",
|
|
126
145
|
"Region",
|
|
146
|
+
"RegionFactory",
|
|
147
|
+
"RegionHandle",
|
|
127
148
|
"build_call_arrays",
|
|
128
149
|
"build_call_stack",
|
|
129
150
|
"call_stack_children",
|
|
@@ -132,6 +153,7 @@ __all__ = [
|
|
|
132
153
|
"collect_region_statistics",
|
|
133
154
|
"collect_roofline_points",
|
|
134
155
|
"create_html_report",
|
|
156
|
+
"define_region",
|
|
135
157
|
"export_chrome_trace",
|
|
136
158
|
"export_flamegraph_svg",
|
|
137
159
|
"export_json",
|
|
@@ -140,10 +162,15 @@ __all__ = [
|
|
|
140
162
|
"finalize",
|
|
141
163
|
"format_mpi_region",
|
|
142
164
|
"inspect_file",
|
|
165
|
+
"instrument",
|
|
166
|
+
"is_active",
|
|
167
|
+
"is_configured",
|
|
168
|
+
"last_results",
|
|
143
169
|
"load",
|
|
144
170
|
"load_prof",
|
|
145
171
|
"merge_results",
|
|
146
172
|
"message_nbytes",
|
|
173
|
+
"metadata",
|
|
147
174
|
"parse_mpi_region",
|
|
148
175
|
"plot_duration_timeseries",
|
|
149
176
|
"plot_durations",
|
|
@@ -159,15 +186,22 @@ __all__ = [
|
|
|
159
186
|
"plot_weak_scaling",
|
|
160
187
|
"plot_weak_scaling_efficiency",
|
|
161
188
|
"profile",
|
|
189
|
+
"profile_command",
|
|
162
190
|
"profile_mpi4py",
|
|
163
191
|
"profile_mpi_comm",
|
|
192
|
+
"profile_script",
|
|
164
193
|
"read_h5",
|
|
165
194
|
"read_h5_summary",
|
|
166
195
|
"read_json",
|
|
167
196
|
"read_profile",
|
|
197
|
+
"recorded_regions",
|
|
168
198
|
"region",
|
|
199
|
+
"region_factory",
|
|
200
|
+
"registered_regions",
|
|
201
|
+
"run",
|
|
169
202
|
"session",
|
|
170
203
|
"setup",
|
|
204
|
+
"setup_from_env",
|
|
171
205
|
"sniff_profile_format",
|
|
172
206
|
"to_pstats",
|
|
173
207
|
"write_json",
|
|
@@ -8,11 +8,11 @@ the file name.
|
|
|
8
8
|
|
|
9
9
|
The subcommands:
|
|
10
10
|
|
|
11
|
-
- ``scope-profiler run script.py [args...]`` --
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
- ``scope-profiler run script.py [args...]`` -- activates explicit
|
|
12
|
+
``scope_profiler.profile`` and ``scope_profiler.region`` instrumentation in
|
|
13
|
+
a script without requiring an in-source session. Pass ``--recursive`` for
|
|
14
|
+
function-call tracing similar to ``python -m cProfile``; add ``--all`` to
|
|
15
|
+
include standard-library and installed-package calls. The
|
|
16
16
|
extension of ``-o`` picks the output format: HDF5 by default, a JSON
|
|
17
17
|
profile for ``.json``/``.json.gz``, a rendered report for ``.html``.
|
|
18
18
|
- ``scope-profiler plot <kind> file.h5 [...]`` -- reads merged HDF5 profiling
|
|
@@ -63,9 +63,10 @@ from scope_profiler.profile_manager import ProfileManager
|
|
|
63
63
|
def _parse_run_args(argv):
|
|
64
64
|
parser = argparse.ArgumentParser(
|
|
65
65
|
prog="scope-profiler run",
|
|
66
|
-
description="
|
|
66
|
+
description="Run a script with explicit regions enabled.",
|
|
67
67
|
)
|
|
68
|
-
parser.
|
|
68
|
+
output_group = parser.add_mutually_exclusive_group()
|
|
69
|
+
output_group.add_argument(
|
|
69
70
|
"-o",
|
|
70
71
|
"--outfile",
|
|
71
72
|
default=None,
|
|
@@ -73,6 +74,11 @@ def _parse_run_args(argv):
|
|
|
73
74
|
"extension picks the format: .h5 for HDF5, .json / .json.gz for a "
|
|
74
75
|
"JSON profile, .html for a rendered report",
|
|
75
76
|
)
|
|
77
|
+
output_group.add_argument(
|
|
78
|
+
"--no-output",
|
|
79
|
+
action="store_true",
|
|
80
|
+
help="Keep results in memory and do not write a profile file",
|
|
81
|
+
)
|
|
76
82
|
parser.add_argument(
|
|
77
83
|
"--config",
|
|
78
84
|
metavar="FILE",
|
|
@@ -84,11 +90,39 @@ def _parse_run_args(argv):
|
|
|
84
90
|
action="store_true",
|
|
85
91
|
help="Suppress the per-region summary printed after the run",
|
|
86
92
|
)
|
|
93
|
+
recursive = parser.add_mutually_exclusive_group()
|
|
94
|
+
recursive.add_argument(
|
|
95
|
+
"--recursive",
|
|
96
|
+
action="store_true",
|
|
97
|
+
default=None,
|
|
98
|
+
help="Profile every Python function in the script (default: explicit regions only)",
|
|
99
|
+
)
|
|
100
|
+
parser.add_argument(
|
|
101
|
+
"--include",
|
|
102
|
+
dest="include_patterns",
|
|
103
|
+
action="append",
|
|
104
|
+
default=[],
|
|
105
|
+
metavar="GLOB",
|
|
106
|
+
help="With recursive tracing, include only matching function names (repeatable)",
|
|
107
|
+
)
|
|
108
|
+
parser.add_argument(
|
|
109
|
+
"--exclude",
|
|
110
|
+
dest="exclude_patterns",
|
|
111
|
+
action="append",
|
|
112
|
+
default=[],
|
|
113
|
+
metavar="GLOB",
|
|
114
|
+
help="With recursive tracing, exclude matching function names (repeatable)",
|
|
115
|
+
)
|
|
116
|
+
recursive.add_argument(
|
|
117
|
+
"--no-recursive",
|
|
118
|
+
dest="recursive",
|
|
119
|
+
action="store_false",
|
|
120
|
+
help="Disable recursive tracing, overriding the configuration file",
|
|
121
|
+
)
|
|
87
122
|
parser.add_argument(
|
|
88
123
|
"--all",
|
|
89
124
|
action="store_true",
|
|
90
|
-
help="
|
|
91
|
-
"(default: only the script's own code)",
|
|
125
|
+
help="Recursively instrument all calls, including standard-library and installed packages",
|
|
92
126
|
)
|
|
93
127
|
parser.add_argument(
|
|
94
128
|
"--line-profile",
|
|
@@ -116,6 +150,24 @@ def _parse_run_args(argv):
|
|
|
116
150
|
default=None,
|
|
117
151
|
help="Record aggregate timing statistics only; omit per-call timeline events.",
|
|
118
152
|
)
|
|
153
|
+
parser.add_argument(
|
|
154
|
+
"--label",
|
|
155
|
+
default=None,
|
|
156
|
+
help="Short label stored with the profile for comparison and reporting",
|
|
157
|
+
)
|
|
158
|
+
parser.add_argument(
|
|
159
|
+
"--tag",
|
|
160
|
+
dest="region_tags",
|
|
161
|
+
action="append",
|
|
162
|
+
default=None,
|
|
163
|
+
metavar="TAG",
|
|
164
|
+
help="Record only explicitly defined regions carrying this tag (repeatable)",
|
|
165
|
+
)
|
|
166
|
+
parser.add_argument(
|
|
167
|
+
"--entrypoint",
|
|
168
|
+
metavar="NAME",
|
|
169
|
+
help="Name the recursively traced entrypoint region",
|
|
170
|
+
)
|
|
119
171
|
mpi_calls = parser.add_mutually_exclusive_group()
|
|
120
172
|
mpi_calls.add_argument(
|
|
121
173
|
"--mpi-calls",
|
|
@@ -203,31 +255,47 @@ def _run(argv):
|
|
|
203
255
|
# within one directory, and so a read-only $TMPDIR cannot break the run.
|
|
204
256
|
profile_path = args.outfile + ".scope-profiler.h5" if convert else args.outfile
|
|
205
257
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
258
|
+
setup_kwargs = {
|
|
259
|
+
"replace": True,
|
|
260
|
+
"recursive_profile": (
|
|
261
|
+
True if args.recursive or args.all or args.entrypoint else args.recursive
|
|
262
|
+
),
|
|
263
|
+
"use_likwid": None,
|
|
264
|
+
"use_line_profiler": args.line_profile,
|
|
265
|
+
"use_memray": args.memory_profile,
|
|
266
|
+
"buffer_limit": args.buffer_limit,
|
|
267
|
+
"aggregation_mode": args.aggregation_mode,
|
|
268
|
+
"profile_mpi_calls": args.mpi_calls,
|
|
269
|
+
"label": args.label,
|
|
270
|
+
"region_tags": args.region_tags,
|
|
271
|
+
"config_path": args.config,
|
|
272
|
+
}
|
|
273
|
+
if args.no_output:
|
|
274
|
+
setup_kwargs["deactivate_file_output"] = True
|
|
275
|
+
else:
|
|
276
|
+
setup_kwargs["file_path"] = profile_path
|
|
277
|
+
ProfileManager.setup(**setup_kwargs)
|
|
219
278
|
|
|
220
279
|
try:
|
|
221
280
|
ProfileManager.run_script(
|
|
222
281
|
args.script,
|
|
223
282
|
script_args=args.script_args,
|
|
283
|
+
recursive=args.all
|
|
284
|
+
or args.entrypoint is not None
|
|
285
|
+
or ProfileManager.get_config().recursive_profile,
|
|
224
286
|
only_user_code=not args.all,
|
|
287
|
+
include_patterns=args.include_patterns,
|
|
288
|
+
exclude_patterns=args.exclude_patterns,
|
|
289
|
+
entrypoint=args.entrypoint,
|
|
225
290
|
)
|
|
226
291
|
finally:
|
|
227
292
|
# The summary names the file it came from, so with a conversion still
|
|
228
293
|
# to come it is printed afterwards, against the file the user asked
|
|
229
294
|
# for, rather than against a temporary that is about to be deleted.
|
|
230
|
-
|
|
295
|
+
finalize_kwargs = {"verbose": not args.quiet and not convert}
|
|
296
|
+
if args.no_output:
|
|
297
|
+
finalize_kwargs["return_results"] = True
|
|
298
|
+
ProfileManager.finalize(**finalize_kwargs)
|
|
231
299
|
if convert:
|
|
232
300
|
_convert_run_output(profile_path, args.outfile, quiet=args.quiet)
|
|
233
301
|
|
|
@@ -318,6 +318,7 @@ def _read_columnar_regions(h5file) -> tuple[dict, list[str], dict]:
|
|
|
318
318
|
source_files = index["source_files"][()]
|
|
319
319
|
source_texts = index["source_texts"][()]
|
|
320
320
|
tag_blobs = index["tags"][()]
|
|
321
|
+
metadata_blobs = index["event_metadata"][()] if "event_metadata" in index else None
|
|
321
322
|
# Absent in files written before the run stored its own exclusive totals;
|
|
322
323
|
# _NO_EXCLUSIVE_TOTAL marks a row whose writer did not compute one. Either
|
|
323
324
|
# way the reader falls back to reconstructing the nesting on demand.
|
|
@@ -372,6 +373,13 @@ def _read_columnar_regions(h5file) -> tuple[dict, list[str], dict]:
|
|
|
372
373
|
thread_ids = thread_column[event_slice] if thread_column is not None else None
|
|
373
374
|
task_ids = task_column[event_slice] if task_column is not None else None
|
|
374
375
|
await_times = await_column[event_slice] if await_column is not None else None
|
|
376
|
+
event_metadata = (
|
|
377
|
+
json.loads(_decode_attribute(metadata_blobs[row]) or "[]")
|
|
378
|
+
if metadata_blobs is not None
|
|
379
|
+
else None
|
|
380
|
+
)
|
|
381
|
+
if not event_metadata:
|
|
382
|
+
event_metadata = None
|
|
375
383
|
source_line = int(source_lines[row])
|
|
376
384
|
per_region[name][rank] = Region(
|
|
377
385
|
row_starts,
|
|
@@ -382,6 +390,7 @@ def _read_columnar_regions(h5file) -> tuple[dict, list[str], dict]:
|
|
|
382
390
|
thread_ids=thread_ids,
|
|
383
391
|
task_ids=task_ids,
|
|
384
392
|
await_times=await_times,
|
|
393
|
+
event_metadata=event_metadata,
|
|
385
394
|
source_file=_decode_attribute(source_files[row]) or None,
|
|
386
395
|
source_lineno=source_line if source_line >= 0 else None,
|
|
387
396
|
source_text=_decode_attribute(source_texts[row]) or None,
|
|
@@ -456,7 +456,7 @@ def initialize_columnar_layout(
|
|
|
456
456
|
dtype=_SUMMARY_DTYPE,
|
|
457
457
|
chunks=index_chunk,
|
|
458
458
|
)
|
|
459
|
-
for name in ("source_files", "source_texts", "tags"):
|
|
459
|
+
for name in ("source_files", "source_texts", "tags", "event_metadata"):
|
|
460
460
|
index.create_dataset(
|
|
461
461
|
name,
|
|
462
462
|
shape=(0,),
|
|
@@ -766,6 +766,7 @@ def append_columnar_rank(
|
|
|
766
766
|
|
|
767
767
|
sources = payload.sources or {}
|
|
768
768
|
tags = payload.tags or {}
|
|
769
|
+
event_metadata = payload.event_metadata or {}
|
|
769
770
|
names = list(payload.regions)
|
|
770
771
|
counts = [len(payload.regions[name][0]) for name in names]
|
|
771
772
|
# Regions are written back to back, so this rank's rows point at
|
|
@@ -854,6 +855,17 @@ def append_columnar_rank(
|
|
|
854
855
|
_append(index["source_files"], [source[0] or "" for source in resolved_sources])
|
|
855
856
|
_append(index["source_texts"], [source[2] or "" for source in resolved_sources])
|
|
856
857
|
_append(index["tags"], [json.dumps(list(tags.get(name, ()))) for name in names])
|
|
858
|
+
if "event_metadata" not in index:
|
|
859
|
+
index.create_dataset(
|
|
860
|
+
"event_metadata",
|
|
861
|
+
shape=(len(index["ranks"]) - len(names),),
|
|
862
|
+
maxshape=(None,),
|
|
863
|
+
dtype=_STRING_DTYPE,
|
|
864
|
+
)
|
|
865
|
+
_append(
|
|
866
|
+
index["event_metadata"],
|
|
867
|
+
[json.dumps(event_metadata.get(name, [])) for name in names],
|
|
868
|
+
)
|
|
857
869
|
_append(
|
|
858
870
|
index["exclusive_totals"],
|
|
859
871
|
[exclusive_totals.get(name, _NO_EXCLUSIVE_TOTAL) for name in names],
|
|
@@ -961,6 +973,7 @@ def payload_layout(payload) -> dict:
|
|
|
961
973
|
"""Return the small, array-free schema needed for collective creation."""
|
|
962
974
|
sources = payload.sources or {}
|
|
963
975
|
tags = payload.tags or {}
|
|
976
|
+
event_metadata = payload.event_metadata or {}
|
|
964
977
|
exclusive_totals = payload.exclusive_totals or {}
|
|
965
978
|
return {
|
|
966
979
|
"regions": {
|
|
@@ -969,6 +982,7 @@ def payload_layout(payload) -> dict:
|
|
|
969
982
|
"has_gpu": len(arrays) > 2 and arrays[2] is not None,
|
|
970
983
|
"source": sources.get(name),
|
|
971
984
|
"tags": tuple(tags.get(name, ())),
|
|
985
|
+
"event_metadata": event_metadata.get(name, []),
|
|
972
986
|
"exclusive_total": int(exclusive_totals.get(name, _NO_EXCLUSIVE_TOTAL)),
|
|
973
987
|
"summary": _timing_summary(arrays),
|
|
974
988
|
}
|
|
@@ -1066,10 +1080,14 @@ def write_parallel_payload(
|
|
|
1066
1080
|
for *_, description in pairs
|
|
1067
1081
|
]
|
|
1068
1082
|
tags = [json.dumps(list(description["tags"])) for *_, description in pairs]
|
|
1083
|
+
event_metadata = [
|
|
1084
|
+
json.dumps(description["event_metadata"]) for *_, description in pairs
|
|
1085
|
+
]
|
|
1069
1086
|
encoded_names, names_dtype = fixed_string_data(region_names)
|
|
1070
1087
|
encoded_source_files, source_files_dtype = fixed_string_data(source_files)
|
|
1071
1088
|
encoded_source_texts, source_texts_dtype = fixed_string_data(source_texts)
|
|
1072
1089
|
encoded_tags, tags_dtype = fixed_string_data(tags)
|
|
1090
|
+
encoded_event_metadata, event_metadata_dtype = fixed_string_data(event_metadata)
|
|
1073
1091
|
|
|
1074
1092
|
with h5py.File(file_path, "w", driver="mpio", comm=comm) as h5file:
|
|
1075
1093
|
h5file.attrs[SCHEMA_ATTRIBUTE] = CURRENT_SCHEMA_VERSION
|
|
@@ -1101,6 +1119,7 @@ def write_parallel_payload(
|
|
|
1101
1119
|
("source_files", source_files_dtype),
|
|
1102
1120
|
("source_texts", source_texts_dtype),
|
|
1103
1121
|
("tags", tags_dtype),
|
|
1122
|
+
("event_metadata", event_metadata_dtype),
|
|
1104
1123
|
):
|
|
1105
1124
|
pair_index.create_dataset(name, shape=(len(pairs),), dtype=dtype)
|
|
1106
1125
|
|
|
@@ -1146,6 +1165,7 @@ def write_parallel_payload(
|
|
|
1146
1165
|
pair_index["source_files"][:] = encoded_source_files
|
|
1147
1166
|
pair_index["source_texts"][:] = encoded_source_texts
|
|
1148
1167
|
pair_index["tags"][:] = encoded_tags
|
|
1168
|
+
pair_index["event_metadata"][:] = encoded_event_metadata
|
|
1149
1169
|
pair_index["exclusive_totals"][:] = [
|
|
1150
1170
|
description.get("exclusive_total", _NO_EXCLUSIVE_TOTAL)
|
|
1151
1171
|
for *_, description in pairs
|
|
@@ -149,6 +149,8 @@ def _region_row(name: str, rank: int, region: Region) -> dict:
|
|
|
149
149
|
|
|
150
150
|
row["start_times_ns"] = _ints(region.start_times_ns)
|
|
151
151
|
row["end_times_ns"] = _ints(region.end_times_ns)
|
|
152
|
+
if any(region.event_metadata):
|
|
153
|
+
row["event_metadata"] = list(region.event_metadata)
|
|
152
154
|
for key, column in (
|
|
153
155
|
("gpu_durations_ns", region.gpu_durations_ns),
|
|
154
156
|
("call_ids", region.call_ids),
|
|
@@ -502,6 +504,7 @@ def _region_from_row(row: dict) -> Region:
|
|
|
502
504
|
thread_ids=column("thread_ids"),
|
|
503
505
|
task_ids=column("task_ids"),
|
|
504
506
|
await_times=column("await_ns"),
|
|
507
|
+
event_metadata=row.get("event_metadata"),
|
|
505
508
|
source_file=source_file,
|
|
506
509
|
source_lineno=source_lineno,
|
|
507
510
|
source_text=source_text,
|