scope-profiler 0.7.0__tar.gz → 0.7.2__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.7.0 → scope_profiler-0.7.2}/CMakeLists.txt +1 -1
- {scope_profiler-0.7.0/src/scope_profiler.egg-info → scope_profiler-0.7.2}/PKG-INFO +15 -195
- scope_profiler-0.7.2/README.md +171 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/pyproject.toml +1 -1
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/html_report.py +12 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/metadata.py +40 -7
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/profile_config.py +30 -3
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/profile_manager.py +30 -4
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/results.py +3 -2
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/summary.py +252 -94
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_app.py +5 -3
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_inspection.py +12 -10
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_metadata.py +111 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_results_api.py +137 -4
- scope_profiler-0.7.2/src/scope_profiler/tests/unit/test_summary_rendering.py +88 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2/src/scope_profiler.egg-info}/PKG-INFO +15 -195
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler.egg-info/SOURCES.txt +2 -1
- scope_profiler-0.7.0/README.md +0 -351
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/LICENSE.txt +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/MANIFEST.in +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/cmake/scope-profilerConfig.cmake.in +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/cmake/CMakeLists.txt +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/cmake/main.cpp +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/cmake/mpi.cpp +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/cmake/native.c +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/ex_mpi_numpy_wrappers.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/ex_mpi_profiling_options.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/examples/ex_mpi_wrappers.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/setup.cfg +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/__init__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/__main__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/_assets/__init__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/_assets/scope-profiler-plotly-0.2.0.js +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/benchmark.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/Makefile +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/example.c +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/scope_profiler.c +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/scope_profiler.h +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/scope_profiler.hpp +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/scope_profiler_hdf5.h +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/scope_profiler_impl.h +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/c/scope_profiler_mpi.hpp +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/call_stack.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/chrome_trace_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/concurrency.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/diff.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/fortran/Makefile +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/fortran/example.f90 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/fortran/scope_profiler.f90 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/gpu_timing.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/h5reader.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/h5schema.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/h5writer.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/inspection.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/ipython_magics.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/json_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/likwid_data.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/line_profile_cli.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mcp_server/__init__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mcp_server/__main__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mcp_server/server.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mcp_server/tools.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/memray.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mpi_launch.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mpi_region.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/mpi_wrappers.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/native_trace.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/perf_events.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/__init__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/_utils.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/callgraph.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/duration_timeseries.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/durations.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/flame.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/gantt.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/heatmap.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/histogram.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/imbalance.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/likwid.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/perf_events.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/roofline.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/scaling.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/statistics.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/plotting_scripts/timeline.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/post_processing.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/prof_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/profile_io.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/py.typed +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/pytest_plugin.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/region.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/region_profiler.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/speedscope_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/__init__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/check_mpi_launch.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/check_parallel_hdf5.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/conftest.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/examples.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/examples_pylikwid.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/README.md +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/hdf5-schema-1.h5.gz.b64 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/hdf5-schema-2.h5.gz.b64 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/hdf5-schema-3.h5.gz.b64 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/json-v1.json +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/native-v1.spt.b64 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/fixtures/compatibility/native-v2.spt.b64 +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/pylikwid_readme.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_aggregation.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_api_shortcuts.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_async_profiling.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_benchmark.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_buffer_growth.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_c_api.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_c_hdf5_output.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_chrome_trace_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_compatibility_fixtures.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_diff.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_documented_formats.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_fortran_api.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_html_report.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_in_memory_results.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_ipython_magics.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_json_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_label.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_likwid_data.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_line_profile_cli.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_main_cli.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_mcp_server.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_mcp_tools.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_memray.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_mixed_language.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_mpi.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_multiple_sessions.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_multiprocessing.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_output_size.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_overhead.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_overhead_io.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_perf_events.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_post_processing.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_prof_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_profile_config_toml.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_profiling_options.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_pytest_plugin.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_readme.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_region_source.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_repeated_finalize.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_set_version.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_speedscope_export.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_storage_size.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_summary_likwid.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_threading.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/test_tui.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/__init__.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_call_stack.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_call_stack_properties.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_callgraph_plot.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_concurrency.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_gpu_timing.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_h5_failure_paths.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_h5_roundtrip.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_h5writer.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_lazy_config.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_likwid_child_env.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_merge_results.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_mpi_launch.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_mpi_wrappers.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_native_hdf5_inputs.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_native_trace_versions.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_payload_collection.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_recursive_tracer.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tests/unit/test_region_variants.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler/tui.py +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler.egg-info/dependency_links.txt +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler.egg-info/entry_points.txt +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler.egg-info/requires.txt +0 -0
- {scope_profiler-0.7.0 → scope_profiler-0.7.2}/src/scope_profiler.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: scope-profiler
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.2
|
|
4
4
|
Summary: Profile code regions in python, optionally with LIKWID markers.
|
|
5
5
|
Author: Max
|
|
6
6
|
License-Expression: MIT
|
|
@@ -119,55 +119,8 @@ with ProfileManager.session():
|
|
|
119
119
|
...
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
own output:
|
|
125
|
-
|
|
126
|
-
```python
|
|
127
|
-
compute_profiler = ProfileManager()
|
|
128
|
-
io_profiler = ProfileManager()
|
|
129
|
-
|
|
130
|
-
with compute_profiler.session(file_path="compute.h5", verbose=False):
|
|
131
|
-
with io_profiler.session(file_path="io.h5", verbose=False):
|
|
132
|
-
with compute_profiler.region("solve"):
|
|
133
|
-
solve()
|
|
134
|
-
with io_profiler.region("checkpoint"):
|
|
135
|
-
write_checkpoint()
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
These are independent nested sessions. LIKWID’s marker state is
|
|
139
|
-
process-global, so only one overlapping session may use
|
|
140
|
-
`use_likwid=True`.
|
|
141
|
-
|
|
142
|
-
Concurrency is a separate switch. `track_threads=True` gives every
|
|
143
|
-
thread its own buffers and its own lane in the reconstructed call graph,
|
|
144
|
-
and reports each thread’s name, lifetime and CPU time;
|
|
145
|
-
`track_async=True` does the same for asyncio tasks and greenlets, and
|
|
146
|
-
splits every call into the time its task held the thread and the time it
|
|
147
|
-
spent awaiting:
|
|
148
|
-
|
|
149
|
-
```python
|
|
150
|
-
with ProfileManager.session(track_async=True, return_results=True) as run:
|
|
151
|
-
asyncio.run(main())
|
|
152
|
-
|
|
153
|
-
fetch = run.results["fetch"][0]
|
|
154
|
-
fetch.durations - fetch.await_times # time actually spent running
|
|
155
|
-
for task in run.results.tasks[0]:
|
|
156
|
-
print(task.name, task.running_time, task.awaiting_time)
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
You can also recursively profile a script without changing its source:
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
scope-profiler run --recursive my_script.py
|
|
163
|
-
scope-profiler inspect profiling_data.h5
|
|
164
|
-
scope-profiler plot default profiling_data.h5 -o figures
|
|
165
|
-
scope-profiler report profiling_data.h5 -o report.html
|
|
166
|
-
```
|
|
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:
|
|
122
|
+
For a script that already has regions, the CLI owns the profiling
|
|
123
|
+
lifecycle:
|
|
171
124
|
|
|
172
125
|
```python
|
|
173
126
|
import scope_profiler as sp
|
|
@@ -192,41 +145,11 @@ creates no output file. Existing `session()`, `setup()`, and
|
|
|
192
145
|
`finalize()` workflows remain available when application code needs
|
|
193
146
|
direct lifecycle control.
|
|
194
147
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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
|
-
```
|
|
148
|
+
See the
|
|
149
|
+
[quickstart](https://max-models.github.io/scope-profiler/quickstart.html)
|
|
150
|
+
and [profiling modes
|
|
151
|
+
guide](https://max-models.github.io/scope-profiler/guide/modes.html) for
|
|
152
|
+
recursive tracing, tags, concurrency, output formats, and advanced APIs.
|
|
230
153
|
|
|
231
154
|
## Profile a pytest suite
|
|
232
155
|
|
|
@@ -257,119 +180,16 @@ detailed function-level attribution is needed. With `pytest-xdist`, the
|
|
|
257
180
|
plugin cannot yet be used: its workers must not write the same HDF5
|
|
258
181
|
file.
|
|
259
182
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
file:
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
scope-profiler run -o profile.json my_script.py # or .json.gz
|
|
268
|
-
scope-profiler run -o report.html my_script.py # rendered report
|
|
269
|
-
scope-profiler export json profiling_data.h5 -o exports # convert an existing run
|
|
270
|
-
scope-profiler inspect profile.json # read one back anywhere
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
Profiling can be suspended around setup, I/O, or other phases that
|
|
274
|
-
should not appear in the trace. Pause at scope boundaries and resume
|
|
275
|
-
when measurement is needed again:
|
|
276
|
-
|
|
277
|
-
```python
|
|
278
|
-
ProfileManager.pause()
|
|
279
|
-
simulation.prepare_output()
|
|
280
|
-
ProfileManager.resume()
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
`pause()` and `resume()` are safe to call repeatedly. Pausing while a
|
|
284
|
-
profiled scope is open raises an error, so a recorded interval can never
|
|
285
|
-
silently span the paused period.
|
|
286
|
-
|
|
287
|
-
For time-stepping simulations, `sample_every()` provides the same
|
|
288
|
-
control with an explicit timestep number:
|
|
289
|
-
|
|
290
|
-
```python
|
|
291
|
-
with ProfileManager.sample_every(10) as profile_step:
|
|
292
|
-
for timestep in range(num_steps):
|
|
293
|
-
with profile_step(timestep):
|
|
294
|
-
simulation.step()
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
The equivalent fully manual form is useful when the simulation has
|
|
298
|
-
additional conditions around profiling:
|
|
299
|
-
|
|
300
|
-
```python
|
|
301
|
-
for timestep in range(num_steps):
|
|
302
|
-
if timestep % 10 == 0:
|
|
303
|
-
ProfileManager.resume()
|
|
304
|
-
else:
|
|
305
|
-
ProfileManager.pause()
|
|
306
|
-
|
|
307
|
-
with ProfileManager.region("simulation.step"):
|
|
308
|
-
simulation.step()
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
Here only timesteps `0`, `10`, `20`, and so on are recorded. Call
|
|
312
|
-
`ProfileManager.setup()` before the loop; the initial state is enabled,
|
|
313
|
-
so the first `resume()` is optional but makes the intent explicit.
|
|
314
|
-
|
|
315
|
-
Reports embed interactive timeline and duration charts when the optional
|
|
316
|
-
post-processing dependencies are installed
|
|
317
|
-
(`pip install "scope-profiler[pproc]"`).
|
|
318
|
-
|
|
319
|
-
## Example output
|
|
320
|
-
|
|
321
|
-
The plotting tools include duration summaries and timelines for finding
|
|
322
|
-
expensive regions:
|
|
323
|
-
|
|
324
|
-
For dense traces, the Gantt view supports time windows, duration
|
|
325
|
-
filtering, call coalescing, and call-depth collapsing. A binned
|
|
326
|
-
occupancy heatmap avoids drawing every short event:
|
|
327
|
-
|
|
328
|
-
```bash
|
|
329
|
-
scope-profiler plot gantt profiling_data.h5 -o figures \
|
|
330
|
-
--min-duration 0.001 --aggregate-calls 25 --collapse-depth 2
|
|
331
|
-
scope-profiler plot density profiling_data.h5 -o figures \
|
|
332
|
-
--bins 200 --min-duration 0.0001 --start-time 0 --end-time 10
|
|
333
|
-
```
|
|
334
|
-
|
|
335
|
-
Use `--aggregation-mode` with `scope-profiler run` when only aggregate
|
|
336
|
-
timing statistics are needed and the per-call timeline should not be
|
|
337
|
-
recorded.
|
|
338
|
-
|
|
339
|
-

|
|
341
|
-
|
|
342
|
-

|
|
344
|
-
|
|
345
|
-
The overhead benchmark measures the cost of each instrumentation mode:
|
|
346
|
-
|
|
347
|
-
```bash
|
|
348
|
-
python examples/benchmark_overhead.py
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-

|
|
183
|
+
See the [profiling modes
|
|
184
|
+
guide](https://max-models.github.io/scope-profiler/guide/modes.html) for
|
|
185
|
+
output formats, filtering, concurrency, aggregation, pause/resume, and
|
|
186
|
+
sampling.
|
|
353
187
|
|
|
354
188
|
## In a notebook
|
|
355
189
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
```python
|
|
360
|
-
%%scope_recursive
|
|
361
|
-
result = solve(problem) # every call recorded, nothing instrumented
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
```python
|
|
365
|
-
%scope_compare baseline candidate
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
`%%scope` times a cell as one region, `%%scope_line` breaks a function
|
|
369
|
-
down by line, `%%scope_agg` handles regions entered millions of times,
|
|
370
|
-
and `%scope_load` pulls in an HDF5 run from an MPI job to compare
|
|
371
|
-
against. See the [notebook magics
|
|
372
|
-
guide](https://max-models.github.io/scope-profiler/guide/notebook_magics.html).
|
|
190
|
+
Install the notebook extra and see the [notebook magics
|
|
191
|
+
guide](https://max-models.github.io/scope-profiler/guide/notebook_magics.html)
|
|
192
|
+
for cell profiling, recursive tracing, comparisons, and exports:
|
|
373
193
|
|
|
374
194
|
```bash
|
|
375
195
|
pip install "scope-profiler[notebook]"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<!-- Generated README.md is rendered from this file by docs/render_markdown.py. -->
|
|
2
|
+
|
|
3
|
+
# scope-profiler
|
|
4
|
+
|
|
5
|
+
Profile Python code regions—and optionally C, Fortran, MPI, NVTX, and
|
|
6
|
+
[LIKWID](https://github.com/RRZE-HPC/likwid)—with one consistent API and
|
|
7
|
+
HDF5 output format.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pip install scope-profiler
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
import scope_profiler as sp
|
|
17
|
+
|
|
18
|
+
with sp.session():
|
|
19
|
+
@sp.profile("main")
|
|
20
|
+
def main():
|
|
21
|
+
with sp.region("work"):
|
|
22
|
+
sum(range(100)) # replace with the code you want to measure
|
|
23
|
+
|
|
24
|
+
main()
|
|
25
|
+
# writes profiling_data.h5 and prints a summary
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`session`, `region`, `profile`, `setup` and `finalize` are the everyday
|
|
29
|
+
calls, importable from the package root. They are `ProfileManager` class
|
|
30
|
+
methods acting on the process-wide default manager, so the two spellings
|
|
31
|
+
are interchangeable:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from scope_profiler import ProfileManager
|
|
35
|
+
|
|
36
|
+
with ProfileManager.session():
|
|
37
|
+
with ProfileManager.region("work"):
|
|
38
|
+
...
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For a script that already has regions, the CLI owns the profiling
|
|
42
|
+
lifecycle:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import scope_profiler as sp
|
|
46
|
+
|
|
47
|
+
@sp.profile("main")
|
|
48
|
+
def main():
|
|
49
|
+
with sp.region("iteration"):
|
|
50
|
+
work()
|
|
51
|
+
|
|
52
|
+
main()
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Run it through Scope Profiler to collect those regions and finalize the
|
|
56
|
+
output:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
scope-profiler run app.py
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Running the same file with `python app.py` leaves profiling disabled and
|
|
63
|
+
creates no output file. Existing `session()`, `setup()`, and
|
|
64
|
+
`finalize()` workflows remain available when application code needs
|
|
65
|
+
direct lifecycle control.
|
|
66
|
+
|
|
67
|
+
See the
|
|
68
|
+
[quickstart](https://max-models.github.io/scope-profiler/quickstart.html)
|
|
69
|
+
and [profiling modes
|
|
70
|
+
guide](https://max-models.github.io/scope-profiler/guide/modes.html) for
|
|
71
|
+
recursive tracing, tags, concurrency, output formats, and advanced APIs.
|
|
72
|
+
|
|
73
|
+
## Profile a pytest suite
|
|
74
|
+
|
|
75
|
+
The installed package provides an opt-in pytest plugin. It records one
|
|
76
|
+
region for every selected test, named from its pytest node id, so the
|
|
77
|
+
normal post-processing commands can show which tests consume the suite’s
|
|
78
|
+
time:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pytest --scope-profile --scope-profile-out pytest-profile.h5
|
|
82
|
+
scope-profiler inspect pytest-profile.h5 --regions-only --sort total
|
|
83
|
+
scope-profiler plot durations pytest-profile.h5 -o pytest-plots
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
By default it measures only each test’s `call` phase. Include fixture
|
|
87
|
+
setup and teardown when those are relevant to the investigation:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
pytest --scope-profile --scope-profile-phases=all
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The plugin uses its own profiling manager, so tests that call
|
|
94
|
+
`ProfileManager.setup()` or `ProfileManager.finalize()` remain isolated.
|
|
95
|
+
The result measures complete test phases; it does not recursively trace
|
|
96
|
+
every function pytest calls. Existing application-level Scope Profiler
|
|
97
|
+
regions are therefore best collected in a dedicated application run when
|
|
98
|
+
detailed function-level attribution is needed. With `pytest-xdist`, the
|
|
99
|
+
plugin cannot yet be used: its workers must not write the same HDF5
|
|
100
|
+
file.
|
|
101
|
+
|
|
102
|
+
See the [profiling modes
|
|
103
|
+
guide](https://max-models.github.io/scope-profiler/guide/modes.html) for
|
|
104
|
+
output formats, filtering, concurrency, aggregation, pause/resume, and
|
|
105
|
+
sampling.
|
|
106
|
+
|
|
107
|
+
## In a notebook
|
|
108
|
+
|
|
109
|
+
Install the notebook extra and see the [notebook magics
|
|
110
|
+
guide](https://max-models.github.io/scope-profiler/guide/notebook_magics.html)
|
|
111
|
+
for cell profiling, recursive tracing, comparisons, and exports:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
pip install "scope-profiler[notebook]"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Documentation
|
|
118
|
+
|
|
119
|
+
- [Installation](https://max-models.github.io/scope-profiler/installation.html)
|
|
120
|
+
- [Quick
|
|
121
|
+
start](https://max-models.github.io/scope-profiler/quickstart.html)
|
|
122
|
+
- [Python API and
|
|
123
|
+
post-processing](https://max-models.github.io/scope-profiler/guide/hdf5_and_python_api.html)
|
|
124
|
+
- [CLI reference](https://max-models.github.io/scope-profiler/cli.html)
|
|
125
|
+
- [Plotly figures for the
|
|
126
|
+
web](https://max-models.github.io/scope-profiler/guide/plotly_package.html)
|
|
127
|
+
- [Configuration and profiling
|
|
128
|
+
regions](https://max-models.github.io/scope-profiler/guide/configuration.html)
|
|
129
|
+
- [MPI](https://max-models.github.io/scope-profiler/guide/mpi.html),
|
|
130
|
+
[C](https://max-models.github.io/scope-profiler/guide/c.html), and
|
|
131
|
+
[Fortran](https://max-models.github.io/scope-profiler/guide/fortran.html)
|
|
132
|
+
- [LIKWID](https://max-models.github.io/scope-profiler/guide/likwid.html),
|
|
133
|
+
[line
|
|
134
|
+
profiling](https://max-models.github.io/scope-profiler/guide/line_profiler.html),
|
|
135
|
+
and [MCP](https://max-models.github.io/scope-profiler/guide/mcp.html)
|
|
136
|
+
- [Jupyter/IPython
|
|
137
|
+
magics](https://max-models.github.io/scope-profiler/guide/notebook_magics.html)
|
|
138
|
+
- [Tutorial
|
|
139
|
+
notebooks](https://max-models.github.io/scope-profiler/tutorials.html)
|
|
140
|
+
- [Examples](https://github.com/max-models/scope-profiler/tree/devel/examples)
|
|
141
|
+
|
|
142
|
+
### Build the documentation locally
|
|
143
|
+
|
|
144
|
+
The hosted documentation is built with Sphinx from the `.qmd` sources.
|
|
145
|
+
Install [Quarto](https://quarto.org/docs/get-started/) and Pandoc first,
|
|
146
|
+
then create a development environment and run the docs target from the
|
|
147
|
+
repository root:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
python -m venv .venv
|
|
151
|
+
source .venv/bin/activate
|
|
152
|
+
python -m pip install --upgrade pip
|
|
153
|
+
pip install -e ".[docs]"
|
|
154
|
+
make -C docs html
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This refreshes the generated command output and Markdown sources before
|
|
158
|
+
building the HTML site. Open `docs/build/html/index.html` locally, or
|
|
159
|
+
serve that directory with any static-file server. The GitHub Pages
|
|
160
|
+
workflow uses the same `make -C docs html` command.
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
pip install -e '.[dev]'
|
|
166
|
+
pytest
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
See
|
|
170
|
+
[AGENTS.md](https://github.com/max-models/scope-profiler/blob/devel/AGENTS.md)
|
|
171
|
+
for the measured benchmark workflow used when optimizing this project.
|
|
@@ -549,6 +549,12 @@ def _region_table(results, rows, ranks, columns, region_ids=None) -> str:
|
|
|
549
549
|
if row["total"] is not None and session_total
|
|
550
550
|
else None
|
|
551
551
|
)
|
|
552
|
+
elif key == "parent_percent":
|
|
553
|
+
value = (
|
|
554
|
+
100.0 * row["coverage"] / row["parent_coverage"]
|
|
555
|
+
if row.get("coverage") is not None and row.get("parent_coverage")
|
|
556
|
+
else None
|
|
557
|
+
)
|
|
552
558
|
else:
|
|
553
559
|
value = row[key]
|
|
554
560
|
if key == "name":
|
|
@@ -568,6 +574,12 @@ def _region_table(results, rows, ranks, columns, region_ids=None) -> str:
|
|
|
568
574
|
if row["total"] is not None and session_total
|
|
569
575
|
else None
|
|
570
576
|
)
|
|
577
|
+
elif key == "parent_percent":
|
|
578
|
+
value = (
|
|
579
|
+
100.0 * row["coverage"] / row["parent_coverage"]
|
|
580
|
+
if row.get("coverage") is not None and row.get("parent_coverage")
|
|
581
|
+
else None
|
|
582
|
+
)
|
|
571
583
|
else:
|
|
572
584
|
value = row[key]
|
|
573
585
|
return "" if value is None else str(value)
|
|
@@ -15,6 +15,12 @@ from datetime import datetime, timezone
|
|
|
15
15
|
|
|
16
16
|
MetadataValue = str | int | list[str]
|
|
17
17
|
|
|
18
|
+
#: The accepted ``metadata_detail`` levels. ``"full"`` records everything this
|
|
19
|
+
#: module can collect. ``"minimal"`` keeps only what describes the run's shape
|
|
20
|
+
#: and software (versions, platform, CPU model, thread and rank counts) and
|
|
21
|
+
#: leaves out anything that names a person, a machine, a directory or a job.
|
|
22
|
+
METADATA_DETAILS = ("full", "minimal")
|
|
23
|
+
|
|
18
24
|
# Common OpenMP runtime library names across platforms/compilers.
|
|
19
25
|
_OMP_LIBRARY_NAMES = (
|
|
20
26
|
"libomp.so",
|
|
@@ -151,7 +157,19 @@ def _truncate(value: MetadataValue) -> MetadataValue:
|
|
|
151
157
|
return value
|
|
152
158
|
|
|
153
159
|
|
|
154
|
-
def
|
|
160
|
+
def check_metadata_detail(detail: str) -> str:
|
|
161
|
+
"""Return ``detail`` if it is a known level, else raise ``ValueError``."""
|
|
162
|
+
if detail not in METADATA_DETAILS:
|
|
163
|
+
raise ValueError(
|
|
164
|
+
f"metadata_detail must be one of {METADATA_DETAILS}, got {detail!r}",
|
|
165
|
+
)
|
|
166
|
+
return detail
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def collect_metadata(
|
|
170
|
+
mpi_size: int = 1,
|
|
171
|
+
detail: str = "full",
|
|
172
|
+
) -> dict[str, MetadataValue]:
|
|
155
173
|
"""Gather metadata describing the current run's environment.
|
|
156
174
|
|
|
157
175
|
Parameters
|
|
@@ -160,6 +178,13 @@ def collect_metadata(mpi_size: int = 1) -> dict[str, MetadataValue]:
|
|
|
160
178
|
Number of MPI ranks the run was launched with (default: 1). Used to
|
|
161
179
|
derive ``total_cores`` (``mpi_size * omp_num_threads``), a single
|
|
162
180
|
combined parallelism value useful as a scaling-plot x-axis.
|
|
181
|
+
detail : {"full", "minimal"}, optional
|
|
182
|
+
``"full"`` (default) records everything below. ``"minimal"`` records
|
|
183
|
+
only ``timestamp``, ``platform``, ``chip_information``,
|
|
184
|
+
``python_version``, ``scope_profiler_version``, ``omp_num_threads``,
|
|
185
|
+
``mpi_size`` and ``total_cores``: no user name, host name (also part
|
|
186
|
+
of ``uname``), working directory, loaded modules, environment
|
|
187
|
+
variables or ``SLURM_*`` variables.
|
|
163
188
|
|
|
164
189
|
Returns
|
|
165
190
|
-------
|
|
@@ -170,6 +195,7 @@ def collect_metadata(mpi_size: int = 1) -> dict[str, MetadataValue]:
|
|
|
170
195
|
upper-case names (``PATH``, ``SLURM_JOB_ID``, ...) and are only
|
|
171
196
|
present when set.
|
|
172
197
|
"""
|
|
198
|
+
check_metadata_detail(detail)
|
|
173
199
|
from importlib.metadata import PackageNotFoundError, version
|
|
174
200
|
|
|
175
201
|
try:
|
|
@@ -183,19 +209,26 @@ def collect_metadata(mpi_size: int = 1) -> dict[str, MetadataValue]:
|
|
|
183
209
|
# Wall-clock metadata is explicitly UTC. Timing data itself remains
|
|
184
210
|
# on perf_counter_ns(), whose monotonic origin is process-local.
|
|
185
211
|
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
186
|
-
"hostname": socket.gethostname(),
|
|
187
212
|
"platform": platform.platform(),
|
|
188
|
-
"uname": " ".join(platform.uname()),
|
|
189
213
|
"chip_information": _detect_chip_information(),
|
|
190
214
|
"python_version": platform.python_version(),
|
|
191
215
|
"scope_profiler_version": scope_profiler_version,
|
|
192
|
-
"working_directory": os.getcwd(),
|
|
193
216
|
"omp_num_threads": omp_num_threads,
|
|
194
217
|
"mpi_size": mpi_size,
|
|
195
218
|
"total_cores": mpi_size * omp_num_threads,
|
|
196
|
-
"user": getpass.getuser(),
|
|
197
|
-
"modules": _loaded_modules(),
|
|
198
219
|
}
|
|
199
|
-
|
|
220
|
+
if detail == "full":
|
|
221
|
+
metadata.update(
|
|
222
|
+
{
|
|
223
|
+
"hostname": socket.gethostname(),
|
|
224
|
+
# platform.uname() includes the node name, so it is as
|
|
225
|
+
# identifying as ``hostname`` and belongs to the full level.
|
|
226
|
+
"uname": " ".join(platform.uname()),
|
|
227
|
+
"working_directory": os.getcwd(),
|
|
228
|
+
"user": getpass.getuser(),
|
|
229
|
+
"modules": _loaded_modules(),
|
|
230
|
+
},
|
|
231
|
+
)
|
|
232
|
+
metadata.update(_collect_environment_variables())
|
|
200
233
|
|
|
201
234
|
return {key: _truncate(value) for key, value in metadata.items()}
|
|
@@ -15,7 +15,7 @@ except ModuleNotFoundError: # Python 3.10
|
|
|
15
15
|
tomllib = _tomllib
|
|
16
16
|
|
|
17
17
|
from scope_profiler.concurrency import ConcurrencyTracker
|
|
18
|
-
from scope_profiler.metadata import collect_metadata
|
|
18
|
+
from scope_profiler.metadata import check_metadata_detail, collect_metadata
|
|
19
19
|
from scope_profiler.mpi_launch import get_comm
|
|
20
20
|
|
|
21
21
|
if TYPE_CHECKING:
|
|
@@ -256,6 +256,13 @@ class ProfilingOptions:
|
|
|
256
256
|
walk), so it stays under a millisecond for a typical file but can
|
|
257
257
|
reach tenths of a second per rank for a single file with thousands
|
|
258
258
|
of lines, paid independently by every rank.
|
|
259
|
+
metadata_detail : {"full", "minimal"} or None
|
|
260
|
+
How much of the run's environment is recorded (default: ``"full"``).
|
|
261
|
+
``"minimal"`` drops the user name, host name, working directory,
|
|
262
|
+
loaded modules, environment variables and ``SLURM_*`` variables from
|
|
263
|
+
the run metadata, and stores only the file name (not the directory)
|
|
264
|
+
of each region's and line profile's source file. Use it for files
|
|
265
|
+
that will leave the machine they were recorded on.
|
|
259
266
|
buffer_limit : int or None
|
|
260
267
|
Initial number of profiling events preallocated per region (default:
|
|
261
268
|
1024). Buffers grow on demand, so this is a starting size rather
|
|
@@ -307,6 +314,7 @@ class ProfilingOptions:
|
|
|
307
314
|
track_threads: bool | None = None
|
|
308
315
|
track_async: bool | None = None
|
|
309
316
|
capture_region_source: bool | None = None
|
|
317
|
+
metadata_detail: str | None = None
|
|
310
318
|
buffer_limit: int | None = None
|
|
311
319
|
output_mode: str | None = None
|
|
312
320
|
hdf5_compression: str | None = None
|
|
@@ -384,6 +392,7 @@ class SetupOptions(TypedDict, total=False):
|
|
|
384
392
|
track_threads: bool
|
|
385
393
|
track_async: bool
|
|
386
394
|
capture_region_source: bool
|
|
395
|
+
metadata_detail: str
|
|
387
396
|
buffer_limit: int
|
|
388
397
|
output_mode: str
|
|
389
398
|
hdf5_compression: str
|
|
@@ -645,6 +654,7 @@ class ProfilingConfig:
|
|
|
645
654
|
track_threads: bool = False,
|
|
646
655
|
track_async: bool = False,
|
|
647
656
|
capture_region_source: bool = False,
|
|
657
|
+
metadata_detail: str = "full",
|
|
648
658
|
buffer_limit: int = 1024,
|
|
649
659
|
output_mode: str = "auto",
|
|
650
660
|
hdf5_compression: str | None = None,
|
|
@@ -718,6 +728,14 @@ class ProfilingConfig:
|
|
|
718
728
|
ranks, ~2.9s at 64, measured on a shared, oversubscribed login
|
|
719
729
|
node with such a file). Set to True to enable it; for a typical,
|
|
720
730
|
modestly sized codebase the cost is negligible.
|
|
731
|
+
metadata_detail : {"full", "minimal"}
|
|
732
|
+
How much of the run's environment is recorded. ``"full"``
|
|
733
|
+
(default) stores the user name, host name, working directory,
|
|
734
|
+
loaded modules, ``PATH``-like variables and ``SLURM_*``
|
|
735
|
+
variables. ``"minimal"`` stores only versions, platform, CPU
|
|
736
|
+
model and thread/rank counts, and reduces each region's and line
|
|
737
|
+
profile's source file to its bare file name. Region source *text*
|
|
738
|
+
is controlled separately by ``capture_region_source``.
|
|
721
739
|
buffer_limit : int
|
|
722
740
|
Initial number of in-memory records to preallocate per region.
|
|
723
741
|
The buffers grow on demand, so this is a starting size, not a cap.
|
|
@@ -815,6 +833,7 @@ class ProfilingConfig:
|
|
|
815
833
|
self._hdf5_compression_level = hdf5_compression_level
|
|
816
834
|
self._hdf5_chunk_size = hdf5_chunk_size
|
|
817
835
|
self._capture_region_source = capture_region_source
|
|
836
|
+
self._metadata_detail = check_metadata_detail(metadata_detail)
|
|
818
837
|
if aggregation_mode and (
|
|
819
838
|
use_line_profiler
|
|
820
839
|
or use_gpu_timing
|
|
@@ -875,7 +894,10 @@ class ProfilingConfig:
|
|
|
875
894
|
# Environment metadata (hostname, OpenMP threads, versions, ...).
|
|
876
895
|
# Collected on every rank, but only rank 0's copy ends up persisted
|
|
877
896
|
# (see ProfileManager.finalize), so it is treated as global for the run.
|
|
878
|
-
self._metadata = collect_metadata(
|
|
897
|
+
self._metadata = collect_metadata(
|
|
898
|
+
mpi_size=self._size,
|
|
899
|
+
detail=self._metadata_detail,
|
|
900
|
+
)
|
|
879
901
|
# Persisted so post-processing can express timestamps relative to the
|
|
880
902
|
# start of the run rather than to the first region entry.
|
|
881
903
|
self._metadata["start_time_ns"] = self._start_time_ns
|
|
@@ -884,7 +906,7 @@ class ProfilingConfig:
|
|
|
884
906
|
self._label = label or None
|
|
885
907
|
if self._label is not None:
|
|
886
908
|
self._metadata["label"] = self._label
|
|
887
|
-
if self._memory_profile_path is not None:
|
|
909
|
+
if self._memory_profile_path is not None and self._metadata_detail == "full":
|
|
888
910
|
self._metadata["memory_profile_path"] = str(self._memory_profile_path)
|
|
889
911
|
|
|
890
912
|
self._pylikwid: Any = None
|
|
@@ -1091,6 +1113,11 @@ class ProfilingConfig:
|
|
|
1091
1113
|
"""Return whether recursive decorator profiling is enabled by default."""
|
|
1092
1114
|
return self._recursive_profile
|
|
1093
1115
|
|
|
1116
|
+
@property
|
|
1117
|
+
def metadata_detail(self) -> str:
|
|
1118
|
+
"""``"full"`` or ``"minimal"``: how much environment metadata is recorded."""
|
|
1119
|
+
return self._metadata_detail
|
|
1120
|
+
|
|
1094
1121
|
@property
|
|
1095
1122
|
def capture_region_source(self) -> bool:
|
|
1096
1123
|
"""Return whether a region's defining source is captured at creation."""
|