├── VERSION ├── PACKAGE_VERSION ├── dfanalyzer_old ├── __init__.py ├── dask │ ├── conf │ │ ├── configuration.yaml │ │ ├── install_dask_env.sh │ │ ├── configuration.sh │ │ ├── ruby.yaml │ │ ├── quartz.yaml │ │ ├── corona.yaml │ │ └── polaris.yaml │ └── scripts │ │ ├── utils.sh │ │ ├── start_dask_worker.sh │ │ ├── stop_dask_distributed.sh │ │ └── start_dask_distributed.sh └── test.pfw.gz ├── docs ├── .gitignore ├── requirements.txt ├── .clang-format ├── images │ ├── tracing │ │ ├── trace.png │ │ ├── 1000genome.png │ │ ├── Montage_dur.png │ │ ├── Montage_graph.png │ │ └── Montage_summary.png │ ├── dlio-profiler-logo.png │ ├── perfetto │ │ ├── perfetto-viz.png │ │ ├── perfetto-interface.png │ │ ├── perfetto-ui-confirm.png │ │ ├── perfetto-sql-textbox-2.png │ │ ├── perfetto-sql-textbox.png │ │ ├── perfetto-flags-confirm-1.png │ │ ├── perfetto-flags-confirm-2.png │ │ └── perfetto-sql-result-example-pread.png │ └── dfanalyzer │ │ ├── polaris │ │ ├── run-scheduler.png │ │ ├── vscode-added-port.png │ │ ├── vscode-ports-tab.png │ │ ├── vscode-add-port-button.png │ │ └── dask-scheduler-monitoring.png │ │ └── overlap-analysis │ │ └── overlap-analysis-summary.png ├── _themes │ └── sphinx_rtd_theme │ │ ├── static │ │ └── fonts │ │ │ ├── Lato-Bold.ttf │ │ │ ├── Lato-Regular.ttf │ │ │ ├── RobotoSlab-Bold.ttf │ │ │ ├── Inconsolata-Bold.ttf │ │ │ ├── Inconsolata-Regular.ttf │ │ │ ├── RobotoSlab-Regular.ttf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.ttf │ │ │ ├── fontawesome-webfont.woff │ │ │ └── fontawesome-webfont.woff2 │ │ ├── theme.conf │ │ ├── searchbox.html │ │ ├── versions.html │ │ ├── search.html │ │ └── footer.html ├── ai_logging.rst ├── testing.rst ├── definitions.rst ├── overview.rst ├── dfanalyzer_build.rst ├── _static │ └── theme_overrides.css ├── limitations.rst ├── debugging.rst ├── dfanalyzer_custom_columns.rst ├── utilities.rst ├── index.rst ├── building_applications.rst ├── models.rst └── style-guides.rst ├── .clang-format ├── .gitlab └── scripts │ ├── generate_dlio_jobs.sh │ ├── requirements.txt │ ├── variables.sh │ ├── hip_requirements.txt │ ├── run_dft_hip_test.sh │ ├── dlio_setup.sh │ ├── build_dft.sh │ ├── create_log_dir.sh │ ├── common.yml │ ├── build.sh │ └── pre.sh ├── test ├── c │ ├── testlib.c │ └── test.c ├── unit │ ├── file.dat │ ├── mmap │ ├── CMakeLists.txt │ └── mmap.cpp ├── py │ ├── requirements.txt │ ├── dynamo_test.py │ ├── hip_test.py │ └── python_test.py ├── check_file_not.sh ├── yaml │ ├── benchmark-rules.yaml │ ├── rules.yaml │ └── conf.yaml ├── package_find │ ├── version_exact │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── version_compatible │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── version_minimum │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── version_old_major │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── version_higher_minor │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── version_wrong_exact │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── version_incompatible_major │ │ ├── test_version.cpp │ │ └── CMakeLists.txt │ ├── test_external.cpp │ └── CMakeLists.txt ├── dfanalyzer │ └── CMakeLists.txt ├── analysis_ior.py ├── util.h ├── check_file.sh ├── check_file_at_least.sh ├── paper │ ├── overhead.py │ └── load_recorder.py └── dlio_benchmark │ └── CMakeLists.txt ├── examples ├── graph_visualization │ ├── requirement.txt │ ├── data.png │ ├── vis.png │ ├── test_data1.pfw │ └── README.md └── dfanalyzer │ ├── requirements.txt │ ├── test-trace.pfw.gz │ ├── images │ ├── bw_timeline.png │ ├── xfer_timeline.png │ └── dask-dashboard-load.png │ └── test-trace-distributed │ └── cm1_1_48_20240926 │ ├── cm1-DEFAULT-3537780-preload.pfw.gz │ ├── cm1-DEFAULT-3537781-preload.pfw.gz │ ├── cm1-DEFAULT-3537782-preload.pfw.gz │ ├── cm1-DEFAULT-3537783-preload.pfw.gz │ ├── cm1-DEFAULT-3537784-preload.pfw.gz │ ├── cm1-DEFAULT-3537785-preload.pfw.gz │ ├── cm1-DEFAULT-3537786-preload.pfw.gz │ ├── cm1-DEFAULT-3537787-preload.pfw.gz │ ├── cm1-DEFAULT-3537788-preload.pfw.gz │ ├── cm1-DEFAULT-3537789-preload.pfw.gz │ ├── cm1-DEFAULT-3537790-preload.pfw.gz │ ├── cm1-DEFAULT-3537791-preload.pfw.gz │ ├── cm1-DEFAULT-3537793-preload.pfw.gz │ ├── cm1-DEFAULT-3537796-preload.pfw.gz │ ├── cm1-DEFAULT-3537798-preload.pfw.gz │ ├── cm1-DEFAULT-3537799-preload.pfw.gz │ ├── cm1-DEFAULT-3537800-preload.pfw.gz │ ├── cm1-DEFAULT-3537801-preload.pfw.gz │ ├── cm1-DEFAULT-3537802-preload.pfw.gz │ ├── cm1-DEFAULT-3537803-preload.pfw.gz │ ├── cm1-DEFAULT-3537804-preload.pfw.gz │ ├── cm1-DEFAULT-3537805-preload.pfw.gz │ ├── cm1-DEFAULT-3537806-preload.pfw.gz │ ├── cm1-DEFAULT-3537807-preload.pfw.gz │ ├── cm1-DEFAULT-3537808-preload.pfw.gz │ ├── cm1-DEFAULT-3537809-preload.pfw.gz │ ├── cm1-DEFAULT-3537810-preload.pfw.gz │ ├── cm1-DEFAULT-3537811-preload.pfw.gz │ ├── cm1-DEFAULT-3537812-preload.pfw.gz │ ├── cm1-DEFAULT-3537813-preload.pfw.gz │ ├── cm1-DEFAULT-3537814-preload.pfw.gz │ ├── cm1-DEFAULT-3537815-preload.pfw.gz │ ├── cm1-DEFAULT-3537816-preload.pfw.gz │ ├── cm1-DEFAULT-3537817-preload.pfw.gz │ ├── cm1-DEFAULT-3537818-preload.pfw.gz │ ├── cm1-DEFAULT-3537819-preload.pfw.gz │ ├── cm1-DEFAULT-3537820-preload.pfw.gz │ ├── cm1-DEFAULT-3537821-preload.pfw.gz │ ├── cm1-DEFAULT-3537822-preload.pfw.gz │ ├── cm1-DEFAULT-3537823-preload.pfw.gz │ ├── cm1-DEFAULT-3537824-preload.pfw.gz │ ├── cm1-DEFAULT-3537825-preload.pfw.gz │ ├── cm1-DEFAULT-3537826-preload.pfw.gz │ ├── cm1-DEFAULT-3537827-preload.pfw.gz │ ├── cm1-DEFAULT-3537828-preload.pfw.gz │ ├── cm1-DEFAULT-3537829-preload.pfw.gz │ ├── cm1-DEFAULT-3537830-preload.pfw.gz │ └── cm1-DEFAULT-3537831-preload.pfw.gz ├── cmake ├── tests │ ├── has_filesystem.cpp │ └── has_fd.cpp └── configure_files │ ├── dftracer-config-version.cmake.in │ ├── dftracer_module.lua.in │ ├── dftracer_config.hpp.in │ └── dftracer_config_dbg.hpp.in ├── MANIFEST.in ├── python └── dftracer │ └── __init__.py ├── src └── dftracer │ ├── core │ ├── utils │ │ ├── utils.cpp │ │ ├── md5.h │ │ ├── posix_internal.h │ │ ├── configuration_manager.h │ │ └── posix_internal.cpp │ ├── df_logger.cpp │ ├── writer │ │ ├── stdio_writer.cpp │ │ └── stdio_writer.h │ ├── dftracer_preload.h │ ├── compression │ │ ├── zlib_compression.cpp │ │ └── zlib_compression.h │ ├── function │ │ └── generic_function.h │ ├── datastructure.cpp │ ├── common │ │ ├── datastructure.cpp │ │ ├── error.h │ │ ├── singleton.h │ │ └── dftracer_main.h │ ├── dftracer_preload.cpp │ ├── finstrument │ │ ├── functions.h │ │ └── functions.cpp │ ├── serialization │ │ └── json_line.h │ ├── aggregator │ │ ├── rules.h │ │ └── aggregator.cpp │ └── buffer │ │ └── buffer.h │ ├── python │ ├── dftracer_dbg.cpp │ └── dftracer.cpp │ └── service │ └── common │ └── datastructure.h ├── .github └── workflows │ ├── pull_request_event.json │ ├── format-check.yml │ ├── python-publish.yml │ └── docker-publish.yml ├── compose-dev.yaml ├── dependency ├── cpp.requirements.txt ├── install_dependency.sh └── CMakeLists.txt ├── Dockerfile ├── include └── dftracer │ └── core │ └── common │ ├── typedef.h │ ├── cpp_typedefs.h │ └── constants.h ├── .actrc ├── results └── overhead.csv ├── .gitpod.yml ├── docker ├── ior.Dockerfile └── dl.Dockerfile ├── .readthedocs.yaml ├── .coveragerc ├── .devcontainer ├── docker-compose.yml └── devcontainer.json ├── LICENSE ├── script ├── generate_coverage.sh ├── formatting │ ├── autoformat.sh │ └── check-formatting.sh └── dftracer_pgzip ├── infrastructure └── docker │ └── QUICK_REFERENCE.md ├── .gitignore └── .gitlab-ci.yml /VERSION: -------------------------------------------------------------------------------- 1 | 4.0.0 2 | -------------------------------------------------------------------------------- /PACKAGE_VERSION: -------------------------------------------------------------------------------- 1 | 2.0.2 2 | -------------------------------------------------------------------------------- /dfanalyzer_old/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/.gitignore: -------------------------------------------------------------------------------- 1 | _build 2 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | BasedOnStyle: Google -------------------------------------------------------------------------------- /.gitlab/scripts/generate_dlio_jobs.sh: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/c/testlib.c: -------------------------------------------------------------------------------- 1 | int bar() { return 0; } -------------------------------------------------------------------------------- /test/unit/file.dat: -------------------------------------------------------------------------------- 1 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa -------------------------------------------------------------------------------- /.gitlab/scripts/requirements.txt: -------------------------------------------------------------------------------- 1 | tqdm 2 | pandas 3 | colorama -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx<7.0.0 2 | sphinx-rtd-theme 3 | -------------------------------------------------------------------------------- /docs/.clang-format: -------------------------------------------------------------------------------- 1 | DisableFormat: true 2 | SortIncludes: Never 3 | -------------------------------------------------------------------------------- /test/py/requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | Pillow 3 | h5py 4 | opencv-python 5 | torch -------------------------------------------------------------------------------- /test/unit/mmap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/test/unit/mmap -------------------------------------------------------------------------------- /examples/graph_visualization/requirement.txt: -------------------------------------------------------------------------------- 1 | ipycytoscape 2 | networkx 3 | ipywidgets -------------------------------------------------------------------------------- /examples/dfanalyzer/requirements.txt: -------------------------------------------------------------------------------- 1 | jupyterlab 2 | jupyter-server-proxy 3 | ipywidgets 4 | msticpy -------------------------------------------------------------------------------- /dfanalyzer_old/dask/conf/configuration.yaml: -------------------------------------------------------------------------------- 1 | app: /usr/WS2/haridev/dftracer 2 | env: ${DFTRACER_APP}/venv -------------------------------------------------------------------------------- /dfanalyzer_old/test.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/dfanalyzer_old/test.pfw.gz -------------------------------------------------------------------------------- /docs/images/tracing/trace.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/tracing/trace.png -------------------------------------------------------------------------------- /docs/images/dlio-profiler-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dlio-profiler-logo.png -------------------------------------------------------------------------------- /docs/images/tracing/1000genome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/tracing/1000genome.png -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-viz.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-viz.png -------------------------------------------------------------------------------- /docs/images/tracing/Montage_dur.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/tracing/Montage_dur.png -------------------------------------------------------------------------------- /docs/images/tracing/Montage_graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/tracing/Montage_graph.png -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace.pfw.gz -------------------------------------------------------------------------------- /examples/graph_visualization/data.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/graph_visualization/data.png -------------------------------------------------------------------------------- /examples/graph_visualization/vis.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/graph_visualization/vis.png -------------------------------------------------------------------------------- /docs/images/tracing/Montage_summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/tracing/Montage_summary.png -------------------------------------------------------------------------------- /examples/dfanalyzer/images/bw_timeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/images/bw_timeline.png -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-interface.png -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-ui-confirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-ui-confirm.png -------------------------------------------------------------------------------- /examples/dfanalyzer/images/xfer_timeline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/images/xfer_timeline.png -------------------------------------------------------------------------------- /cmake/tests/has_filesystem.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | int main() 5 | { 6 | std::filesystem::path p{"."}; 7 | return 0; 8 | } -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-sql-textbox-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-sql-textbox-2.png -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-sql-textbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-sql-textbox.png -------------------------------------------------------------------------------- /docs/images/dfanalyzer/polaris/run-scheduler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dfanalyzer/polaris/run-scheduler.png -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-flags-confirm-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-flags-confirm-1.png -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-flags-confirm-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-flags-confirm-2.png -------------------------------------------------------------------------------- /docs/images/dfanalyzer/polaris/vscode-added-port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dfanalyzer/polaris/vscode-added-port.png -------------------------------------------------------------------------------- /docs/images/dfanalyzer/polaris/vscode-ports-tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dfanalyzer/polaris/vscode-ports-tab.png -------------------------------------------------------------------------------- /examples/dfanalyzer/images/dask-dashboard-load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/images/dask-dashboard-load.png -------------------------------------------------------------------------------- /test/check_file_not.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | expected_lines=$2 3 | if ls $1 1> /dev/null 2>&1; then 4 | ls $1 5 | rm -r $1 2> /dev/null 6 | exit 1 7 | fi -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /docs/images/dfanalyzer/polaris/vscode-add-port-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dfanalyzer/polaris/vscode-add-port-button.png -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /docs/images/perfetto/perfetto-sql-result-example-pread.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/perfetto/perfetto-sql-result-example-pread.png -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/RobotoSlab-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/RobotoSlab-Bold.ttf -------------------------------------------------------------------------------- /docs/images/dfanalyzer/polaris/dask-scheduler-monitoring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dfanalyzer/polaris/dask-scheduler-monitoring.png -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/Inconsolata-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/Inconsolata-Bold.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/RobotoSlab-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/RobotoSlab-Regular.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /test/yaml/benchmark-rules.yaml: -------------------------------------------------------------------------------- 1 | inclusion: 2 | - cat == 'POSIX' 3 | - name LIKE '*stat*' 4 | exclusion: 5 | - name LIKE '*read*' 6 | - name LIKE '*write*' 7 | - dur > 10000 -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/_themes/sphinx_rtd_theme/static/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /docs/images/dfanalyzer/overlap-analysis/overlap-analysis-summary.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/docs/images/dfanalyzer/overlap-analysis/overlap-analysis-summary.png -------------------------------------------------------------------------------- /dfanalyzer_old/dask/conf/install_dask_env.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir -p ~/.dftracer 4 | cp configuration* ~/.dftracer/ 5 | 6 | echo "Update the root of dftracer in ~/.dftracer/configuration.yaml" -------------------------------------------------------------------------------- /test/yaml/rules.yaml: -------------------------------------------------------------------------------- 1 | inclusion: 2 | - cat IN {'POSIX', 'STDIO'} 3 | - name == 'close' OR name == 'fclose' 4 | - name LIKE '*stat*' AND app LIKE 'test*' 5 | exclusion: 6 | - NOT dur < 1000 -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | graft src 2 | graft cmake 3 | graft dependency 4 | graft include 5 | graft script 6 | 7 | include CMakeLists.txt 8 | include LICENSE 9 | include README.md 10 | include VERSION 11 | include PACKAGE_VERSION -------------------------------------------------------------------------------- /python/dftracer/__init__.py: -------------------------------------------------------------------------------- 1 | from importlib.metadata import version, PackageNotFoundError 2 | 3 | try: 4 | __version__ = version("dftracer") 5 | except PackageNotFoundError: 6 | # package is not installed 7 | pass -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537780-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537780-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537781-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537781-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537782-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537782-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537783-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537783-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537784-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537784-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537785-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537785-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537786-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537786-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537787-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537787-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537788-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537788-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537789-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537789-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537790-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537790-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537791-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537791-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537793-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537793-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537796-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537796-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537798-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537798-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537799-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537799-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537800-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537800-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537801-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537801-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537802-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537802-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537803-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537803-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537804-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537804-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537805-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537805-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537806-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537806-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537807-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537807-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537808-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537808-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537809-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537809-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537810-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537810-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537811-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537811-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537812-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537812-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537813-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537813-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537814-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537814-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537815-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537815-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537816-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537816-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537817-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537817-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537818-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537818-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537819-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537819-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537820-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537820-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537821-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537821-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537822-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537822-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537823-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537823-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537824-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537824-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537825-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537825-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537826-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537826-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537827-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537827-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537828-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537828-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537829-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537829-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537830-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537830-preload.pfw.gz -------------------------------------------------------------------------------- /examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537831-preload.pfw.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/llnl/dftracer/HEAD/examples/dfanalyzer/test-trace-distributed/cm1_1_48_20240926/cm1-DEFAULT-3537831-preload.pfw.gz -------------------------------------------------------------------------------- /src/dftracer/core/utils/utils.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | template <> 3 | std::shared_ptr dftracer::Singleton::instance = nullptr; 4 | template <> 5 | bool dftracer::Singleton::stop_creating_instances = false; -------------------------------------------------------------------------------- /.gitlab/scripts/variables.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export CUSTOM_CI_ENV_DIR=$(eval "echo $CUSTOM_CI_ENV_DIR") 4 | export CUSTOM_CI_OUTPUR_DIR=$(eval "echo $CUSTOM_CI_OUTPUR_DIR") 5 | export DATA_PATH=$(eval "echo $DATA_PATH") 6 | export PROJECT_PATH=$PWD -------------------------------------------------------------------------------- /src/dftracer/core/df_logger.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | template <> 3 | std::shared_ptr dftracer::Singleton::instance = nullptr; 4 | template <> 5 | bool dftracer::Singleton::stop_creating_instances = false; -------------------------------------------------------------------------------- /.github/workflows/pull_request_event.json: -------------------------------------------------------------------------------- 1 | { 2 | "pull_request": { 3 | "number": 334, 4 | "head": { 5 | "ref": "feature/docker", 6 | "sha": "local-test" 7 | }, 8 | "base": { 9 | "ref": "develop" 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /compose-dev.yaml: -------------------------------------------------------------------------------- 1 | version: "3.8" 2 | 3 | services: 4 | app: 5 | build: 6 | context: . 7 | dockerfile: Dockerfile 8 | volumes: 9 | - .:/app 10 | ports: 11 | - "8000:8000" 12 | environment: 13 | - ENV=development 14 | command: ["/bin/bash"] 15 | -------------------------------------------------------------------------------- /test/package_find/version_exact/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/package_find/version_compatible/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/package_find/version_minimum/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/package_find/version_old_major/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/package_find/version_higher_minor/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /test/package_find/version_wrong_exact/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /docs/ai_logging.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | AI/DL Logging 3 | ====================== 4 | 5 | For detailed information about using DFTracer AI/ML logging features, please refer to the comprehensive guide: 6 | 7 | `AI/ML Logging Guide `_ 8 | -------------------------------------------------------------------------------- /test/package_find/version_incompatible_major/test_version.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | std::cout << "Version test application" << std::endl; 7 | std::cout << "Successfully compiled and linked with dftracer" << std::endl; 8 | return 0; 9 | } 10 | -------------------------------------------------------------------------------- /dependency/cpp.requirements.txt: -------------------------------------------------------------------------------- 1 | cpp-logger,https://github.com/hariharan-devarajan/cpp-logger.git,v0.0.3,1,tag, 2 | gotcha,https://github.com/LLNL/GOTCHA.git,1.0.5,1,tag, 3 | brahma,https://github.com/hariharan-devarajan/brahma.git,v0.0.3,1,tag, 4 | yaml-cpp,https://github.com/jbeder/yaml-cpp.git,yaml-cpp-0.6.3,1,tag,"-DYAML_BUILD_SHARED_LIBS=On" -------------------------------------------------------------------------------- /docs/testing.rst: -------------------------------------------------------------------------------- 1 | ============= 2 | Testing Guide 3 | ============= 4 | 5 | We can never have enough testing. Any additional tests you can write are always 6 | greatly appreciated. 7 | 8 | ---------- 9 | Unit Tests 10 | ---------- 11 | 12 | Testing new core features within DFTracer should be implemented in the ``test`` using simple programs -------------------------------------------------------------------------------- /src/dftracer/core/writer/stdio_writer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | namespace dftracer { 4 | template <> 5 | std::shared_ptr Singleton::instance = nullptr; 6 | template <> 7 | bool Singleton::stop_creating_instances = false; 8 | } // namespace dftracer -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/theme.conf: -------------------------------------------------------------------------------- 1 | [theme] 2 | inherit = basic 3 | stylesheet = css/theme.css 4 | 5 | [options] 6 | typekit_id = hiw1hhg 7 | analytics_id = 8 | sticky_navigation = False 9 | logo_only = 10 | collapse_navigation = False 11 | display_version = True 12 | navigation_depth = 4 13 | prev_next_buttons_location = bottom 14 | canonical_url = 15 | -------------------------------------------------------------------------------- /src/dftracer/core/dftracer_preload.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 3/28/23. 3 | // 4 | 5 | #ifndef DFTRACER_DFTRACER_PRELOAD_H 6 | #define DFTRACER_DFTRACER_PRELOAD_H 7 | 8 | extern void __attribute__((constructor)) dftracer_init(void); 9 | 10 | extern void __attribute__((destructor)) dftracer_fini(void); 11 | 12 | #endif // DFTRACER_DFTRACER_PRELOAD_H 13 | -------------------------------------------------------------------------------- /src/dftracer/core/compression/zlib_compression.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | namespace dftracer { 4 | template <> 5 | std::shared_ptr Singleton::instance = nullptr; 6 | template <> 7 | bool Singleton::stop_creating_instances = false; 8 | } // namespace dftracer -------------------------------------------------------------------------------- /.gitlab/scripts/hip_requirements.txt: -------------------------------------------------------------------------------- 1 | https://repo.radeon.com/rocm/manylinux/rocm-rel-6.3.1/torch-2.5.1%2Brocm6.3.1.lw-cp311-cp311-linux_x86_64.whl 2 | https://repo.radeon.com/rocm/manylinux/rocm-rel-6.3.1/torchvision-0.20.0%2Brocm6.3.1-cp311-cp311-linux_x86_64.whl 3 | https://repo.radeon.com/rocm/manylinux/rocm-rel-6.3.1/pytorch_triton_rocm-3.1.0%2Brocm6.3.1.ec5320655a-cp311-cp311-linux_x86_64.whl -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:24.04 as base 2 | ADD . /workspace/dftracer 3 | WORKDIR /workspace/dftracer 4 | RUN apt-get update && apt-get install -y python3 python3-pip openmpi-bin openmpi-common libopenmpi-dev 5 | RUN apt-get install -y git cmake python3.10 python3-pip python3-venv cmake libyaml-cpp-dev 6 | RUN python3 -m venv /workspace/venv 7 | ENV PATH="/workspace/venv/bin:$PATH" 8 | RUN cd /workspace/dftracer -------------------------------------------------------------------------------- /include/dftracer/core/common/typedef.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 10/7/23. 3 | // 4 | 5 | #ifndef DFTRACER_TYPEDEF_H 6 | #define DFTRACER_TYPEDEF_H 7 | typedef unsigned long long int TimeResolution; 8 | typedef unsigned long int ThreadID; 9 | typedef int ProcessID; 10 | typedef char* EventNameType; 11 | typedef const char* ConstEventNameType; 12 | typedef char* HashType; 13 | #endif // DFTRACER_TYPEDEF_H 14 | -------------------------------------------------------------------------------- /test/yaml/conf.yaml: -------------------------------------------------------------------------------- 1 | enable: True 2 | profiler: 3 | init: FUNCTION 4 | log_file: trace 5 | data_dirs: ./data 6 | log_level: DEBUG 7 | compression: True 8 | gotcha: 9 | priority: 1 10 | features: 11 | metadata: True 12 | core_affinity: True 13 | io: 14 | enable: True 15 | posix: True 16 | stdio: True 17 | tid: True 18 | internal: 19 | bind_signals: True 20 | throw_error: False 21 | -------------------------------------------------------------------------------- /include/dftracer/core/common/cpp_typedefs.h: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_CORE_CPP_TYPEDEF_H 2 | #define DFTRACER_CORE_CPP_TYPEDEF_H 3 | // standard headers 4 | #include 5 | #include 6 | #include 7 | 8 | // forward declare 9 | namespace dftracer { 10 | class Metadata; 11 | }; 12 | 13 | // internal headers 14 | #include 15 | #endif // DFTRACER_CORE_CPP_TYPEDEF_H -------------------------------------------------------------------------------- /.actrc: -------------------------------------------------------------------------------- 1 | # act configuration for running GitHub Actions locally 2 | # Use Ubuntu 22.04 image to match CI runner 3 | -P ubuntu-22.04=catthehacker/ubuntu:act-22.04 4 | -P ubuntu-latest=catthehacker/ubuntu:act-22.04 5 | 6 | # Use .secrets file for secrets (create this file with your secrets) 7 | --secret-file .secrets 8 | 9 | # Run as pull_request event by default 10 | --eventpath .github/workflows/pull_request_event.json 11 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/searchbox.html: -------------------------------------------------------------------------------- 1 | {%- if builder != 'singlehtml' %} 2 |
3 |
4 | 5 | 6 | 7 |
8 |
9 | {%- endif %} 10 | -------------------------------------------------------------------------------- /docs/definitions.rst: -------------------------------------------------------------------------------- 1 | ================ 2 | Definitions 3 | ================ 4 | 5 | This section defines some terms used throughout the document. 6 | 7 | 1. *Category (cat)* : The event categories. This is a comma separated list of categories for the event. The categories can be used to group similar events. 8 | 2. *Name (name)* : The name of the event. 9 | 10 | The format of DFTracer is based on `chrome tracing document `_. -------------------------------------------------------------------------------- /results/overhead.csv: -------------------------------------------------------------------------------- 1 | access_type,mode,baseline_avg,baseline_std,mode_avg,mode_std,overhead_percent 2 | write,none,1269.50,467.43,1269.50,467.43,0.00 3 | write,profile,1269.50,467.43,1281.83,483.61,0.97 4 | write,selective,1269.50,467.43,1280.90,459.65,0.90 5 | write,trace,1269.50,467.43,1271.63,446.90,0.17 6 | read,none,7877.79,5630.10,7877.79,5630.10,0.00 7 | read,profile,7877.79,5630.10,8444.18,6018.35,7.19 8 | read,selective,7877.79,5630.10,8431.36,6111.45,7.03 9 | read,trace,7877.79,5630.10,8401.33,6099.77,6.65 10 | -------------------------------------------------------------------------------- /.gitlab/scripts/run_dft_hip_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export DFTRACER_ENABLE=1 4 | cd $CUSTOM_CI_BUILDS_DIR 5 | 6 | # Clone if it doesn't exist 7 | if [ ! -d "$CUSTOM_CI_BUILDS_DIR/dftracer" ]; then 8 | git clone $DFTRACER_REPO $CUSTOM_CI_BUILDS_DIR/dftracer 9 | fi 10 | 11 | cd dftracer 12 | 13 | git checkout $CI_COMMIT_REF_NAME 14 | 15 | export QUEUE=pdebug 16 | export WALLTIME=1h 17 | 18 | source $CUSTOM_CI_ENV_DIR/$ENV_NAME/bin/activate 19 | 20 | flux run -N1 -q $QUEUE -t $WALLTIME --exclusive python3 test/py/hip_test.py 21 | -------------------------------------------------------------------------------- /test/package_find/test_external.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | int main() { 6 | // Initialize DFTracer 7 | DFTRACER_CPP_INIT(nullptr, nullptr, nullptr); 8 | 9 | // Test basic functionality 10 | DFTRACER_CPP_METADATA(test_meta, "app", "external_test"); 11 | 12 | { 13 | DFTRACER_CPP_REGION(TEST_REGION); 14 | std::cout << "External test application successfully linked with dftracer" 15 | << std::endl; 16 | } 17 | 18 | DFTRACER_CPP_FINI(); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /test/package_find/version_old_major/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with different (older) major version (should fail) 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_old_major_test CXX) 5 | 6 | # Should fail - different major version is incompatible (SameMajorVersion policy) 7 | find_package(dftracer @DFTRACER_PREV_MAJOR@.9.9 REQUIRED) 8 | 9 | add_executable(version_old_major_test test_version.cpp) 10 | target_link_libraries(version_old_major_test dftracer::dftracer_core) 11 | -------------------------------------------------------------------------------- /test/package_find/version_incompatible_major/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with incompatible major version (should fail) 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_incompatible_major_test CXX) 5 | 6 | # Should fail - major version (current+1) is incompatible 7 | find_package(dftracer @DFTRACER_NEXT_MAJOR@.0.0 REQUIRED) 8 | 9 | add_executable(version_incompatible_major_test test_version.cpp) 10 | target_link_libraries(version_incompatible_major_test dftracer::dftracer_core) 11 | -------------------------------------------------------------------------------- /test/package_find/version_minimum/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with minimum version requirement 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_minimum_test CXX) 5 | 6 | # Should succeed - current version >= (major.0.0) 7 | find_package(dftracer @DFTRACER_VERSION_MAJOR@.0.0 REQUIRED) 8 | 9 | add_executable(version_minimum_test test_version.cpp) 10 | target_link_libraries(version_minimum_test dftracer::dftracer_core) 11 | 12 | message(STATUS "Found dftracer version: ${DFTRACER_VERSION}") 13 | -------------------------------------------------------------------------------- /test/package_find/version_higher_minor/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with higher minor version (should fail based on SameMajorVersion) 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_higher_minor_test CXX) 5 | 6 | # Should fail - requesting higher minor version than available 7 | find_package(dftracer @DFTRACER_VERSION_MAJOR@.@DFTRACER_NEXT_MINOR@.0 REQUIRED) 8 | 9 | add_executable(version_higher_minor_test test_version.cpp) 10 | target_link_libraries(version_higher_minor_test dftracer::dftracer_core) 11 | -------------------------------------------------------------------------------- /test/package_find/version_wrong_exact/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with wrong exact version (should fail) 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_wrong_exact_test CXX) 5 | 6 | # Should fail - exact version with wrong patch doesn't match 7 | find_package(dftracer @DFTRACER_VERSION_MAJOR@.@DFTRACER_VERSION_MINOR@.@DFTRACER_WRONG_PATCH@ EXACT REQUIRED) 8 | 9 | add_executable(version_wrong_exact_test test_version.cpp) 10 | target_link_libraries(version_wrong_exact_test dftracer::dftracer_core) 11 | -------------------------------------------------------------------------------- /test/package_find/version_exact/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with exact version match 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_exact_test CXX) 5 | 6 | # Should succeed - exact version match 7 | find_package(dftracer @DFTRACER_VERSION_MAJOR@.@DFTRACER_VERSION_MINOR@.@DFTRACER_VERSION_PATCH@ EXACT REQUIRED) 8 | 9 | add_executable(version_exact_test test_version.cpp) 10 | target_link_libraries(version_exact_test dftracer::dftracer_core) 11 | 12 | message(STATUS "Found dftracer version: ${DFTRACER_VERSION}") 13 | -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | # This configuration file was automatically generated by Gitpod. 2 | # Please adjust to your needs (see https://www.gitpod.io/docs/introduction/learn-gitpod/gitpod-yaml) 3 | # and commit this file to your remote git repository to share the goodness with others. 4 | 5 | # Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart 6 | 7 | tasks: 8 | - name: Install Dependencies 9 | before: sudo apt-get update && sudo apt-get install -y libtool-bin openmpi-bin libopenmpi-dev 10 | command: python -m venv /workspace/venv && /workspace/venv/bin/pip install . -------------------------------------------------------------------------------- /docs/overview.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | Overview 3 | ======== 4 | 5 | DFTracer is I/O Profiling tool with the capability to doing application level as well as low-level I/O profiling. 6 | Current I/O profilers such as Darshan and Recorder do not allow application level and I/O level profiling which makes it hard to analyze workloads such as AI and workflows. 7 | To this end, we build a c++ profiler with binding to c and python. Additionally, we intercept low-level POSIX calls along with capturing Application level calls using APIs. 8 | 9 | 1. For build instructions see :doc:`build` 10 | 2. For api see :doc:`api` 11 | 3. For examples see :doc:`examples` -------------------------------------------------------------------------------- /.github/workflows/format-check.yml: -------------------------------------------------------------------------------- 1 | name: Check code formatting 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: [ develop, stage-in ] 7 | workflow_dispatch: 8 | 9 | jobs: 10 | cpp-format-check: 11 | runs-on: ubuntu-24.04 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | 16 | - name: Install clang-format 17 | run: | 18 | sudo apt-get update 19 | sudo apt-get install -y --no-install-recommends \ 20 | build-essential \ 21 | clang-format-19 22 | 23 | - name: Test formatting 24 | run: | 25 | ./script/formatting/check-formatting.sh /usr/bin/clang-format-19 -------------------------------------------------------------------------------- /test/package_find/version_compatible/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Test find_package with compatible version (same major.minor.patch) 2 | # This file is auto-configured from CMakeLists.txt.in 3 | cmake_minimum_required(VERSION 3.20) 4 | project(dftracer_version_compatible_test CXX) 5 | 6 | # Should succeed - exact version match without EXACT keyword 7 | find_package(dftracer @DFTRACER_VERSION_MAJOR@.@DFTRACER_VERSION_MINOR@.@DFTRACER_VERSION_PATCH@ REQUIRED) 8 | 9 | add_executable(version_compatible_test test_version.cpp) 10 | target_link_libraries(version_compatible_test dftracer::dftracer_core) 11 | 12 | message(STATUS "Found dftracer version: ${DFTRACER_VERSION}") 13 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/scripts/utils.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | function parse_yaml { 3 | local prefix=$2 4 | local s='[[:space:]]*' w='[a-zA-Z0-9_]*' fs=$(echo @ | tr @ '\034') 5 | sed -ne "s|^\($s\):|\1|" -e "s|^\($s\)\($w\)$s:$s[\"']\(.*\)[\"']$s\$|\1$fs\2$fs\3|p" \ 6 | -e "s|^\($s\)\($w\)$s:$s\(.*\)$s\$|\1$fs\2$fs\3|p" $1 | 7 | awk -F$fs '{ 8 | indent = length($1)/2; 9 | vname[indent] = toupper($2); 10 | for (i in vname) {if (i > indent) {delete vname[i]}} 11 | if (length($3) > 0) { 12 | vn=""; for (i=0; i indent) {delete vname[i]}} 11 | if (length($3) > 0) { 12 | vn=""; for (i=0; i 5 | #include 6 | #include 7 | #include 8 | 9 | typedef struct { 10 | uint64_t size; // Size of input in bytes 11 | uint32_t buffer[4]; // Current accumulation of hash 12 | uint8_t input[64]; // Input to be used in the next step 13 | uint8_t digest[16]; // Result of algorithm 14 | } MD5Context; 15 | 16 | void md5Init(MD5Context *ctx); 17 | void md5Update(MD5Context *ctx, uint8_t *input, size_t input_len); 18 | void md5Finalize(MD5Context *ctx); 19 | void md5Step(uint32_t *buffer, uint32_t *input); 20 | 21 | void md5String(char *input, uint8_t *result); 22 | void md5File(FILE *file, uint8_t *result); 23 | 24 | #endif -------------------------------------------------------------------------------- /dfanalyzer_old/dask/conf/ruby.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | script_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/scripts 3 | conf_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/conf 4 | run_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/run_dir 5 | log_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/logs 6 | dask: 7 | scheduler: dask scheduler 8 | worker: dask worker 9 | job: 10 | num_nodes: 1 11 | wall_time_min: 60 12 | env_id: SLURM_JOB_ID 13 | worker: 14 | ppn: 20 15 | cmd: 16 | per_core: 1 17 | threads: 1 18 | local_dir: /dev/shm/dask-workspace 19 | kill: skill ${SLURM_JOB_ID} 20 | scheduler: 21 | cmd: srun -N ${DFTRACER_JOB_NUM_NODES} -t ${DFTRACER_JOB_WALL_TIME_MIN} --ntasks-per-node=${DFTRACER_WORKER_PPN} 22 | port: 10001 23 | kill: skill ${SLURM_JOB_ID} 24 | 25 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/conf/quartz.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | script_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/scripts 3 | conf_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/conf 4 | run_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/run_dir 5 | log_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/logs 6 | dask: 7 | scheduler: dask scheduler 8 | worker: dask worker 9 | job: 10 | num_nodes: 4 11 | wall_time_min: 60 12 | env_id: SLURM_JOB_ID 13 | scheduler: 14 | cmd: srun -N ${DFTRACER_JOB_NUM_NODES} -t ${DFTRACER_JOB_WALL_TIME_MIN} 15 | port: 12005 16 | kill: scancel ${SLURM_JOB_ID} 17 | worker: 18 | ppn: 16 19 | cmd: srun -N ${DFTRACER_JOB_NUM_NODES} --ntasks-per-node=${DFTRACER_WORKER_PPN} 20 | per_core: 1 21 | threads: 1 22 | local_dir: /dev/shm/dask-workspace 23 | kill: scancel ${SLURM_JOB_ID} 24 | -------------------------------------------------------------------------------- /test/analysis_ior.py: -------------------------------------------------------------------------------- 1 | import pandas as pd 2 | import numpy as np 3 | 4 | df = pd.read_csv('cases.csv') 5 | unique_modes = df['mode'].unique().tolist() 6 | print("access_type,mode,baseline_avg,baseline_std,mode_avg,mode_std,overhead_percent") 7 | for access_type in ['write', 'read']: 8 | base = df[(df['access'] == access_type) & (df['mode'] == 'none')] 9 | base_avg = base['bw(MiB/s)'].mean() 10 | base_std = base['bw(MiB/s)'].std() 11 | for mode in unique_modes: 12 | mode_df = df[(df['access'] == access_type) & (df['mode'] == mode)] 13 | mode_avg = mode_df['bw(MiB/s)'].mean() 14 | mode_std = mode_df['bw(MiB/s)'].std() 15 | overhead = ((mode_avg - base_avg) / base_avg) * 100 if base_avg != 0 else 0 16 | print(f"{access_type},{mode},{base_avg:.2f},{base_std:.2f},{mode_avg:.2f},{mode_std:.2f},{overhead:.2f}") -------------------------------------------------------------------------------- /docker/ior.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | RUN apt-get update && apt-get install -y python3 python3-pip openmpi-bin openmpi-common libopenmpi-dev 3 | RUN apt-get install -y git cmake 4 | RUN pip install dftracer 5 | RUN git clone https://github.com/hpc/ior.git /ior 6 | RUN apt-get install -y automake pkg-config 7 | RUN cd /ior && ./bootstrap && ./configure && make -j 8 | RUN mkdir -p /ior/data /ior/logs 9 | ENV DFTRACER_ENABLE=1 10 | ENV DFTRACER_DATA_DIR=testfile 11 | ENV DFTRACER_LOG_LEVEL=INFO 12 | ENV DFTRACER_INIT=PRELOAD 13 | ENV DFTRACER_LOG_FILE=/ior/logs/trace 14 | ENV DFTRACER_TRACE_COMPRESSION=1 15 | ENV DFTRACER_INC_METADATA=1 16 | RUN cd /ior/data && LD_PRELOAD=$(find /usr -name libdftracer_preload.so) mpirun -n 2 --allow-run-as-root ../src/ior -k -w -r -o testfile 17 | RUN ls -l /ior/logs/ 18 | RUN gzip -d /ior/logs/*.pfw.gz 19 | RUN cat /ior/logs/*.pfw 20 | -------------------------------------------------------------------------------- /src/dftracer/core/utils/posix_internal.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 8/23/23. 3 | // 4 | 5 | #ifndef DFTRACER_POSIX_INTERNAL_H 6 | #define DFTRACER_POSIX_INTERNAL_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | 18 | int df_open(const char *pathname, int flags, ...); 19 | 20 | ssize_t df_write(int fd, const void *buf, size_t count); 21 | 22 | ssize_t df_read(int fd, void *buf, size_t count); 23 | 24 | int df_close(int fd); 25 | 26 | int df_fsync(int fd); 27 | 28 | ssize_t df_readlink(const char *path, char *buf, size_t bufsize); 29 | 30 | int df_unlink(const char *filename); 31 | 32 | ThreadID df_gettid(); 33 | 34 | ProcessID df_getpid(); 35 | 36 | #endif // DFTRACER_POSIX_INTERNAL_H 37 | -------------------------------------------------------------------------------- /.gitlab/scripts/dlio_setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e # Exit on any error 4 | set -x # Print each command before executing it 5 | 6 | trap 'echo "Error occurred at line $LINENO"; exit 1' ERR 7 | 8 | echo "Checking if $DATA_PATH is empty..." 9 | if [ -z "$DATA_PATH" ]; then 10 | echo "Empty $DATA_PATH" 11 | exit 1 12 | fi 13 | 14 | echo "Cleaning output folder" 15 | mkdir -p $CUSTOM_CI_OUTPUR_DIR 16 | rm -rf "${CUSTOM_CI_OUTPUR_DIR:?}"/* 17 | 18 | echo "Finding configurations" 19 | dlio_path=$(dirname "$(python -c "import dlio_benchmark; print(dlio_benchmark.__file__);")") 20 | config_path="$dlio_path/configs/workload/" 21 | DLIO_WORKLOADS=$(find "$config_path" -maxdepth 1 -type f -name "*.yaml" -exec basename {} .yaml \; | sed ':a;N;$!ba;s/\n/ /g' | sed 's/default //g') 22 | export DLIO_WORKLOADS=($DLIO_WORKLOADS) 23 | echo "Found ${#DLIO_WORKLOADS[@]} configurations" 24 | 25 | 26 | -------------------------------------------------------------------------------- /test/util.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 10/21/23. 3 | // 4 | 5 | #ifndef DFTRACER_TEST_UTIL_H 6 | #define DFTRACER_TEST_UTIL_H 7 | #include 8 | 9 | #include 10 | #include 11 | 12 | namespace fs = std::experimental::filesystem; 13 | inline void init_log() { DFTRACER_LOGGER_INIT(); } 14 | class Timer { 15 | public: 16 | Timer() : elapsed_time(0) {} 17 | void resumeTime() { t1 = std::chrono::high_resolution_clock::now(); } 18 | double pauseTime() { 19 | auto t2 = std::chrono::high_resolution_clock::now(); 20 | elapsed_time += std::chrono::duration(t2 - t1).count(); 21 | return elapsed_time; 22 | } 23 | double getElapsedTime() { return elapsed_time; } 24 | 25 | private: 26 | std::chrono::high_resolution_clock::time_point t1; 27 | double elapsed_time; 28 | }; 29 | #endif // DFTRACER_TEST_UTIL_H 30 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/conf/corona.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | script_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/scripts 3 | conf_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/conf 4 | run_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/run_dir 5 | log_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/logs 6 | dask: 7 | scheduler: dask scheduler 8 | worker: dask worker 9 | job: 10 | num_nodes: 1 11 | wall_time_min: 60 12 | cores: 48 13 | env_id: FLUX_JOB_ID 14 | queue: pdebug 15 | scheduler: 16 | cmd: flux alloc -N ${DFTRACER_JOB_NUM_NODES} -t ${DFTRACER_JOB_WALL_TIME_MIN} -q ${DFTRACER_JOB_QUEUE} 17 | port: 10003 18 | kill: flux cancel --all 19 | worker: 20 | ppn: 48 21 | cmd: flux run -N ${DFTRACER_JOB_NUM_NODES} --tasks-per-node=${DFTRACER_WORKER_PPN} --cores=$((DFTRACER_JOB_CORES*DFTRACER_JOB_NUM_NODES)) 22 | per_core: 1 23 | threads: 1 24 | local_dir: /l/ssd/$USER/dask-workspace 25 | kill: flux cancel --all 26 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | # Read the Docs configuration file 3 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 4 | 5 | # Required 6 | version: 2 7 | 8 | # Set the OS, Python version and other tools you might need 9 | build: 10 | os: ubuntu-22.04 11 | tools: 12 | python: "3.11" 13 | # You can also specify other tool versions: 14 | # nodejs: "19" 15 | # rust: "1.64" 16 | # golang: "1.19" 17 | 18 | # Build documentation in the "docs/" directory with Sphinx 19 | sphinx: 20 | configuration: docs/conf.py 21 | 22 | # Optionally build your docs in additional formats such as PDF and ePub 23 | # formats: 24 | # - pdf 25 | # - epub 26 | 27 | # Optional but recommended, declare the Python requirements required 28 | # to build your documentation 29 | # See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html 30 | python: 31 | install: 32 | - requirements: docs/requirements.txt 33 | -------------------------------------------------------------------------------- /.coveragerc: -------------------------------------------------------------------------------- 1 | # Coverage configuration for Python code 2 | [run] 3 | source = 4 | python/dftracer 5 | . 6 | omit = 7 | */test/* 8 | */tests/* 9 | */venv/* 10 | */virtualenv/* 11 | setup.py 12 | */site-packages/* 13 | 14 | [report] 15 | # Regexes for lines to exclude from consideration 16 | exclude_lines = 17 | # Have to re-enable the standard pragma 18 | pragma: no cover 19 | 20 | # Don't complain about missing debug-only code: 21 | def __repr__ 22 | if self\.debug 23 | 24 | # Don't complain if tests don't hit defensive assertion code: 25 | raise AssertionError 26 | raise NotImplementedError 27 | 28 | # Don't complain if non-runnable code isn't run: 29 | if 0: 30 | if __name__ == .__main__.: 31 | if TYPE_CHECKING: 32 | 33 | # Don't complain about abstract methods, they aren't run: 34 | @(abc\.)?abstractmethod 35 | 36 | ignore_errors = True 37 | 38 | [html] 39 | directory = htmlcov 40 | 41 | [xml] 42 | output = coverage.xml 43 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/conf/polaris.yaml: -------------------------------------------------------------------------------- 1 | config: 2 | script_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/scripts 3 | conf_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/conf 4 | run_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/run_dir 5 | log_dir: ${DFTRACER_APP}/dfanalyzer_old/dask/logs 6 | dask: 7 | scheduler: dask-scheduler 8 | worker: dask-worker 9 | job: 10 | num_nodes: 1 11 | wall_time_min: 01:00:00 12 | env_id: PBS_JOBID 13 | queue: debug 14 | scheduler: 15 | cmd: qsub -l select=${DFTRACER_JOB_NUM_NODES} -l walltime=${DFTRACER_JOB_WALL_TIME_MIN} -l filesystems=home:eagle:grand -q ${DFTRACER_JOB_QUEUE} -A ${DFTRACER_ACCOUNT} -- 16 | port: 11000 17 | kill: qdel 18 | worker: 19 | total_tasks: 16 20 | ppn: 16 21 | cmd: /opt/cray/pals/1.3.4/bin/mpiexec -n ${DFTRACER_WORKER_TOTAL_TASKS} --ppn ${DFTRACER_WORKER_PPN} 22 | per_core: 1 23 | threads: 1 24 | local_dir: /dev/shm/$USER/dask-workspace 25 | kill: qdel 26 | connection_string: tcp://${DFTRACER_SCHEDULER_HOSTNAME}:${DFTRACER_SCHEDULER_PORT} 27 | -------------------------------------------------------------------------------- /src/dftracer/core/function/generic_function.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by druva on 6/9/25 from finstrument/functions.h 3 | // 4 | /* Config Header */ 5 | #include 6 | 7 | /* Internal Header */ 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | /* External Header */ 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace dftracer { 20 | class GenericFunction { 21 | // static bool stop_trace; 22 | 23 | public: 24 | std::shared_ptr logger; 25 | GenericFunction() { 26 | DFTRACER_LOG_DEBUG("GenericFunction class intercepted", ""); 27 | logger = DFT_LOGGER_INIT(); 28 | } 29 | 30 | virtual void initialize() {} 31 | virtual void finalize() {} 32 | // virtual void log_event(); 33 | 34 | virtual ~GenericFunction() {}; 35 | // bool is_active() { return !stop_trace; } 36 | }; 37 | 38 | } // namespace dftracer -------------------------------------------------------------------------------- /docker/dl.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | RUN apt-get update && apt-get install -y python3 python3-pip mpich libhwloc-dev git cmake default-jre jq 3 | RUN pip install dlio-benchmark 4 | RUN mkdir -p /dlio/data /dlio/output 5 | RUN mpirun -np 4 dlio_benchmark workload=resnet50 ++workload.dataset.data_folder=/dlio/data ++workload.output.folder=/dlio/output ++workload.workflow.generate_data=True ++workload.workflow.train=False 6 | ENV DFTRACER_LOG_LEVEL=ERROR 7 | ENV DFTRACER_INC_METADATA=1 8 | ENV DFTRACER_ENABLE=1 9 | ENV RDMAV_FORK_SAFE=1 10 | RUN mpirun -np 4 dlio_benchmark workload=resnet50 ++workload.dataset.data_folder=/dlio/data ++workload.output.folder=/dlio/output 11 | RUN ls -al /dlio/output/ 12 | ENV filename=/dlio/output/trace*.pfw 13 | RUN cat $filename | grep -v "\[" | awk '{$1=$1;print}' > /dlio/output/combined.json 14 | RUN jq '.' /dlio/output/combined.json > /dev/null 15 | RUN echo "[" > /dlio/output/combined.pfw 16 | RUN cat $filename | grep -v "\[" | awk '{$1=$1;print}' | jq -R "fromjson? | . " -c >> /dlio/output/combined.pfw 17 | RUN cat /dlio/output/combined.pfw | wc -l -------------------------------------------------------------------------------- /dependency/install_dependency.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GIT_REPO=$1 4 | DEPENDENCY_DIR=$2 5 | INSTALL_DIR=$3 6 | BRANCH=$4 7 | NEED_INSTALL=$5 8 | TYPE=$6 9 | EXTRA=$7 10 | echo "${GIT_REPO} $DEPENDENCY_DIR $INSTALL_DIR $BRANCH $NEED_INSTALL" 11 | echo "Removing cloned dir ${DEPENDENCY_DIR}" 12 | rm -rf ${DEPENDENCY_DIR} 13 | echo "cloning ${GIT_REPO}" 14 | git clone ${GIT_REPO} ${DEPENDENCY_DIR} 15 | pushd ${DEPENDENCY_DIR} 16 | if [[ "$TYPE" = "branch" ]]; 17 | then 18 | git checkout ${BRANCH} 19 | else 20 | git checkout tags/${BRANCH} -b ${BRANCH} 21 | fi 22 | git pull 23 | rm -rf build 24 | if [ $NEED_INSTALL = 1 ]; 25 | then 26 | echo "Installing ${DEPENDENCY_DIR}" 27 | mkdir build 28 | echo cmake . -B build -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_PREFIX_PATH=${INSTALL_DIR} $EXTRA 29 | cmake . -B build -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} -DCMAKE_PREFIX_PATH=${INSTALL_DIR} $EXTRA 30 | cmake --build build -- -j 31 | cmake --install build 32 | popd 33 | echo "Clean source dir ${DEPENDENCY_DIR}" 34 | rm -rf ${DEPENDENCY_DIR} 35 | else 36 | echo "Not installing ${DEPENDENCY_DIR}" 37 | fi 38 | 39 | -------------------------------------------------------------------------------- /.devcontainer/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '1.0.14' 2 | services: 3 | # Update this to the name of the service you want to work with in your docker-compose.yml file 4 | app: 5 | # Uncomment if you want to override the service's Dockerfile to one in the .devcontainer 6 | # folder. Note that the path of the Dockerfile and context is relative to the *primary* 7 | # docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile" 8 | # array). The sample below assumes your primary file is in the root of your project. 9 | # 10 | # build: 11 | # context: . 12 | # dockerfile: .devcontainer/Dockerfile 13 | 14 | volumes: 15 | # Update this to wherever you want VS Code to mount the folder of your project 16 | - ..:/workspaces:cached 17 | 18 | # Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust. 19 | # cap_add: 20 | # - SYS_PTRACE 21 | # security_opt: 22 | # - seccomp:unconfined 23 | 24 | # Overrides default command so things don't shut down after the process ends. 25 | command: sleep infinity 26 | 27 | -------------------------------------------------------------------------------- /src/dftracer/core/datastructure.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | namespace dftracer { 4 | 5 | void BaseAggregatedValue::update(BaseAggregatedValue *value) { 6 | auto id = _id; 7 | DFTRACER_FOR_EACH_NUMERIC_TYPE(DFTRACER_ANY_ID_MACRO, value, { 8 | DFTRACER_NUM_AGGREGATE(_child, NumberAggregationValue, double); 9 | return; 10 | }); 11 | DFTRACER_FOR_EACH_STRING_TYPE(DFTRACER_ANY_ID_MACRO, value, { 12 | DFTRACER_NUM_AGGREGATE(_child, AggregatedValue, double); 13 | return; 14 | }); 15 | } 16 | 17 | BaseAggregatedValue *BaseAggregatedValue::get_value() { return _child; } 18 | std::string Metadata::getTagValue(const std::string &tagKey) const { 19 | auto it = data.find(tagKey); 20 | if (it != data.end()) { 21 | DFTRACER_FOR_EACH_NUMERIC_TYPE(DFTRACER_ANY_CAST_MACRO, it->second.second, 22 | { return std::to_string(res.value()); }); 23 | DFTRACER_FOR_EACH_STRING_TYPE(DFTRACER_ANY_CAST_MACRO, it->second.second, 24 | { return res.value(); }); 25 | } 26 | return ""; 27 | } 28 | } // namespace dftracer -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Hariharan Devarajan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/dftracer/core/common/datastructure.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | namespace dftracer { 4 | 5 | void BaseAggregatedValue::update(BaseAggregatedValue *value) { 6 | auto id = _id; 7 | DFTRACER_FOR_EACH_NUMERIC_TYPE(DFTRACER_ANY_ID_MACRO, value, { 8 | DFTRACER_NUM_AGGREGATE(_child, NumberAggregationValue, double); 9 | return; 10 | }); 11 | DFTRACER_FOR_EACH_STRING_TYPE(DFTRACER_ANY_ID_MACRO, value, { 12 | DFTRACER_NUM_AGGREGATE(_child, AggregatedValue, double); 13 | return; 14 | }); 15 | } 16 | 17 | BaseAggregatedValue *BaseAggregatedValue::get_value() { return _child; } 18 | std::string Metadata::getTagValue(const std::string &tagKey) const { 19 | auto it = data.find(tagKey); 20 | if (it != data.end()) { 21 | DFTRACER_FOR_EACH_NUMERIC_TYPE(DFTRACER_ANY_CAST_MACRO, it->second.second, 22 | { return std::to_string(res.value()); }); 23 | DFTRACER_FOR_EACH_STRING_TYPE(DFTRACER_ANY_CAST_MACRO, it->second.second, 24 | { return res.value(); }); 25 | } 26 | return ""; 27 | } 28 | } // namespace dftracer -------------------------------------------------------------------------------- /src/dftracer/core/common/error.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 10/5/23. 3 | // 4 | 5 | #ifndef DFTRACER_ERROR_H 6 | #define DFTRACER_ERROR_H 7 | // clang-format off 8 | #define DFTRACE_DEFINE_ERROR(name, code, message) \ 9 | const char* DFTRACER_##name##_CODE = code; \ 10 | const char* DFTRACER_##name##_MSG = message; 11 | 12 | // Main error codes 13 | #define DFTRACER_SUCCESS_CODE "0" 14 | #define DFTRACER_SUCCESS_MSG "Operation Successful" 15 | #define DFTRACER_FAILURE_CODE "1001" 16 | #define DFTRACER_FAILURE_MSG "Internal Failure" 17 | // Invalid API calls 18 | #define DFTRACER_UNKNOWN_PROFILER_TYPE_CODE "1002" 19 | #define DFTRACER_UNKNOWN_PROFILER_TYPE_MSG "Code 1002: Unknown profiler type %d" 20 | 21 | // Invalid configurations 22 | #define DFTRACER_UNDEFINED_DATA_DIR_CODE "2001" 23 | #define DFTRACER_UNDEFINED_DATA_DIR_MSG "Code 2001: Data dirs not defined. Please define env variable DFTRACER_DATA_DIR" 24 | #define DFTRACER_UNDEFINED_LOG_FILE_CODE "2002" 25 | #define DFTRACER_UNDEFINED_LOG_FILE_MSG "Code 2002: log file not defined. Please define env variable DFTRACER_LOG_FILE" 26 | 27 | // clang-format on 28 | #endif // DFTRACER_ERROR_H 29 | -------------------------------------------------------------------------------- /dependency/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include(${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/dftracer-utils.cmake) 2 | install_external_project(cpp-logger 1.0.0 "CPP_LOGGER" https://github.com/hariharan-devarajan/cpp-logger.git v0.0.6 ${CMAKE_INSTALL_PREFIX} "") 3 | install_external_project(gotcha 2.3.2 "gotcha" https://github.com/LLNL/GOTCHA.git 1.0.7 ${CMAKE_INSTALL_PREFIX} "-DCMAKE_POLICY_VERSION_MINIMUM=3.5") 4 | install_external_project(brahma 3.0.0 "BRAHMA" https://github.com/hariharan-devarajan/brahma.git v1.0.1 ${CMAKE_INSTALL_PREFIX} "") 5 | add_dependencies(brahma cpp-logger) 6 | add_dependencies(brahma gotcha) 7 | find_package(yaml-cpp QUIET) 8 | install_external_project(yaml-cpp "" "YAML_CPP" https://github.com/jbeder/yaml-cpp.git yaml-cpp-0.6.3 ${CMAKE_INSTALL_PREFIX} "-DYAML_CPP_BUILD_TESTS=OFF;-DYAML_BUILD_SHARED_LIBS=ON;-DCMAKE_POLICY_VERSION_MINIMUM=3.5") 9 | 10 | if(NOT ${yaml-cpp_FOUND}) 11 | add_dependencies(yaml-cpp brahma) 12 | add_dependencies(yaml-cpp gotcha) 13 | add_dependencies(yaml-cpp cpp-logger) 14 | endif() 15 | 16 | install_external_project(pybind11 2.12.0 "pybind11" https://github.com/pybind/pybind11.git v2.12.0 ${CMAKE_INSTALL_PREFIX} "-DPYBIND11_TEST=OFF") 17 | -------------------------------------------------------------------------------- /docs/dfanalyzer_build.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Build 3 | =========================== 4 | 5 | ------------------------------------------ 6 | From source (Recommended) 7 | ------------------------------------------ 8 | 9 | .. code-block:: Bash 10 | 11 | git clone git@github.com:LLNL/dftracer.git 12 | cd dftracer 13 | pip install ".[dfanalyzer]" 14 | 15 | ------------------------------------------ 16 | From pip 17 | ------------------------------------------ 18 | 19 | .. code-block:: Bash 20 | 21 | pip install dftracer[dfanalyzer] 22 | 23 | =============================== 24 | Getting Started with DFAnalyzer 25 | =============================== 26 | 27 | The most user-friendly way to utilize DFAnalyzer to analyze traces from DFTracer is to use Jupyter Notebooks. 28 | To run the notebook you will have to install Jupyter. We have a simple requirement.txt file for that as well. 29 | 30 | .. code-block:: Bash 31 | 32 | cd dftracer 33 | pip install -r examples/dfanalyzer/requirements.txt 34 | 35 | A simple example of loading DFAnalyzer and quick recommended queries are available on to :code:`/examples/dfanalyzer/dfanalyzer.ipynb` and run your notebook. 36 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/scripts/start_dask_worker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -x 4 | 5 | DFTRACER_DASK_CONF_NAME=$1 6 | DFTRACER_SCHEDULER_HOSTNAME=$2 7 | 8 | source $HOME/.dftracer/configuration.sh 9 | export PYTHONPATH=${DFTRACER_APP}:${PYTHONPATH} 10 | 11 | # This is start of every script. 12 | source ${DFTRACER_APP}/dfanalyzer_old/dask/scripts/utils.sh 13 | eval $(parse_yaml $DFTRACER_DASK_CONF_NAME DFTRACER_) 14 | DFTRACER_JOB_ID=${!DFTRACER_JOB_ENV_ID} 15 | 16 | echo -n $DFTRACER_JOB_ID > ${DFTRACER_CONFIG_RUN_DIR}/job_id_${USER}.pid 17 | 18 | source ${DFTRACER_ENV}/bin/activate 19 | echo "Activated Env" 20 | 21 | if [ "x${DFTRACER_WORKER_CONNECTION_STRING}" != "x" ]; then 22 | dask_scheduler_conn=${DFTRACER_WORKER_CONNECTION_STRING} 23 | else 24 | dask_scheduler_conn="--scheduler-file ${DFTRACER_CONFIG_RUN_DIR}/scheduler_${USER}.json" 25 | fi 26 | 27 | while : 28 | do 29 | ${DFTRACER_WORKER_CMD} ${DFTRACER_DASK_WORKER} ${dask_scheduler_conn} \ 30 | --local-directory ${DFTRACER_WORKER_LOCAL_DIR} \ 31 | --nworkers ${DFTRACER_WORKER_PER_CORE} --nthreads ${DFTRACER_WORKER_THREADS} > ${DFTRACER_CONFIG_LOG_DIR}/worker_${DFTRACER_JOB_ID}.log 2>&1 32 | echo "Workers existed. Restarting in 1 second" 33 | sleep 1 34 | done 35 | 36 | -------------------------------------------------------------------------------- /src/dftracer/core/utils/configuration_manager.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 10/27/23. 3 | // 4 | 5 | #ifndef DFTRACER_CONFIGURATION_MANAGER_H 6 | #define DFTRACER_CONFIGURATION_MANAGER_H 7 | #include 8 | #include 9 | 10 | #include 11 | namespace dftracer { 12 | class ConfigurationManager { 13 | private: 14 | void derive_configurations(); 15 | std::string aggregation_file; 16 | 17 | public: 18 | bool enable; 19 | ProfileInitType init_type; 20 | std::string log_file; 21 | std::string data_dirs; 22 | bool metadata; 23 | bool core_affinity; 24 | int gotcha_priority; 25 | cpplogger::LoggerType logger_level; 26 | bool io; 27 | bool posix; 28 | bool stdio; 29 | bool compression; 30 | bool trace_all_files; 31 | bool tids; 32 | bool bind_signals; 33 | bool throw_error; 34 | size_t write_buffer_size; 35 | size_t trace_interval_ms; 36 | bool aggregation_enable; 37 | AggregationType aggregation_type; 38 | std::vector aggregation_inclusion_rules; 39 | std::vector aggregation_exclusion_rules; 40 | ConfigurationManager(); 41 | void finalize() {} 42 | }; 43 | } // namespace dftracer 44 | #endif // DFTRACER_CONFIGURATION_MANAGER_H 45 | -------------------------------------------------------------------------------- /docs/_static/theme_overrides.css: -------------------------------------------------------------------------------- 1 | /* override table width restrictions */ 2 | 3 | .wy-table-responsive table td, .wy-table-responsive table th { 4 | white-space: normal !important; 5 | } 6 | .wy-table-responsive { 7 | margin-bottom: 24px; 8 | max-width: 100%; 9 | overflow: auto !important; 10 | } 11 | 12 | /* wide table scroll-bar */ 13 | 14 | table.scrollwide { 15 | display: block; 16 | width: 700px; 17 | background-color: #E0; 18 | overflow: scroll; !important 19 | } 20 | table.scrollwide td { 21 | white-space: nowrap; 22 | } 23 | 24 | /* override navigation sidebar out-of-view on page scrolling */ 25 | 26 | .wy-nav-side { 27 | position: fixed; 28 | padding-bottom: 2em; 29 | width: 300px; 30 | overflow-x: hidden; 31 | overflow-y: scroll; 32 | min-height: 100%; 33 | background: #343131; 34 | z-index: 200; 35 | } 36 | 37 | /* changed side navigation bg colors */ 38 | .wy-side-nav-search { 39 | background: #222c32 !important; 40 | } 41 | 42 | .wy-nav-side { 43 | background: #222c32; 44 | } 45 | 46 | .rst-versions{ 47 | border-top:solid 10px #222c32; 48 | } 49 | -------------------------------------------------------------------------------- /script/generate_coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | if [ -z "$1" ]; then 6 | echo "Error: Build directory not provided" 7 | echo "Usage: $0 " 8 | exit 1 9 | fi 10 | 11 | BUILD_DIR="$1" 12 | 13 | if [ ! -d "$BUILD_DIR" ]; then 14 | echo "Error: Build directory '$BUILD_DIR' does not exist" 15 | exit 1 16 | fi 17 | 18 | BUILD_DIR=$(cd "$BUILD_DIR" && pwd) 19 | SOURCE_DIR=$(cd "$(dirname "$0")/.." && pwd) 20 | COVERAGE_DIR="$BUILD_DIR/coverage" 21 | 22 | echo "Generating coverage reports..." 23 | 24 | GCDA_COUNT=$(find "$BUILD_DIR" -name "*.gcda" -type f | wc -l) 25 | if [ "$GCDA_COUNT" -eq 0 ]; then 26 | echo "Error: No coverage data files found" 27 | exit 1 28 | fi 29 | 30 | mkdir -p "$COVERAGE_DIR" 31 | cd "$BUILD_DIR" 32 | 33 | echo "Generating Coveralls JSON..." 34 | COVERALLS_JSON="$COVERAGE_DIR/coveralls.json" 35 | gcovr -r "$SOURCE_DIR" . \ 36 | --coveralls "$COVERALLS_JSON" \ 37 | --exclude "build/" \ 38 | --exclude "install/" \ 39 | --exclude "test/" \ 40 | --exclude ".*/pybind11/.*" \ 41 | --exclude "/usr/.*" \ 42 | --gcov-ignore-errors=no_working_dir_found \ 43 | --exclude-unreachable-branches \ 44 | --exclude-throw-branches 45 | 46 | echo "✓ Coveralls JSON: $COVERALLS_JSON" 47 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/scripts/stop_dask_distributed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | source $HOME/.dftracer/configuration.sh 4 | export PYTHONPATH=${DFTRACER_APP}:${PYTHONPATH} 5 | # This can be set using env variable or arguments to script. 6 | 7 | hostname=`hostname` 8 | DFTRACER_DASK_CONF_NAME="UNSET" 9 | 10 | case $hostname in 11 | *"corona"*) 12 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/corona.yaml 13 | ;; 14 | *"ruby"*) 15 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/ruby.yaml 16 | ;; 17 | "quartz"*) 18 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/quartz.yaml 19 | ;; 20 | "polaris"*) 21 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/polaris.yaml 22 | ;; 23 | esac 24 | 25 | if [[ "$DFTRACER_DASK_CONF_NAME" == "UNSET" ]]; then 26 | echo "UNSUPPORTED $hostname" 27 | exit 1 28 | fi 29 | 30 | # This is start of every script. 31 | source ${DFTRACER_APP}/dfanalyzer/dask/scripts/utils.sh 32 | eval $(parse_yaml $DFTRACER_DASK_CONF_NAME DFTRACER_) 33 | 34 | kill -9 `cat ${DFTRACER_CONFIG_RUN_DIR}/scheduler_${USER}.pid` 35 | export DFTRACER_JOB_ID=`cat ${DFTRACER_CONFIG_RUN_DIR}/job_id_${USER}.pid` 36 | $DFTRACER_SCHEDULER_KILL $DFTRACER_JOB_ID 37 | $DFTRACER_WORKER_KILL $DFTRACER_JOB_ID 38 | -------------------------------------------------------------------------------- /test/py/dynamo_test.py: -------------------------------------------------------------------------------- 1 | from dftracer.python.dynamo import dft_fn 2 | from dftracer.python import dftracer 3 | import torch 4 | import os 5 | 6 | # Delete log file if exists 7 | if os.path.exists("dynamo.pfw"): 8 | os.remove("dynamo.pfw") 9 | 10 | df_logger = dftracer.initialize_log(f"dynamo.pfw", None, -1) 11 | dyn = dft_fn(name="dynamo", enabled=True) 12 | 13 | 14 | class SimpleModel(torch.nn.Module): 15 | def __init__(self): 16 | super(SimpleModel, self).__init__() 17 | self.conv = torch.nn.Conv2d(3, 16, 3, 1) 18 | self.fc = torch.nn.Linear(16 * 15 * 15, 10) 19 | 20 | @dyn.compile 21 | def forward(self, x): 22 | x = self.conv(x) 23 | x = torch.nn.functional.relu(x) 24 | x = torch.nn.functional.max_pool2d(x, 2) 25 | x = x.view(x.size(0), -1) 26 | x = self.fc(x) 27 | return x 28 | 29 | 30 | if __name__ == "__main__": 31 | model = SimpleModel() 32 | t_model: torch.nn.Module = model # type: ignore 33 | # Create random input 34 | sample = torch.randn(1, 3, 32, 32) 35 | print(t_model(sample)) 36 | df_logger.finalize() 37 | with open("dynamo.pfw", "rb") as f: 38 | data = f.read() 39 | var = b'"cat":"dynamo"' in data 40 | assert var 41 | print("DFTracer model tracing is enabled and working") 42 | -------------------------------------------------------------------------------- /src/dftracer/core/dftracer_preload.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 3/28/23. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | namespace dftracer { 13 | bool init = false; 14 | } 15 | 16 | bool is_init() { return dftracer::init; } 17 | 18 | void set_init(bool _init) { dftracer::init = _init; } 19 | 20 | void dftracer_init(void) { 21 | auto conf = 22 | dftracer::Singleton::get_instance(); 23 | if (conf != nullptr) { 24 | DFTRACER_LOG_DEBUG("dftracer_init", ""); 25 | if (conf->init_type == PROFILER_INIT_LD_PRELOAD) { 26 | dftracer::Singleton::get_instance( 27 | ProfilerStage::PROFILER_INIT, ProfileType::PROFILER_PRELOAD); 28 | } 29 | } 30 | } 31 | 32 | void dftracer_fini(void) { 33 | auto conf = 34 | dftracer::Singleton::get_instance(); 35 | DFTRACER_LOG_DEBUG("dftracer_fini", ""); 36 | auto dftracer_inst = 37 | dftracer::Singleton::get_instance( 38 | ProfilerStage::PROFILER_FINI, ProfileType::PROFILER_PRELOAD); 39 | if (dftracer_inst != nullptr) { 40 | dftracer_inst->finalize(); 41 | } 42 | } -------------------------------------------------------------------------------- /test/check_file.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | files=$1 3 | get_file_content() { 4 | local file="$1" 5 | if [[ "${file##*.}" == "pfw" ]]; then 6 | grep cat "$file" 7 | elif [[ "${file##*.}" == "gz" || "${file##*.}" == "pfw.gz" ]]; then 8 | zgrep cat "$file" 9 | else 10 | grep cat "$file" 11 | fi 12 | } 13 | 14 | expected_lines=$2 15 | echo "get_file_content $1 | wc -l" 16 | for file in $(ls $files); do 17 | echo file:$file 18 | num_posix_lines=$(get_file_content "$file" | wc -l 2> /dev/null) 19 | done 20 | echo $num_posix_lines 21 | if [[ "$num_posix_lines" -ne "$expected_lines" ]]; then 22 | for file in $(ls $files); do 23 | echo file:$file 24 | get_file_content "$file" 25 | done 26 | rm -r $1 2> /dev/null 27 | exit 1 28 | else 29 | for file in $(ls $files); do 30 | echo file:$file 31 | if jq --slurp -e >/dev/null 2>&1 <<< `get_file_content "$file" | grep -v "\[" | grep -v "\]" | grep -v "Binary" | awk '{$1=$1;print}'`; then 32 | echo "Parsed JSON successfully and got something other than false/null"; 33 | else 34 | echo "Failed to parse JSON, or got false/null"; 35 | jq --slurp -e <<< `get_file_content "$file" | grep -v "\[" | grep -v "\]" | grep -v "Binary" | awk '{$1=$1;print}'` 36 | get_file_content "$file" | grep -v "\[" | grep -v "\]" | awk '{$1=$1;print}' 37 | exit 1 38 | fi 39 | done 40 | fi 41 | rm -r $1 2> /dev/null -------------------------------------------------------------------------------- /test/check_file_at_least.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | expected_lines=$2 3 | files=$1 4 | 5 | get_file_content() { 6 | local file="$1" 7 | if [[ "${file##*.}" == "pfw" ]]; then 8 | grep cat "$file" 9 | elif [[ "${file##*.}" == "gz" || "${file##*.}" == "pfw.gz" ]]; then 10 | zgrep cat "$file" 11 | else 12 | grep cat "$file" 13 | fi 14 | } 15 | 16 | num_posix_lines=0 17 | for file in $(ls $files); do 18 | num_posix_lines_local=$(get_file_content "$file" | wc -l 2> /dev/null) 19 | num_posix_lines=$((num_posix_lines + num_posix_lines_local)) 20 | done 21 | 22 | if [[ "$num_posix_lines" -lt "$expected_lines" ]]; then 23 | echo "Found $num_posix_lines expected $expected_lines" 24 | for file in $(ls $files); do 25 | get_file_content "$file" 26 | done 27 | exit 1 28 | else 29 | for file in $(ls $files); do 30 | if jq --slurp -e >/dev/null 2>&1 <<< `get_file_content "$file" | grep -v "\[" | grep -v "\]"| grep -v "Binary" | awk '{$1=$1;print}'`; then 31 | echo "Parsed JSON successfully and got something other than false/null"; 32 | else 33 | echo "Failed to parse JSON, or got false/null"; 34 | jq --slurp -e <<< `get_file_content "$file" | grep -v "\[" | grep -v "\]" | grep -v "Binary" | awk '{$1=$1;print}'` 35 | get_file_content "$file" | grep -v "\[" | grep -v "\]" | awk '{$1=$1;print}' 36 | exit 1 37 | fi 38 | done 39 | 40 | fi 41 | rm -r $1 2> /dev/null 42 | exit 0 -------------------------------------------------------------------------------- /cmake/configure_files/dftracer-config-version.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | #----------------------------------------------------------------------------- 3 | # Version file for install directory 4 | # Uses library version (not package version) for CMake compatibility checking 5 | #----------------------------------------------------------------------------- 6 | set(PACKAGE_VERSION "@DFTRACER_LIBRARY_VERSION@") 7 | 8 | # Check compatibility using SameMajorVersion mode 9 | # Compatible if: 10 | # - Requested major version equals installed major version 11 | # - Requested version is not newer than installed version 12 | if(PACKAGE_FIND_VERSION) 13 | if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@DFTRACER_VERSION_MAJOR@") 14 | # Same major version - check if requested version is not newer 15 | if(NOT "${PACKAGE_FIND_VERSION}" VERSION_GREATER "@DFTRACER_LIBRARY_VERSION@") 16 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 17 | else() 18 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 19 | endif() 20 | 21 | # Exact match if all components are equal 22 | if("${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@DFTRACER_LIBRARY_VERSION@") 23 | set(PACKAGE_VERSION_EXACT TRUE) 24 | endif() 25 | else() 26 | # Different major version - not compatible 27 | set(PACKAGE_VERSION_COMPATIBLE FALSE) 28 | endif() 29 | else() 30 | # No version specified - always compatible 31 | set(PACKAGE_VERSION_COMPATIBLE TRUE) 32 | endif() -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/versions.html: -------------------------------------------------------------------------------- 1 | {% if READTHEDOCS %} 2 | {# Add rst-badge after rst-versions for small badge style. #} 3 |
4 | 5 | Read the Docs 6 | v: {{ current_version }} 7 | 8 | 9 |
10 |
11 |
{{ _('Versions') }}
12 | {% for slug, url in versions %} 13 |
{{ slug }}
14 | {% endfor %} 15 |
16 |
17 |
{{ _('Downloads') }}
18 | {% for type, url in downloads %} 19 |
{{ type }}
20 | {% endfor %} 21 |
22 |
23 |
{{ _('On Read the Docs') }}
24 |
25 | {{ _('Project Home') }} 26 |
27 |
28 | {{ _('Builds') }} 29 |
30 |
31 |
32 | {% trans %}Free document hosting provided by Read the Docs.{% endtrans %} 33 | 34 |
35 |
36 | {% endif %} 37 | 38 | -------------------------------------------------------------------------------- /.gitlab/scripts/build_dft.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LOG_FILE="$PWD/build.log" 4 | 5 | echo "Running build_dft.sh on $(hostname) and logging to $LOG_FILE" | tee -a "$LOG_FILE" 6 | 7 | # shellcheck source=/dev/null 8 | 9 | export site=$(ls -d $CUSTOM_CI_ENV_DIR/$ENV_NAME/lib/python*/site-packages/ 2>>"$LOG_FILE") 10 | 11 | 12 | echo "Remove preinstall version of dftracer" | tee -a "$LOG_FILE" 13 | echo "Command: pip uninstall pydftracer" | tee -a "$LOG_FILE" 14 | set -x 15 | pip uninstall -y pydftracer >>"$LOG_FILE" 2>&1 16 | set +x 17 | if [ $? -ne 0 ]; then 18 | echo "Failed to uninstall pydftracer. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 19 | exit 1 20 | fi 21 | 22 | set -x 23 | rm -rf $site/*dftracer* >>"$LOG_FILE" 2>&1 24 | set +x 25 | if [ $? -ne 0 ]; then 26 | echo "Failed to remove dftracer files. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 27 | exit 1 28 | fi 29 | 30 | echo "Installing DFTracer" | tee -a "$LOG_FILE" 31 | echo "Command: pip install --no-cache-dir --force-reinstall git+${DFTRACER_REPO}@${CI_COMMIT_REF_NAME}" | tee -a "$LOG_FILE" 32 | set -x 33 | export DFTRACER_ENABLE_HIP_TRACING=ON 34 | pip install --no-cache-dir --force-reinstall --verbose git+${DFTRACER_REPO}@${CI_COMMIT_REF_NAME} >>"$LOG_FILE" 2>&1 35 | unset DFTRACER_ENABLE_HIP_TRACING 36 | set +x 37 | if [ $? -ne 0 ]; then 38 | echo "Failed to install DFTracer. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 39 | exit 1 40 | fi 41 | 42 | python -c "import dftracer; import dftracer.logger; print(dftracer.__version__);" 43 | export PATH=$site/dftracer/bin:$PATH -------------------------------------------------------------------------------- /docs/limitations.rst: -------------------------------------------------------------------------------- 1 | =========================== 2 | Limitations 3 | =========================== 4 | 5 | 6 | --------------------- 7 | Spawning of processes 8 | --------------------- 9 | 10 | For certain system the spawning of processes create new processes but do not carry env variable. 11 | In those cases the LD_PRELOAD or python module load would not load DFTracer as they are removed by system and result in missing profiling info. 12 | 13 | ---------------- 14 | OS Compatibility 15 | ---------------- 16 | 17 | The profiler internally uses system calls such as ``getpid()`` and ``gettid()`` which are only implemented in Linux OS. 18 | 19 | --------------- 20 | Write Buffering 21 | --------------- 22 | 23 | Docker 24 | ******* 25 | 26 | Within Docker there is an issue with buffers which prevents I/O from flushing. 27 | To enable logging, we need to reduce write buffer size by setting ``DFTRACER_WRITE_BUFFER_SIZE=10``. 28 | This will disable buffering and everything gets flushed synchronously. 29 | However, reducing buffer size would increase overhead of operation profiling. 30 | 31 | 32 | AI workloads 33 | ************* 34 | 35 | For AI workloads written in PyTorch do not have a finalization phase of I/O workers. 36 | This prevents buffers from getting flushed. Therefore, in these cases we should use buffered I/O. 37 | 38 | Workloads with dynamic processes 39 | ******************************** 40 | 41 | For workloads which use exec or execv then the process state is overwritten with new initialization. 42 | This will prevent the parent process from finalization. In these cases again we should refrain using buffering. -------------------------------------------------------------------------------- /cmake/tests/has_fd.cpp: -------------------------------------------------------------------------------- 1 | #include // fsync 2 | #include 3 | #include 4 | #include // EXIT_SUCCESS 5 | 6 | template 7 | int fsync_ofstream (std::basic_ofstream<_CharT, _Traits>& os) 8 | { 9 | class my_filebuf : public std::basic_filebuf<_CharT> 10 | { 11 | public: 12 | int handle () 13 | { 14 | return this->_M_file.fd (); 15 | } 16 | }; 17 | 18 | if (os.is_open ()) { 19 | os.flush (); 20 | return fsync (static_cast (*os.rdbuf ()).handle ()); 21 | } 22 | 23 | return EBADF; 24 | } 25 | 26 | template 27 | int fsync_fstream (std::basic_fstream<_CharT, _Traits>& os) 28 | { 29 | class my_filebuf : public std::basic_filebuf<_CharT> 30 | { 31 | public: 32 | int handle () 33 | { 34 | return this->_M_file.fd (); 35 | } 36 | }; 37 | 38 | if (os.is_open ()) { 39 | os.flush (); 40 | return fsync (static_cast (*os.rdbuf ()).handle ()); 41 | } 42 | 43 | return EBADF; 44 | } 45 | 46 | int main () 47 | { 48 | int rc = 0; 49 | 50 | std::fstream os ("test_fsync_fstream", std::fstream::out); 51 | os << "test_fsync_fstream"; 52 | rc = fsync_fstream (os); 53 | if (rc != 0) return EXIT_FAILURE; 54 | 55 | std::ofstream ofs ("test_fsync_ofstream", std::ofstream::out); 56 | ofs << "test_fsync_ofstream"; 57 | rc = fsync_ofstream (ofs); 58 | if (rc != 0) return EXIT_FAILURE; 59 | 60 | return EXIT_SUCCESS; 61 | } -------------------------------------------------------------------------------- /examples/graph_visualization/test_data1.pfw: -------------------------------------------------------------------------------- 1 | [ 2 | {"id":"0","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"10","dur":"60","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 3 | {"id":"1","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"40","dur":"10","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 4 | {"id":"2","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"120","dur":"60","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 5 | {"id":"3","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"210","dur":"40","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 6 | {"id":"4","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"230","dur":"10","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 7 | {"id":"5","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"10","dur":"50","ph":"X","args":{"hostname":"1d9bd41c01e6","mode":511,"fname":"/dlio/data1"}} 8 | {"id":"6","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"40","dur":"50","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 9 | {"id":"7","name":"Fread","cat":"POSIX","pid":"0","tid":"19","ts":"110","dur":"80","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 10 | {"id":"8","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"140","dur":"45","ph":"X","args":{"hostname":"1d9bd41c01e6","mode":511,"fname":"/dlio/data1/train/"}} 11 | {"id":"9","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"160","dur":"20","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 12 | {"id":"10","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"189","dur":"4","ph":"X","args":{"hostname":"1d9bd41c01e6"}} 13 | {"id":"11","name":"read","cat":"POSIX","pid":"0","tid":"19","ts":"220","dur":"5","ph":"X","args":{"hostname":"1d9bd41c01e6","mode":511,"fname":"/dlio/data1/valid/"}} 14 | -------------------------------------------------------------------------------- /.gitlab/scripts/create_log_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Running create_log_dir.sh on $(hostname)" | tee -a "$LOG_FILE" 4 | if [ "x$DFTRACER_VERSION" == "x" ]; then 5 | export DFTRACER_VERSION=$(python -c "import dftracer; print(dftracer.__version__)") || { echo "Failed to get DFTRACER_VERSION"; exit 1; } 6 | fi 7 | pushd "$LOG_STORE_DIR" || { echo "Failed to change directory to $LOG_STORE_DIR"; exit 1; } 8 | 9 | LFS_DIR=v$DFTRACER_VERSION/$SYSTEM_NAME 10 | 11 | if test -d "$LFS_DIR"; then 12 | echo "Branch $LFS_DIR Exists" 13 | else 14 | if [ "$DFTRACER_VERSION" == "PR" ]; then 15 | module load mpifileutils 16 | flux run -n48 drm "$LFS_DIR" 17 | mkdir -p "$LFS_DIR" 18 | else 19 | git clone "ssh://git@czgitlab.llnl.gov:7999/iopp/dftracer-traces.git" "$LFS_DIR" || { echo "Failed to clone repository"; exit 1; } 20 | cd "$LFS_DIR" || { echo "Failed to change directory to $LFS_DIR"; exit 1; } 21 | git checkout -b "$LFS_DIR" || { echo "Failed to create branch $LFS_DIR"; exit 1; } 22 | cd - || { echo "Failed to return to previous directory"; exit 1; } 23 | fi 24 | cp "$LOG_STORE_DIR/v1.0.5-develop/corona/.gitattributes" . || { echo "Failed to copy .gitattributes"; exit 1; } 25 | cp "$LOG_STORE_DIR/v1.0.5-develop/corona/.gitignore" . || { echo "Failed to copy .gitignore"; exit 1; } 26 | cp "$LOG_STORE_DIR/v1.0.5-develop/corona/prepare_traces.sh" . || { echo "Failed to copy prepare_traces.sh"; exit 1; } 27 | cp "$LOG_STORE_DIR/v1.0.5-develop/corona/README.md" . || { echo "Failed to copy README.md"; exit 1; } 28 | fi 29 | 30 | popd || { echo "Failed to change directory from $LOG_STORE_DIR"; exit 1; } 31 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/search.html: -------------------------------------------------------------------------------- 1 | {# 2 | basic/search.html 3 | ~~~~~~~~~~~~~~~~~ 4 | 5 | Template for the search page. 6 | 7 | :copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS. 8 | :license: BSD, see LICENSE for details. 9 | #} 10 | {%- extends "layout.html" %} 11 | {% set title = _('Search') %} 12 | {% set script_files = script_files + ['_static/searchtools.js'] %} 13 | {% block footer %} 14 | 17 | {# this is used when loading the search index using $.ajax fails, 18 | such as on Chrome for documents on localhost #} 19 | 20 | {{ super() }} 21 | {% endblock %} 22 | {% block body %} 23 | 31 | 32 | {% if search_performed %} 33 |

{{ _('Search Results') }}

34 | {% if not search_results %} 35 |

{{ _('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.') }}

36 | {% endif %} 37 | {% endif %} 38 |
39 | {% if search_results %} 40 |
    41 | {% for href, caption, context in search_results %} 42 |
  • 43 | {{ caption }} 44 |

    {{ context|e }}

    45 |
  • 46 | {% endfor %} 47 |
48 | {% endif %} 49 |
50 | {% endblock %} 51 | -------------------------------------------------------------------------------- /include/dftracer/core/common/constants.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 10/5/23. 3 | // 4 | 5 | #ifndef DFTRACER_CONSTANTS_H 6 | #define DFTRACER_CONSTANTS_H 7 | #define DFTRACER_CONFIGURATION "DFTRACER_CONFIGURATION" 8 | #define DFTRACER_ENABLE "DFTRACER_ENABLE" 9 | #define DFTRACER_GOTCHA_PRIORITY "DFTRACER_GOTCHA_PRIORITY" 10 | #define DFTRACER_LOG_LEVEL "DFTRACER_LOG_LEVEL" 11 | #define DFTRACER_LOG_FILE "DFTRACER_LOG_FILE" 12 | #define DFTRACER_INIT "DFTRACER_INIT" 13 | #define DFTRACER_INIT_COUNT "DFTRACER_INIT_COUNT" 14 | #define DFTRACER_DATA_DIR "DFTRACER_DATA_DIR" 15 | #define DFTRACER_DATA_DIR_DELIMITER ':' 16 | #define DFTRACER_SET_CORE_AFFINITY "DFTRACER_SET_CORE_AFFINITY" 17 | #define DFTRACER_ERROR "DFTRACER_ERROR" 18 | #define DFTRACER_INC_METADATA "DFTRACER_INC_METADATA" 19 | #define DFTRACER_DISABLE_POSIX "DFTRACER_DISABLE_POSIX" 20 | #define DFTRACER_DISABLE_STDIO "DFTRACER_DISABLE_STDIO" 21 | #define DFTRACER_DISABLE_IO "DFTRACER_DISABLE_IO" 22 | #define DFTRACER_TRACE_COMPRESSION "DFTRACER_TRACE_COMPRESSION" 23 | #define DFTRACER_DISABLE_TIDS "DFTRACER_DISABLE_TIDS" 24 | #define DFTRACER_ENABLE_AGGREGATION "DFTRACER_ENABLE_AGGREGATION" 25 | #define DFTRACER_AGGREGATION_TYPE "DFTRACER_AGGREGATION_TYPE" 26 | #define DFTRACER_AGGREGATION_FILE "DFTRACER_AGGREGATION_FILE" 27 | #define DFTRACER_BIND_SIGNALS "DFTRACER_BIND_SIGNALS" 28 | #define DFTRACER_WRITE_BUFFER_SIZE "DFTRACER_WRITE_BUFFER_SIZE" 29 | #define DFTRACER_TRACE_INTERVAL_MS "DFTRACER_TRACE_INTERVAL_MS" 30 | #define DFTRACER_ALL_FILES "all" 31 | 32 | static const int EVENT_TYPE_SIZE = 128; 33 | static const unsigned int DFT_PATH_MAX = 1024 * 4; 34 | static const char SEPARATOR = ';'; 35 | static const int HASH_OUTPUT = 16; 36 | #define NO_HASH_DEFAULT 0 37 | 38 | #endif // DFTRACER_CONSTANTS_H 39 | -------------------------------------------------------------------------------- /docs/debugging.rst: -------------------------------------------------------------------------------- 1 | ================ 2 | Debugging 3 | ================` 4 | 5 | 6 | ------------ 7 | Preload Mode 8 | ------------ 9 | 10 | 11 | 12 | To enable debugging with the LD_PRELOAD mode, LD_PRELOAD the executable with libdftracer_preload_dbg.so at 13 | runtime instead of the libdftracer_preload.so library 14 | 15 | 16 | .. code-block:: bash 17 | :linenos: 18 | 19 | # Remaining environment variables as it is 20 | 21 | # Enable profiler 22 | DFTRACER_ENABLE=1 23 | 24 | # Set the mode 25 | export DFTRACER_INIT=PRELOAD 26 | 27 | # Set the log level ( Supported options: DEBUG, INFO, WARN, ERROR (Default)) 28 | DFTRACER_LOG_LEVEL=DEBUG 29 | 30 | # Run your application 31 | LD_PRELOAD=$VENV/lib/python*/site-packages/dftracer/lib64/libdftracer_preload_dbg.so ./your_application 32 | 33 | .. warning:: 34 | Debug logs set with `DFTRACER_LOG_LEVEL` only work when debugging is enabled 35 | 36 | ---------------- 37 | App Mode 38 | ---------------- 39 | 40 | .. TODO 41 | .. C/C++ 42 | 43 | Python: 44 | ************************** 45 | 46 | .. code-block:: python 47 | :linenos: 48 | 49 | from dftracer.python.dbg import dftracer, dft_fn 50 | # Remaining code as it is 51 | 52 | 53 | Import the logger from dftracer.python.dbg instead of dftracer.python. No other 54 | changes in the code are required to enable debug logging 55 | 56 | .. code-block:: bash 57 | :linenos: 58 | 59 | # Keep the remaining environment variables 60 | # Enable profiler 61 | DFTRACER_ENABLE=1 62 | # Add the log level 63 | DFTRACER_LOG_LEVEL=DEBUG 64 | 65 | # Run the application 66 | python3 your_application.py 67 | 68 | .. warning:: 69 | Debug logging may impact application performance. Use only for debugging purposes. -------------------------------------------------------------------------------- /src/dftracer/python/dftracer_dbg.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | 19 | #include "dftracer.cpp.in" 20 | 21 | PYBIND11_MODULE(dftracer_dbg, m) { 22 | m.doc() = "Python module for dftracer"; // optional module docstring 23 | m.def("initialize", &dftracer::initialize, "initialize dftracer", 24 | py::arg("log_file") = nullptr, py::arg("data_dirs") = nullptr, 25 | py::arg("process_id") = -1); 26 | m.def("get_time", &dftracer::get_time, "get time from profiler"); 27 | m.def("enter_event", &dftracer::enter_event, "mark enter event"); 28 | m.def("exit_event", &dftracer::exit_event, "mark exit event"); 29 | m.def("log_event", &dftracer::log_event, "log event with args", 30 | py::arg("name"), py::arg("cat"), py::arg("start_time"), 31 | py::arg("duration"), 32 | py::arg("int_args") = 33 | std::unordered_map>(), 34 | py::arg("string_args") = 35 | std::unordered_map>(), 36 | py::arg("float_args") = 37 | std::unordered_map>()); 38 | m.def("log_metadata_event", &dftracer::log_metadata_event, 39 | "log metadata event", py::arg("key"), py::arg("value")); 40 | m.def("finalize", &dftracer::finalize, "finalize dftracer"); 41 | } 42 | -------------------------------------------------------------------------------- /.gitlab/scripts/common.yml: -------------------------------------------------------------------------------- 1 | .lc: 2 | id_tokens: 3 | SITE_ID_TOKEN: 4 | aud: https://lc.llnl.gov/gitlab 5 | 6 | .corona: 7 | extends: .lc 8 | tags: 9 | - shell 10 | - corona 11 | variables: 12 | PYTHON_MODULE: python/3.9.12 13 | MPI_MODULE: openmpi/4.1.2 # OpenMPI is a popular open-source MPI implementation 14 | GCC_MODULE: gcc/10.3.1 15 | DATA_PATH: "/p/lustre3/iopp/gitlab-runner-data/" 16 | LOG_STORE_DIR: "/p/lustre3/iopp/dftracer-traces-lfs" # 'iopp' refers to a specific directory structure 17 | CUSTOM_CI_OUTPUT_DIR: "/p/lustre3/iopp/gitlab-runner-outputs" 18 | BASELINE_CSV: "/p/lustre3/iopp/dftracer-traces-lfs/v1.0.10.dev6/corona/trace_paths.csv" 19 | CORES: 48 20 | GPUS: 8 21 | LARGE_QUEUE_WALLTIME: 480 # Walltime specifies the maximum runtime in minutes 22 | SMALL_QUEUE_WALLTIME: 60 23 | LARGE_QUEUE: pbatch # 'pbatch' is a queue name for batch jobs 24 | SMALL_QUEUE: pdebug # 'pdebug' is a queue name for debugging jobs 25 | MAX_NODES_SMALL_QUEUE: 8 26 | SYSTEM_NAME: corona 27 | 28 | .tuo: 29 | extends: .lc 30 | tags: 31 | - shell 32 | - tuolumne 33 | variables: 34 | PYTHON_MODULE: cray-python/3.11.7 35 | MPI_MODULE: cray-mpich/8.1.25 # OpenMPI is a popular open-source MPI implementation 36 | GCC_MODULE: gcc/12.2.0 37 | ROCM_MODULE: rocm/6.3.1 38 | DATA_PATH: "/p/lustre5/iopp/gitlab-runner-data/" 39 | LOG_STORE_DIR: "/p/lustre5/iopp/dftracer-traces-lfs" # 'iopp' refers to a specific directory structure 40 | CUSTOM_CI_OUTPUT_DIR: "/p/lustre5/iopp/gitlab-runner-outputs" 41 | SMALL_QUEUE_WALLTIME: 60 42 | LARGE_QUEUE: pbatch # 'pbatch' is a queue name for batch jobs 43 | SMALL_QUEUE: pdebug # 'pdebug' is a queue name for debugging jobs 44 | MAX_NODES_SMALL_QUEUE: 8 45 | SYSTEM_NAME: tuolumne 46 | 47 | -------------------------------------------------------------------------------- /src/dftracer/python/dftracer.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include 17 | #include 18 | #include 19 | 20 | #include "dftracer.cpp.in" 21 | 22 | PYBIND11_MODULE(dftracer, m) { 23 | m.doc() = "Python module for dftracer"; // optional module docstring 24 | m.def("initialize", &dftracer::initialize, "initialize dftracer", 25 | py::arg("log_file") = nullptr, py::arg("data_dirs") = nullptr, 26 | py::arg("process_id") = -1); 27 | m.def("get_time", &dftracer::get_time, "get time from profiler"); 28 | m.def("enter_event", &dftracer::enter_event, "mark enter event"); 29 | m.def("exit_event", &dftracer::exit_event, "mark exit event"); 30 | m.def("log_event", &dftracer::log_event, "log event with args", 31 | py::arg("name"), py::arg("cat"), py::arg("start_time"), 32 | py::arg("duration"), 33 | py::arg("int_args") = 34 | std::unordered_map>(), 35 | py::arg("string_args") = 36 | std::unordered_map>(), 37 | py::arg("float_args") = 38 | std::unordered_map>()); 39 | m.def("log_metadata_event", &dftracer::log_metadata_event, 40 | "log metadata event", py::arg("key"), py::arg("value")); 41 | m.def("finalize", &dftracer::finalize, "finalize dftracer"); 42 | } 43 | -------------------------------------------------------------------------------- /docs/dfanalyzer_custom_columns.rst: -------------------------------------------------------------------------------- 1 | =========================================== 2 | Custom Columns Derived from DFTracer 3 | =========================================== 4 | 5 | This section describes how to derive custom columns for a DFAnalyzer data framework from DFTracer events using a custom function and load specific fields. 6 | 7 | Example: Custom Workflow Columns 8 | ================================ 9 | 10 | We can define custom columns in `DFAnalyzer` by specifying a function that extracts the desired fields from the `json_object` and then loading those fields with their corresponding types. 11 | 12 | Below is an example of how to define a custom function to derive columns from a Pegasus Montage workflow trace: 13 | 14 | .. code-block:: python 15 | 16 | def wf_cols_function(json_object, current_dict, time_approximate, condition_fn, load_data): 17 | d = {} 18 | if "args" in json_object: 19 | if "size" in json_object["args"]: 20 | d["size"] = int(json_object["args"]["size"]) 21 | if "ret" in json_object["args"]: 22 | d["ret"] = int(json_object["args"]["ret"]) 23 | return d 24 | 25 | load_cols_wf = {'size': "int64[pyarrow]", 'ret': "int64[pyarrow]"} 26 | 27 | Next, use this function in `DFAnalyzer` to load traces with the custom columns (here is an example of loading Montage traces): 28 | 29 | .. code-block:: python 30 | 31 | from dfanalyzer import DFAnalyzer 32 | 33 | analyzer = DFAnalyzer( 34 | "/path/to/montage-*-preload.pfw.gz", 35 | load_fn=wf_cols_function, 36 | load_cols=load_cols_wf 37 | ) 38 | 39 | Here, the custom columns `size`, `ret`, and `cmd` are loaded into the `DFAnalyzer` using the `wf_cols_function`. 40 | 41 | You can modify the function and column types to match the fields relevant to your workload. 42 | -------------------------------------------------------------------------------- /test/paper/overhead.py: -------------------------------------------------------------------------------- 1 | import sys 2 | import logging 3 | import os 4 | from mpi4py import MPI 5 | from time import time 6 | from dftracer.python import dftracer, dft_fn 7 | 8 | log_inst = dftracer.initialize_log(logfile=None, data_dir=None, process_id=-1) 9 | 10 | class Timer: 11 | def __init__(self): 12 | self.elapsed_time = 0 13 | self.start = 0 14 | def resume_time(self): 15 | self.start = time() 16 | 17 | def pause_time(self): 18 | self.elapsed_time += time() - self.start 19 | 20 | 21 | def main(argc, argv): 22 | if argc < 5: 23 | raise Exception("python overhead.py ") 24 | logging.info(f"{argv}") 25 | dir = argv[2] 26 | num_operations = int(argv[3]) 27 | transfer_size = int(argv[4]) 28 | logging.basicConfig(filename=f'{os.getcwd()}/overhead_python_{MPI.COMM_WORLD.rank}.log', encoding='utf-8', level=logging.DEBUG) 29 | path = f"{dir}/file_{MPI.COMM_WORLD.rank}-{MPI.COMM_WORLD.size}.bat" 30 | operation_time = Timer() 31 | operation_time.resume_time() 32 | f = open(path, "w+") 33 | operation_time.pause_time() 34 | buffer = 'w' * transfer_size 35 | for i in range(num_operations): 36 | operation_time.resume_time() 37 | f.write(buffer) 38 | operation_time.pause_time() 39 | 40 | operation_time.resume_time() 41 | f.close() 42 | operation_time.pause_time() 43 | total_time = 0.0 44 | total_time = MPI.COMM_WORLD.allreduce(operation_time.elapsed_time, op=MPI.SUM) 45 | if MPI.COMM_WORLD.rank == 0: 46 | print(f"[DFTRACER PRINT],{MPI.COMM_WORLD.size},{num_operations},{transfer_size},{total_time}") 47 | MPI.COMM_WORLD.barrier() 48 | os.remove(path) 49 | log_inst.finalize() 50 | 51 | if __name__ == "__main__": 52 | argc = len(sys.argv) 53 | argv = sys.argv 54 | main(argc, argv) -------------------------------------------------------------------------------- /docs/utilities.rst: -------------------------------------------------------------------------------- 1 | ======================== 2 | DFTracer Utility scripts 3 | ======================== 4 | 5 | This section describes the utilities provided by DFTracer to assist users with logs. 6 | 7 | ---------- 8 | 9 | All scripts are installed with DFTracer in the installation's directories bin folder. 10 | 11 | Please see the `DFTracer Utilities Documentation `_ for 12 | more detailed documentation on these utilities. 13 | 14 | ++++++++++++++++++++ 15 | Additional Utilities 16 | ++++++++++++++++++++ 17 | 18 | Sparse Git Clone 19 | ^^^^^^^^^^^^^^^^ 20 | 21 | The script enables sparse git-clone of dftracer traces of the specified branch into 22 | the specified local directory. It optionally provides interactive selection of directories to clone. 23 | 24 | .. code-block:: bash 25 | 26 | /bin/usage: git_sparse_clone_interactive [directory] 27 | 28 | Arguments for this script are: 29 | 30 | 1. **-r repository name** name of remote repository 31 | 2. **-b branch name** name of remote branch 32 | 3. **-l local directory** name of local directory to clone into 33 | 4. **-d directory** optional comma-separated list of directories to sparse-clone. 34 | 35 | Sparse Git Push 36 | ^^^^^^^^^^^^^^^ 37 | 38 | The script enables sparse git-push of dftracer traces to the specified remote repository 39 | and branch. It optionally provides interactive selection of directories to push. 40 | 41 | .. code-block:: bash 42 | 43 | /bin/usage: git_sparse_push_interactive [directory] 44 | 45 | Arguments for this script are: 46 | 47 | 1. **-r repository name** name of remote repository 48 | 2. **-b branch name** name of remote branch 49 | 3. **-d directory** optional comma-separated list of directories to sparse-push. 50 | -------------------------------------------------------------------------------- /infrastructure/docker/QUICK_REFERENCE.md: -------------------------------------------------------------------------------- 1 | # DFTracer Docker Quick Reference 2 | 3 | ## Common Commands 4 | 5 | ### Build 6 | ```bash 7 | # Build for current platform 8 | ./infrastructure/docker/build-multiplatform.sh build --load 9 | 10 | # Build for multiple platforms 11 | ./infrastructure/docker/build-multiplatform.sh build --arch linux/amd64,linux/arm64 12 | 13 | # Build with custom Python version 14 | ./infrastructure/docker/build-multiplatform.sh build --python 3.11 --tag py311 --load 15 | ``` 16 | 17 | ### Run 18 | ```bash 19 | # Basic run (auto-detects platform) 20 | ./infrastructure/docker/build-multiplatform.sh run 21 | 22 | # Run with custom command 23 | ./infrastructure/docker/build-multiplatform.sh run --cmd "pytest test/" 24 | 25 | # Run with environment variables 26 | ./infrastructure/docker/build-multiplatform.sh run -e DFTRACER_ENABLE=1 27 | 28 | # Run in background 29 | ./infrastructure/docker/build-multiplatform.sh run --detach 30 | ``` 31 | 32 | ### VS Code Dev Container 33 | ``` 34 | Cmd/Ctrl+Shift+P → "Dev Containers: Reopen in Container" 35 | ``` 36 | 37 | ## File Locations 38 | 39 | | File | Purpose | 40 | |------|---------| 41 | | `infrastructure/docker/Dockerfile.dev` | Development Dockerfile | 42 | | `infrastructure/docker/build-multiplatform.sh` | Build and run script | 43 | | `infrastructure/docker/README.md` | Docker documentation | 44 | | `.devcontainer/devcontainer.json` | VS Code dev container config | 45 | | `.devcontainer/README.md` | Dev container documentation | 46 | 47 | ## Troubleshooting 48 | 49 | **Build fails?** 50 | - Try `--no-cache` flag 51 | - Check Docker is running 52 | - Verify buildx is available 53 | 54 | **Permission issues?** 55 | - Check UID/GID in build args (default: 1000) 56 | 57 | **Wrong platform?** 58 | - Script auto-detects, but you can override with `--arch` 59 | 60 | ## Help 61 | ```bash 62 | ./infrastructure/docker/build-multiplatform.sh help 63 | ``` 64 | -------------------------------------------------------------------------------- /src/dftracer/core/finstrument/functions.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by hariharan on 8/8/22. 3 | // 4 | 5 | #ifndef DFTRACER_FUNCTION_H 6 | #define DFTRACER_FUNCTION_H 7 | /* Config Header */ 8 | #include 9 | #ifdef DFTRACER_FTRACING_ENABLE 10 | /* Internal Header */ 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | /* External Header */ 17 | #include 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | static ConstEventNameType CATEGORY = "FUNC"; 25 | extern "C" { 26 | void __cyg_profile_func_enter(void *, void *) 27 | __attribute__((no_instrument_function)); 28 | void __cyg_profile_func_exit(void *, void *) 29 | __attribute__((no_instrument_function)); 30 | } 31 | namespace dftracer { 32 | class Function { 33 | private: 34 | static std::shared_ptr instance; 35 | static bool stop_trace; 36 | thread_local static std::unordered_map map; 37 | 38 | public: 39 | std::shared_ptr logger; 40 | Function() { 41 | DFTRACER_LOG_DEBUG("Function class intercepted", ""); 42 | logger = DFT_LOGGER_INIT(); 43 | } 44 | 45 | void finalize() { 46 | DFTRACER_LOG_DEBUG("Finalizing Function", ""); 47 | stop_trace = true; 48 | } 49 | ~Function() {} 50 | static std::shared_ptr get_instance() { 51 | DFTRACER_LOG_DEBUG("POSIX class get_instance", ""); 52 | if (!stop_trace && instance == nullptr) { 53 | instance = std::make_shared(); 54 | } 55 | return instance; 56 | } 57 | bool is_active() { return !stop_trace; } 58 | int enter_event(std::string &name); 59 | int exit_event(std::string &name, TimeResolution &start); 60 | }; 61 | 62 | } // namespace dftracer 63 | #endif 64 | #endif // DFTRACER_FUNCTION_H -------------------------------------------------------------------------------- /test/unit/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Unit tests for DFTracer core components 2 | 3 | # Test aggregator functionality 4 | add_executable(test_aggregator test_aggregator.cpp) 5 | target_link_libraries(test_aggregator ${PROJECT_NAME}_core_dbg) 6 | add_dependencies(test_aggregator ${PROJECT_NAME}_core_dbg) 7 | 8 | # Test configuration manager 9 | add_executable(test_configuration test_configuration.cpp) 10 | target_link_libraries(test_configuration ${PROJECT_NAME}_core_dbg yaml-cpp) 11 | add_dependencies(test_configuration ${PROJECT_NAME}_core_dbg) 12 | 13 | # Test serialization 14 | add_executable(test_serialization test_serialization.cpp) 15 | target_link_libraries(test_serialization ${PROJECT_NAME}_core_dbg) 16 | add_dependencies(test_serialization ${PROJECT_NAME}_core_dbg) 17 | 18 | # Test service 19 | add_executable(test_service test_service.cpp) 20 | target_link_libraries(test_service ${PROJECT_NAME}_core_dbg) 21 | add_dependencies(test_service ${PROJECT_NAME}_core_dbg) 22 | 23 | # Add tests to CTest 24 | set(test_name unit_test_aggregator) 25 | df_add_test(${test_name} ${CMAKE_BINARY_DIR}/bin/test_aggregator) 26 | set_common_properties(${test_name}) 27 | 28 | set(test_name unit_test_configuration) 29 | df_add_test(${test_name} ${CMAKE_BINARY_DIR}/bin/test_configuration) 30 | set_common_properties(${test_name}) 31 | 32 | set(test_name unit_test_serialization) 33 | df_add_test(${test_name} ${CMAKE_BINARY_DIR}/bin/test_serialization) 34 | set_common_properties(${test_name}) 35 | 36 | set(test_name unit_test_service) 37 | df_add_test(${test_name} ${CMAKE_BINARY_DIR}/bin/test_service) 38 | set_common_properties(${test_name}) 39 | 40 | # Existing mmap test 41 | add_executable(test_mmap mmap.cpp) 42 | target_link_libraries(test_mmap ${PROJECT_NAME}_core_dbg) 43 | add_dependencies(test_mmap ${PROJECT_NAME}_core_dbg) 44 | add_dependencies(test_mmap ${PROJECT_NAME}_preload_dbg) 45 | 46 | set(test_name unit_test_mmap) 47 | df_add_test(${test_name} ${CMAKE_BINARY_DIR}/bin/test_mmap) 48 | set_common_properties(${test_name}) 49 | -------------------------------------------------------------------------------- /test/unit/mmap.cpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | #include 4 | #include 5 | #include 6 | #include /* mmap() is defined in this header */ 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | int main(int argc, char* argv[]) { 14 | const off_t MEM_SIZE = 5L; 15 | const off_t CHAR_SIZE = 3L; 16 | off_t current_fs = 0; 17 | int fd = open("file.dat", O_RDWR | O_CREAT, (mode_t)0666); 18 | if (fd != -1) { 19 | off_t current_index = 0; 20 | printf("current_index %ld\n", current_index); 21 | int status = lseek(fd, MEM_SIZE, SEEK_SET); 22 | status = write(fd, "", 1); 23 | if (status == -1) { 24 | printf("unable to allocate size %ld (%s)\n", MEM_SIZE, strerror(errno)); 25 | return 0; 26 | } 27 | current_fs = current_index + MEM_SIZE; 28 | printf("current_fs %ld\n", current_fs); 29 | char* dst; 30 | if ((dst = (char*)mmap(0, current_fs, PROT_READ | PROT_WRITE, MAP_SHARED, 31 | fd, 0)) == (caddr_t)-1) { 32 | printf("mmap error for output\n"); 33 | return 0; 34 | } 35 | auto data = std::vector(CHAR_SIZE, 'a'); 36 | for (int i = 0; i < 10; i++) { 37 | if (current_index + CHAR_SIZE > current_fs) { 38 | int status = lseek(fd, current_index + MEM_SIZE, SEEK_SET); 39 | status = write(fd, "", 1); 40 | if (status == -1) { 41 | printf("unable to allocate size %ld (%s)\n", MEM_SIZE, 42 | strerror(errno)); 43 | return 0; 44 | } 45 | current_fs = current_index + MEM_SIZE; 46 | printf("increased current_fs %ld\n", current_fs); 47 | } 48 | 49 | auto write_size = CHAR_SIZE; 50 | memcpy(dst + current_index, data.data(), write_size); 51 | msync(dst, write_size, MS_ASYNC); 52 | printf("%s\n", dst + current_index); 53 | current_index += write_size; 54 | } 55 | munmap(dst, current_index); 56 | } 57 | close(fd); 58 | return 0; 59 | } -------------------------------------------------------------------------------- /script/formatting/autoformat.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | clang_format_exe="clang-format" 4 | if [ $# -ge 1 ]; then 5 | clang_format_exe="$1" 6 | fi 7 | 8 | SUPPORTED_CLANG_FORMAT_VERSION="19.1.7" 9 | 10 | if [ command -v $clang_format_exe >/dev/null 2>&1 ]; then 11 | echo "You must have 'clang-format' in PATH to use 'autoformat.sh'" 12 | exit 1 13 | fi 14 | 15 | clang_format_version_str=$($clang_format_exe --version) 16 | clang_format_version=$(echo "$clang_format_version_str" | grep -oP 'clang-format version \K\d+(\.\d+)+') 17 | 18 | if [ "$clang_format_version" != "$SUPPORTED_CLANG_FORMAT_VERSION" ]; then 19 | echo "WARNING: the .clang-format file in this repo is designed for version 18.1.8." 20 | echo " You are running with clang-format v$clang_format_version." 21 | echo " The resulting formatting is highly likely to be incorrect." 22 | fi 23 | 24 | if [ command -v find >/dev/null 2>&1 ]; then 25 | echo "You must have 'find' in PATH to use 'autoformat.sh'" 26 | exit 1 27 | fi 28 | 29 | if [ command -v dirname >/dev/null 2>&1 ]; then 30 | echo "You must have 'dirname' in PATH to use 'autoformat.sh'" 31 | exit 1 32 | fi 33 | 34 | if [ command -v xargs >/dev/null 2>&1 ]; then 35 | echo "You must have 'dirname' in PATH to use 'autoformat.sh'" 36 | exit 1 37 | fi 38 | 39 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 40 | 41 | curr_dir=$(pwd) 42 | 43 | cd $SCRIPT_DIR 44 | cd .. 45 | cd .. 46 | 47 | echo "Formatting C/C++ code in 'src'" 48 | find src \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -P "$(nproc)" $clang_format_exe -i 49 | 50 | echo "Formatting C/C++ code in 'include'" 51 | find include \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -P "$(nproc)" $clang_format_exe -i 52 | 53 | echo "Formatting C/C++ code in 'test'" 54 | find test \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -P "$(nproc)" $clang_format_exe -i 55 | 56 | cd $curr_dir -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # IDE 35 | .idea 36 | .vscode/* 37 | .cache 38 | 39 | # Environment and Dependency 40 | *venv* 41 | .venv* 42 | dependency/.spack-env 43 | dependency/spack.lock 44 | /build_env/ 45 | /venv-new/ 46 | /env.txt 47 | spack-env 48 | 49 | # Build directories 50 | build 51 | /build-dlio/ 52 | /build_dlio/ 53 | /cmake_example.egg-info/ 54 | /cmake-build-debug/ 55 | /cmake-build-debug-1/ 56 | /temp/dftracer/ 57 | /Testing/Temporary/ 58 | python/dftracer/_version.py 59 | 60 | # Additional aux files 61 | logs/*.log 62 | /examples/df_analyzer/df.log 63 | /examples/df_analyzer/df_analyzer_main.log 64 | /df_analyzer/test.pfw.gz.zindex 65 | /df_analyzer/dask/run_dir/*.pid 66 | /df_analyzer/dask/run_dir/*.json 67 | /data/unet3d/ 68 | /df_analyzer/dask/logs/*.log 69 | /df_analyzer/.nfs* 70 | /hydra_log/unet3d/ 71 | /STDERR 72 | install 73 | __pycache__ 74 | dftracer/__pycache__ 75 | *.log 76 | examples/dfanalyzer_old/test-trace.pfw.gz.zindex 77 | *egg* 78 | 79 | # Install files 80 | pydftracer.egg-info 81 | /dist/ 82 | /output/ 83 | .eggs/ 84 | 85 | # Python checkpoints 86 | /examples/.ipynb_checkpoints/ 87 | /examples/df_analyzer/.ipynb_checkpoints/ 88 | 89 | # Debug files 90 | /*.core 91 | 92 | dfanalyzer_old/dask/run_dir 93 | dfanalyzer_old/dask/logs 94 | dfanalyzer_old/dask/scripts/STDIN.* 95 | *.zindex 96 | *.pfw.gz.idx 97 | .nfs* 98 | 99 | # gitlab 100 | .gitlab/scripts/hydra_log 101 | .gitlab/scripts/run_dlio_workload_test_ci.yaml 102 | *egg-info 103 | hydra* 104 | examples/dfanalyzer/outputs/ 105 | 106 | # data 107 | *.pfw* 108 | .secrets.example 109 | -------------------------------------------------------------------------------- /src/dftracer/core/serialization/json_line.h: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_SERIALIZATION_JSON_LINE_H 2 | #define DFTRACER_SERIALIZATION_JSON_LINE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | namespace dftracer { 20 | class JsonLines { 21 | bool include_metadata; 22 | HashType hostname_hash; 23 | bool convert_metadata(Metadata *metadata, std::stringstream &meta_stream); 24 | 25 | public: 26 | JsonLines(); 27 | size_t initialize(char *buffer, HashType hostname_hash); 28 | size_t data(char *buffer, int index, ConstEventNameType event_name, 29 | ConstEventNameType category, TimeResolution start_time, 30 | TimeResolution duration, dftracer::Metadata *metadata, 31 | ProcessID process_id, ThreadID tid); 32 | size_t metadata(char *buffer, ConstEventNameType name, 33 | ConstEventNameType value, ConstEventNameType ph, 34 | ProcessID process_id, ThreadID thread_id, 35 | bool is_string = true); 36 | size_t counter(char *buffer, int index, ConstEventNameType name, 37 | ConstEventNameType category, TimeResolution start_time, 38 | ProcessID process_id, ThreadID thread_id, 39 | dftracer::Metadata *metadata); 40 | size_t aggregated(char *buffer, int index, ProcessID process_id, 41 | dftracer::AggregatedDataType &data); 42 | size_t finalize(char *buffer, bool end_sym = false) { 43 | if (end_sym) { 44 | buffer[0] = ']'; 45 | return 1; 46 | } 47 | return 0; 48 | } 49 | }; 50 | } // namespace dftracer 51 | 52 | #endif // DFTRACER_SERIALIZATION_JSON_LINE_H -------------------------------------------------------------------------------- /test/c/test.c: -------------------------------------------------------------------------------- 1 | // 2 | // Created by hariharan on 8/8/22. 3 | // 4 | #ifndef _DEFAULT_SOURCE 5 | #define _DEFAULT_SOURCE 6 | #endif 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int bar(); 16 | void foo() { 17 | DFTRACER_C_FUNCTION_START(); 18 | DFTRACER_C_FUNCTION_UPDATE_INT("key", 0); 19 | DFTRACER_C_FUNCTION_UPDATE_STR("key", "0"); 20 | usleep(1000); 21 | DFTRACER_C_REGION_START(CUSTOM); 22 | DFTRACER_C_REGION_UPDATE_INT(CUSTOM, "key", 0); 23 | DFTRACER_C_REGION_UPDATE_STR(CUSTOM, "key", "0"); 24 | bar(); 25 | usleep(1000); 26 | DFTRACER_C_REGION_START(CUSTOM_BLOCK); 27 | usleep(1000); 28 | DFTRACER_C_REGION_END(CUSTOM_BLOCK); 29 | DFTRACER_C_REGION_END(CUSTOM); 30 | DFTRACER_C_FUNCTION_END(); 31 | } 32 | 33 | int main(int argc, char *argv[]) { 34 | int init = 0; 35 | if (argc > 2) { 36 | if (strcmp(argv[2], "1") == 0) { 37 | DFTRACER_C_INIT(NULL, NULL, NULL); 38 | init = 1; 39 | } 40 | } 41 | DFTRACER_C_METADATA(meta, "key", "value"); 42 | char filename[1024]; 43 | sprintf(filename, "%s/demofile_c.txt", argv[1]); 44 | foo(); 45 | FILE *fh = fopen(filename, "w+"); 46 | fwrite("hello", sizeof("hello"), 1, fh); 47 | int child_pid = fork(); // fork a duplicate process 48 | int pid = getpid(); 49 | int child_ppid = getppid(); // get the child's parent pid 50 | printf("child_pid:%d ppid:%d pid:%d\n", child_pid, child_ppid, pid); 51 | 52 | if (child_ppid == pid) { 53 | // if the current process is a child of the main process 54 | char *arr[] = {"ls", "-l", NULL}; 55 | execv("/bin/ls", arr); 56 | if (init) { 57 | DFTRACER_C_FINI(); 58 | } 59 | return 0; 60 | } 61 | int status = -1; 62 | waitpid(child_pid, &status, WEXITED); 63 | fclose(fh); 64 | if (init) { 65 | DFTRACER_C_FINI(); 66 | } 67 | return 0; 68 | } 69 | 70 | // Add definition for bar() to fix the error 71 | int bar() { 72 | // Dummy implementation 73 | return 0; 74 | } 75 | -------------------------------------------------------------------------------- /src/dftracer/core/common/singleton.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 3/28/23. 3 | // 4 | 5 | #ifndef DFTRACER_SINGLETON_H 6 | #define DFTRACER_SINGLETON_H 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | /** 14 | * Make a class singleton when used with the class. format for class name T 15 | * Singleton::GetInstance() 16 | * @tparam T 17 | */ 18 | namespace dftracer { 19 | template 20 | class Singleton { 21 | public: 22 | /** 23 | * Members of Singleton Class 24 | */ 25 | /** 26 | * Uses unique pointer to build a static global instance of variable. 27 | * @tparam T 28 | * @return instance of T 29 | */ 30 | template 31 | static std::shared_ptr get_instance(Args... args) { 32 | if (stop_creating_instances) return nullptr; 33 | if (instance == nullptr) { 34 | instance = std::make_shared(std::forward(args)...); 35 | } 36 | 37 | return instance; 38 | } 39 | 40 | /** 41 | * Uses unique pointer to build a static global instance of variable. 42 | * @tparam T 43 | * @return instance of T 44 | */ 45 | template 46 | static std::shared_ptr get_new_instance(Args... args) { 47 | if (stop_creating_instances) return nullptr; 48 | instance = std::make_shared(std::forward(args)...); 49 | return instance; 50 | } 51 | 52 | /** 53 | * Operators 54 | */ 55 | Singleton &operator=(const Singleton) = delete; /* deleting = operatos*/ 56 | public: 57 | Singleton(const Singleton &) = delete; /* deleting copy constructor. */ 58 | static void finalize() { 59 | stop_creating_instances = true; 60 | if (instance == nullptr) return; 61 | } 62 | 63 | protected: 64 | // All template classes should instantiate the static members 65 | static bool stop_creating_instances; 66 | static std::shared_ptr instance; 67 | 68 | Singleton() {} /* hidden default constructor. */ 69 | }; 70 | 71 | } // namespace dftracer 72 | #endif // DFTRACER_SINGLETON_H 73 | -------------------------------------------------------------------------------- /test/dlio_benchmark/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(DLIO_BENCHMARK_EXE ${MAIN_PYTHON_SITE_PACKAGES}/dlio_benchmark/main.py) 2 | message("-- Found dlio_benchmark at location " ${DLIO_BENCHMARK_EXE}) 3 | find_program(PYTHON_EXE python) 4 | set(COMMON_ARGS workload=unet3d ++workload.train.computation_time=0.05 5 | ++workload.evaluation.eval_time=0.01 ++workload.train.epochs=2 ++workload.workflow.train=True 6 | ++workload.workflow.generate_data=True ++workload.dataset.num_files_train=16 7 | ++workload.dataset.num_files_eval=16 ++workload.reader.read_threads=2 8 | ++workload.dataset.record_length=4096 ++workload.dataset.record_length_stdev=0 9 | ++workload.framework=tensorflow ++workload.reader.data_loader=tensorflow) 10 | set(formats npz hdf5 tfrecord png jpeg) 11 | set(lines 2055 1159 715 935 903) 12 | list(LENGTH formats formats_length) 13 | math(EXPR formats_length "${formats_length} - 1") 14 | message(STATUS "Number of formats: ${formats_length}") 15 | foreach (index RANGE ${formats_length}) 16 | list(GET formats ${index} format) 17 | list(GET lines ${index} line) 18 | set(test_name dlio_${format}) 19 | df_add_test(${test_name} ${PYTHON_EXE} ${DLIO_BENCHMARK_EXE} ${COMMON_ARGS} ++workload.dataset.format=${format} 20 | ++workload.output.folder=${CMAKE_CURRENT_BINARY_DIR}/output_${format}) 21 | set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT DFTRACER_ENABLE=1) 22 | #set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT DFTRACER_LOG_FILE=${CMAKE_CURRENT_BINARY_DIR}/output_${format}/trace) 23 | set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT DFTRACER_INC_METADATA=1) 24 | set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT DFTRACER_LOG_LEVEL=INFO) 25 | set_property(TEST ${test_name} APPEND PROPERTY ENVIRONMENT DFTRACER_TRACE_COMPRESSION=0) 26 | 27 | df_add_test(${test_name}_check_file_exists ${BASH_PROGRAM} ${CMAKE_SOURCE_DIR}/test/check_file.sh ${CMAKE_CURRENT_BINARY_DIR}/output_${format}/.trace*.pfw* ${line}) 28 | set_tests_properties(${test_name}_check_file_exists PROPERTIES DEPENDS ${test_name}) 29 | endforeach () 30 | -------------------------------------------------------------------------------- /src/dftracer/core/utils/posix_internal.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 8/23/23. 3 | // 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | int df_open(const char *pathname, int flags, ...) { 11 | DFTRACER_LOG_DEBUG("df_open", ""); 12 | mode_t mode; 13 | va_list args; 14 | long result; 15 | 16 | va_start(args, flags); 17 | if (flags & O_CREAT) { 18 | mode = va_arg(args, mode_t); 19 | } else { 20 | mode = 0; 21 | } 22 | va_end(args); 23 | #if defined(SYS_open) 24 | result = syscall(SYS_open, pathname, flags, mode); 25 | #else 26 | result = syscall(SYS_openat, AT_FDCWD, pathname, flags, mode); 27 | #endif 28 | 29 | if (result >= 0) return (int)result; 30 | return -1; // GCOV_EXCL_LINE 31 | } 32 | 33 | ssize_t df_write(int fd, const void *buf, size_t count) { 34 | DFTRACER_LOG_DEBUG("df_write %d %d", fd, count); 35 | return syscall(SYS_write, fd, buf, count); 36 | } 37 | 38 | off_t df_read(int fd, void *buf, size_t count) { 39 | DFTRACER_LOG_DEBUG("df_read", ""); 40 | return syscall(SYS_read, fd, buf, count); 41 | } 42 | 43 | int df_close(int fd) { 44 | DFTRACER_LOG_DEBUG("close %d", fd); 45 | return syscall(SYS_close, fd); 46 | } 47 | 48 | int df_unlink(const char *filename) { 49 | DFTRACER_LOG_DEBUG("df_unlink", ""); 50 | #if defined(SYS_unlink) 51 | return syscall(SYS_unlink, filename); 52 | #else 53 | return syscall(SYS_unlinkat, filename); 54 | #endif 55 | } 56 | 57 | int df_fsync(int fd) { // GCOV_EXCL_START 58 | DFTRACER_LOG_DEBUG("df_fsync", ""); 59 | return syscall(SYS_fsync, fd); 60 | } // GCOV_EXCL_STOP 61 | 62 | ssize_t df_readlink(const char *path, char *buf, size_t bufsize) { 63 | DFTRACER_LOG_DEBUG("df_readlink", ""); 64 | #ifdef SYS_readlink 65 | return syscall(SYS_readlink, path, buf, bufsize); 66 | #else 67 | return syscall(SYS_readlinkat, path, buf, bufsize); 68 | #endif 69 | } 70 | 71 | ThreadID df_gettid() { 72 | DFTRACER_LOG_DEBUG("df_gettid", ""); 73 | return syscall(SYS_gettid); 74 | } 75 | 76 | ProcessID df_getpid() { 77 | DFTRACER_LOG_DEBUG("df_getpid", ""); 78 | return syscall(SYS_getpid); 79 | } 80 | -------------------------------------------------------------------------------- /test/py/hip_test.py: -------------------------------------------------------------------------------- 1 | from time import sleep 2 | import torch 3 | 4 | from dftracer.python.dbg import dftracer, dft_fn as Profile 5 | import os 6 | 7 | print("LIB PATH", os.environ["LD_LIBRARY_PATH"]) 8 | 9 | # Delete hip_data.pfw if exists 10 | if os.path.exists("hip_data.pfw"): 11 | os.remove("hip_data.pfw") 12 | 13 | log_inst = dftracer.initialize_log(logfile="hip_data.pfw", data_dir=None, process_id=-1) 14 | 15 | comp_dft = Profile("COMPUTE") 16 | 17 | 18 | def check_gpu_availability(): 19 | """Check if GPU is available and print device info""" 20 | print("PyTorch version:", torch.__version__) 21 | print("CUDA available:", torch.cuda.is_available()) 22 | 23 | if torch.cuda.is_available(): 24 | print("CUDA version:", torch.version.cuda) 25 | print("Number of GPUs:", torch.cuda.device_count()) 26 | print("Current GPU:", torch.cuda.get_device_name(0)) 27 | device = torch.device("cuda") 28 | else: 29 | raise RuntimeError("CUDA is not available") 30 | 31 | return device 32 | 33 | 34 | @comp_dft.log 35 | def basic_tensor_operations(device): 36 | """Demonstrate basic tensor operations on GPU""" 37 | print("\n=== Basic Tensor Operations ===") 38 | 39 | # Create tensors and move to GPU 40 | a = torch.randn(1000, 1000).to(device) 41 | b = torch.randn(1000, 1000).to(device) 42 | 43 | print(f"Tensor a device: {a.device}") 44 | print(f"Tensor b device: {b.device}") 45 | 46 | # Basic operations 47 | c = a + b 48 | d = torch.matmul(a, b) 49 | e = torch.sum(a, dim=1) 50 | 51 | print(f"Addition result shape: {c.shape}") 52 | print(f"Matrix multiplication result shape: {d.shape}") 53 | print(f"Sum along dimension 1 shape: {e.shape}") 54 | 55 | return a, b, c, d 56 | 57 | 58 | if __name__ == "__main__": 59 | device = check_gpu_availability() 60 | a, b, c, d = basic_tensor_operations(device) 61 | sleep(2) 62 | log_inst.finalize() 63 | with open("hip_data.pfw", "r") as f: 64 | data = f.read() 65 | assert ( 66 | "HIP_RUNTIME_API" in data or "CUDA" in data 67 | ), "HIP_RUNTIME_API or CUDA not found in log file" 68 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. DFTracer documentation master file, created by 2 | sphinx-quickstart on Sun Nov 26 20:15:18 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | =============================================================================== 7 | DFTracer: is a library for profiling I/O calls and application functions. 8 | =============================================================================== 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | :caption: User Guide 13 | 14 | overview 15 | definitions 16 | limitations 17 | build 18 | docker 19 | building_applications 20 | api 21 | models 22 | trace_format 23 | ai_logging 24 | 25 | .. toctree:: 26 | :maxdepth: 2 27 | :caption: DFAnalyzer 28 | 29 | dfanalyzer_build 30 | dfanalyzer_distributed 31 | dfanalyzer_conf 32 | dfanalyzer_alcf_polaris 33 | dfanalyzer_overlap_analysis 34 | dfanalyzer_custom_columns 35 | 36 | .. toctree:: 37 | :maxdepth: 2 38 | :caption: Utilities 39 | 40 | utilities 41 | bash_utilities 42 | perfetto 43 | 44 | .. toctree:: 45 | :maxdepth: 2 46 | :caption: Debugging 47 | 48 | debugging 49 | 50 | .. toctree:: 51 | :maxdepth: 2 52 | :caption: Reference 53 | 54 | examples 55 | migration 56 | 57 | .. toctree:: 58 | :maxdepth: 2 59 | :caption: Applications 60 | 61 | pegasus_montage 62 | pegasus_genome 63 | 64 | .. toctree:: 65 | :maxdepth: 2 66 | :caption: Contributing 67 | 68 | developer-guide 69 | style-guides 70 | testing 71 | coverage 72 | 73 | .. toctree:: 74 | :maxdepth: 1 75 | :caption: Links: 76 | 77 | GitHub 78 | Python Binding Documentation 79 | Python Binding GitHub 80 | Utilities Documentation 81 | Utilities GitHub 82 | 83 | ================== 84 | Indices and tables 85 | ================== 86 | 87 | * :ref:`genindex` 88 | * :ref:`modindex` 89 | * :ref:`search` 90 | -------------------------------------------------------------------------------- /src/dftracer/core/aggregator/rules.h: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_AGGREGATOR_RULES_H 2 | #define DFTRACER_AGGREGATOR_RULES_H 3 | // internal headers 4 | #include 5 | 6 | // standard headers 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | 18 | namespace dftracer { 19 | 20 | class Rules { 21 | public: 22 | Rules() = default; 23 | 24 | // Add a rule (as string), parse and build AST 25 | inline void addRule(const std::string& rule) { 26 | RuleAST ast = parseRule(rule); 27 | asts_.emplace_back(std::move(ast)); 28 | } 29 | 30 | inline bool satisfies(const AggregatedKey* key) const { 31 | for (const auto& ast : asts_) { 32 | if (eval(ast.root.get(), key)) return true; 33 | } 34 | return false; 35 | } 36 | 37 | private: 38 | std::vector asts_; 39 | 40 | inline std::string fixString(const std::string& str) const { 41 | std::string val = str; 42 | // Remove quotes if present 43 | if (!val.empty() && ((val.front() == '\'' && val.back() == '\'') || 44 | (val.front() == '"' && val.back() == '"'))) { 45 | val = val.substr(1, val.size() - 2); 46 | } 47 | return val; 48 | } 49 | inline Value stringToValue(const std::string& str) const { 50 | std::string val = str; 51 | // Remove quotes if present 52 | if (!val.empty() && ((val.front() == '\'' && val.back() == '\'') || 53 | (val.front() == '"' && val.back() == '"'))) { 54 | val = val.substr(1, val.size() - 2); 55 | } 56 | try { 57 | if (val.find('.') != std::string::npos) { 58 | return Value{std::stod(val)}; 59 | } else { 60 | return Value{std::stoull(val)}; 61 | } 62 | } catch (...) { 63 | return Value{val}; 64 | } 65 | } 66 | RuleAST parseRule(const std::string& rule); 67 | 68 | bool eval(const RuleAST::Node* node, const AggregatedKey* key) const; 69 | }; 70 | 71 | } // namespace dftracer 72 | 73 | #endif // DFTRACER_AGGREGATOR_RULES_H -------------------------------------------------------------------------------- /src/dftracer/core/compression/zlib_compression.h: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_COMPRESSION_ZLIB_COMPRESSION_H 2 | #define DFTRACER_COMPRESSION_ZLIB_COMPRESSION_H 3 | 4 | #include 5 | // 6 | #include // Include this first to ensure size_t is defined 7 | // 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | namespace dftracer { 17 | class ZlibCompression { 18 | public: 19 | ZlibCompression() : chunk_size_(0) {} 20 | 21 | int initialize(size_t chunk_size) { 22 | chunk_size_ = chunk_size + 16 * 1024; 23 | strm_.zalloc = Z_NULL; 24 | strm_.zfree = Z_NULL; 25 | strm_.opaque = Z_NULL; 26 | if (deflateInit2(&strm_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 + 16, 8, 27 | Z_DEFAULT_STRATEGY) != Z_OK) { 28 | DFTRACER_LOG_ERROR("Failed to initialize zlib for gzip compression", ""); 29 | return -1; 30 | } 31 | return 0; 32 | } 33 | 34 | ~ZlibCompression() {} 35 | 36 | // Compresses data from buffer starting at position, in place. 37 | // Returns the number of bytes written to buffer (compressed size). 38 | size_t compress(char* buffer, size_t data_size) { 39 | std::vector out_buffer(chunk_size_); 40 | strm_.avail_in = static_cast(data_size); 41 | strm_.next_in = reinterpret_cast(buffer); 42 | strm_.avail_out = static_cast(chunk_size_); 43 | strm_.next_out = reinterpret_cast(out_buffer.data()); 44 | 45 | int ret = deflate(&strm_, Z_FINISH); 46 | if (ret != Z_STREAM_END && ret != Z_OK) { 47 | DFTRACER_LOG_ERROR("Compression failed", ""); 48 | return 0; 49 | } 50 | 51 | size_t compressed_size = chunk_size_ - strm_.avail_out; 52 | std::memcpy(buffer, out_buffer.data(), compressed_size); 53 | 54 | deflateReset(&strm_); 55 | return compressed_size; 56 | } 57 | 58 | int finalize() { 59 | deflateEnd(&strm_); 60 | return 0; 61 | } 62 | 63 | private: 64 | size_t chunk_size_; 65 | z_stream strm_; 66 | }; 67 | } // namespace dftracer 68 | 69 | #endif // DFTRACER_COMPRESSION_ZLIB_COMPRESSION_H 70 | -------------------------------------------------------------------------------- /docs/_themes/sphinx_rtd_theme/footer.html: -------------------------------------------------------------------------------- 1 |
2 | {% if (theme_prev_next_buttons_location == 'bottom' or theme_prev_next_buttons_location == 'both') and (next or prev) %} 3 | 11 | {% endif %} 12 | 13 |
14 | 15 |
16 |

17 | {%- if show_copyright %} 18 | {%- if hasdoc('copyright') %} 19 | {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} 20 | {%- else %} 21 | {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} 22 | {%- endif %} 23 | {%- endif %} 24 | 25 | {%- if build_id and build_url %} 26 | {% trans build_url=build_url, build_id=build_id %} 27 | 28 | Build 29 | {{ build_id }}. 30 | 31 | {% endtrans %} 32 | {%- elif commit %} 33 | {% trans commit=commit %} 34 | 35 | Revision {{ commit }}. 36 | 37 | {% endtrans %} 38 | {%- elif last_updated %} 39 | {% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %} 40 | {%- endif %} 41 | 42 |

43 |
44 | 45 | {%- if show_sphinx %} 46 | {% trans %}Built with Sphinx using a theme provided by Read the Docs{% endtrans %}. 47 | {%- endif %} 48 | 49 | {%- block extrafooter %} {% endblock %} 50 | 51 |
52 | 53 | -------------------------------------------------------------------------------- /cmake/configure_files/dftracer_module.lua.in: -------------------------------------------------------------------------------- 1 | -- LMod module file for DFTRACER 2 | 3 | -- CMAKE_INSTALL_PREFIX: @CMAKE_INSTALL_PREFIX@ 4 | -- CMAKE_BUILD_TYPE: @CMAKE_BUILD_TYPE@ 5 | -- C Compiler: @CMAKE_C_COMPILER@ 6 | -- C FLAGS: @CMAKE_C_FLAGS@ 7 | -- C FLAGS_DEBUG: @CMAKE_C_FLAGS_DEBUG@ 8 | -- C FLAGS_RELWITHDEBINFO: @CMAKE_C_FLAGS_RELWITHDEBINFO@ 9 | -- C FLAGS_RELEASE: @CMAKE_C_FLAGS_RELEASE@ 10 | -- CXX Compiler: @CMAKE_CXX_COMPILER@ 11 | -- CXX FLAGS: @CMAKE_CXX_FLAGS@ 12 | -- CXX FLAGS_DEBUG: @CMAKE_CXX_FLAGS_DEBUG@ 13 | -- CXX FLAGS_RELWITHDEBINFO: @CMAKE_CXX_FLAGS_RELWITHDEBINFO@ 14 | -- CXX FLAGS_RELEASE: @CMAKE_CXX_FLAGS_RELEASE@ 15 | -- DFTRACER_GNU_LINUX: @DFTRACER_GNU_LINUX@ 16 | -- DFTRACER_HAS_DOXYGEN: @DFTRACER_HAS_DOXYGEN@ 17 | -- DFTRACER_HAS_STD_FILESYSTEM: @DFTRACER_HAS_STD_FILESYSTEM@ 18 | -- DFTRACER_HAS_STD_FSTREAM_FD: @DFTRACER_HAS_STD_FSTREAM_FD@ 19 | 20 | help( 21 | [[ 22 | DYnamic and Asynchronous Data streamliner (DFTRACER) version @DFTRACER_VERSION@. 23 | ]]) 24 | 25 | whatis("Package: DFTRACER") 26 | whatis("Version: @DFTRACER_VERSION@") 27 | whatis("Description: DYnamic and Asynchronous Data streamliner (DFTRACER).") 28 | whatis("URL: https://github.com/flux-framework/dftracer") 29 | whatis("CMAKE_INSTALL_PREFIX: @CMAKE_INSTALL_PREFIX@") 30 | whatis("CMAKE_BUILD_TYPE: @CMAKE_BUILD_TYPE@") 31 | whatis("C Compiler: @CMAKE_C_COMPILER@") 32 | whatis("C FLAGS: @CMAKE_C_FLAGS@") 33 | whatis("C FLAGS_DEBUG: @CMAKE_C_FLAGS_DEBUG@") 34 | whatis("C FLAGS_RELWITHDEBINFO: @CMAKE_C_FLAGS_RELWITHDEBINFO@") 35 | whatis("C FLAGS_RELEASE: @CMAKE_C_FLAGS_RELEASE@") 36 | whatis("CXX Compiler: @CMAKE_CXX_COMPILER@") 37 | whatis("CXX FLAGS: @CMAKE_CXX_FLAGS@") 38 | whatis("CXX FLAGS_DEBUG: @CMAKE_CXX_FLAGS_DEBUG@") 39 | whatis("CXX FLAGS_RELWITHDEBINFO: @CMAKE_CXX_FLAGS_RELWITHDEBINFO@") 40 | whatis("CXX FLAGS_RELEASE: @CMAKE_CXX_FLAGS_RELEASE@") 41 | whatis("DFTRACER_GNU_LINUX: @DFTRACER_GNU_LINUX@") 42 | whatis("DFTRACER_HAS_DOXYGEN: @DFTRACER_HAS_DOXYGEN@") 43 | whatis("DFTRACER_HAS_STD_FILESYSTEM: @DFTRACER_HAS_STD_FILESYSTEM@") 44 | whatis("DFTRACER_HAS_STD_FSTREAM_FD: @DFTRACER_HAS_STD_FSTREAM_FD@") 45 | 46 | prepend_path("PATH","@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@") 47 | prepend_path("LD_LIBRARY_PATH","@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@") 48 | 49 | pushenv("DFTRACER_DIR","@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_DIR@") -------------------------------------------------------------------------------- /examples/graph_visualization/README.md: -------------------------------------------------------------------------------- 1 | # Ipycytoscape visualization for trace graph 2 | 3 | ## Overview 4 | 5 | This example demonstrates how to represent traces(DFanalyzer events) as graphs and visualize them using ipycytoscape within a Jupyter Notebook environment. 6 | 7 | ## Requirements 8 | 9 | To visualize ipycytoscape graphs in DFanalyzer, the following packages are required: 10 | 11 | - **networkx** 12 | - **ipycytoscape** 13 | - **ipywidgets** 14 | 15 | You can install these packages using pip: 16 | ```bash 17 | pip install networkx ipycytoscape ipywidgets 18 | ``` 19 | 20 | ## Graph creation and styling 21 | We use folloing methods to convert the traces into graph and perform visualization. 22 | 23 | - **create_nx_graph**: 24 | This method from *GraphFunctions* class takes dask dataframe (analyzer.events) and return a networkx graph. In this example, we define nodes as each event in dataframe, and edges between two 25 | events represent the existance of overlapping time between the events. The definition of nodes/edges may be changed within this method for different use cases. 26 | 27 | - **visualize_graph**: 28 | This method takes takes *networkx* graph object and a *CytoGraph* object. Two methods used from *CytoGraph* are 29 | - ***get_json*** is used to convert nx graph into json format requried for ipycytoscape visualization. 30 | - ***get_style*** is used for styling the cytoscape visualization. We can modify this method to insert different filters (different coloring and layouts) during the visualization. 31 | 32 | 33 | 34 | ## Usage 35 | 36 | In this example, we used following trace event to represent as graph and visualize using ipycytoscape. Two different colors represent events related with two mount points. 37 | 38 | data 39 | 40 | The trace data is visualized using ipycytoscape, representing each event as a node, with connections indicating overlapping windows. 41 | Nodes with a degree greater than 2 are styled in red; others in purple. 42 | 43 | vis 44 | 45 | ## Additional Resource 46 | 47 | - Networkx 48 | - Ipycytoscape 49 | 50 | -------------------------------------------------------------------------------- /docs/building_applications.rst: -------------------------------------------------------------------------------- 1 | ========================================================= 2 | Building applications with DFTracer Code Annotations 3 | ========================================================= 4 | 5 | This section provides guidelines on how to build applications with DFTracer Code Annotations. 6 | 7 | Building for Projects with Makefiles 8 | ------------------------------------ 9 | 10 | To integrate DFTracer into your Makefile projects, you need to modify the `CFLAGS` or `CXXFLAGS` and `LDFLAGS` in your Makefile to include the DFTracer's headers and libraries. Below are the steps: 11 | 12 | 1. **Set the DFTracer include and library paths:** 13 | 14 | Ensure you know the paths where DFTracer's header files and libraries are located. Typically, they might be in directories like `/path/to/dftracer/include` and `/path/to/dftracer/lib64`. If you have built DFTracer with pip then these paths may look like `/path/to/lib/pythonX/site-packages/dftracer/include` and `/path/to/lib/pythonX/site-packages/dftracer/lib64`. 15 | 16 | 2. **Modify your Makefile:** 17 | 18 | Open your Makefile and locate the sections where `CFLAGS` or `CXXFLAGS` and `LDFLAGS` are defined. Add the include path to `CFLAGS` or `CXXFLAGS` and the library path to `LDFLAGS`. 19 | 20 | Here is an example snippet of how to modify a Makefile to build a C program: 21 | 22 | .. code-block:: makefile 23 | 24 | # Existing CFLAGS and LDFLAGS 25 | CFLAGS = -g -O2 -std=c99 26 | LDFLAGS = -lm 27 | 28 | # Add DFTracer include and library paths 29 | DFTRACER_CFLAGS = -I/path/to/dftracer/include 30 | DFTRACER_LDFLAGS = -L/path/to/dftracer/lib64 -ldftracer 31 | 32 | # Append to existing CFLAGS and LDFLAGS 33 | CFLAGS += $(DFTRACER_CFLAGS) 34 | LDFLAGS += $(DFTRACER_LDFLAGS) 35 | 36 | 3. **Use the DFTracer macros in your source code:** 37 | 38 | Ensure that you include the DFTracer header in your source files and use the profiling macros as needed. 39 | 40 | Example for a C program: 41 | 42 | .. code-block:: c 43 | 44 | #include 45 | 46 | void some_function_with_annotations() { 47 | DFTRACER_C_FUNCTION_START(); 48 | sleep(1); 49 | DFTRACER_C_FUNCTION_END(); 50 | return; 51 | } 52 | 53 | 4. **Build your project:** 54 | 55 | Run `make` as usual to build your project with DFTracer annotations integrated. 56 | 57 | .. code-block:: sh 58 | 59 | make 60 | 61 | 62 | -------------------------------------------------------------------------------- /script/formatting/check-formatting.sh: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | clang_format_exe="clang-format" 4 | if [ $# -ge 1 ]; then 5 | clang_format_exe="$1" 6 | fi 7 | 8 | SUPPORTED_CLANG_FORMAT_VERSION="19.1.7" 9 | 10 | if [ command -v $clang_format_exe >/dev/null 2>&1 ]; then 11 | echo "You must have 'clang-format' in PATH to use 'check-formatting.sh'" 12 | exit 1 13 | fi 14 | 15 | clang_format_version_str=$($clang_format_exe --version) 16 | clang_format_version=$(echo "$clang_format_version_str" | grep -oP 'clang-format version \K\d+(\.\d+)+') 17 | 18 | if [ "$clang_format_version" != "$SUPPORTED_CLANG_FORMAT_VERSION" ]; then 19 | echo "WARNING: the .clang-format file in this repo is designed for version $SUPPORTED_CLANG_FORMAT_VERSION." 20 | echo " You are running with clang-format v$clang_format_version." 21 | echo " The resulting check is highly likely to be incorrect." 22 | fi 23 | 24 | if [ command -v find >/dev/null 2>&1 ]; then 25 | echo "You must have 'find' in PATH to use 'check-formatting.sh'" 26 | exit 1 27 | fi 28 | 29 | if [ command -v dirname >/dev/null 2>&1 ]; then 30 | echo "You must have 'dirname' in PATH to use 'check-formatting.sh'" 31 | exit 1 32 | fi 33 | 34 | if [ command -v xargs >/dev/null 2>&1 ]; then 35 | echo "You must have 'dirname' in PATH to use 'check-formatting.sh'" 36 | exit 1 37 | fi 38 | 39 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 40 | 41 | curr_dir=$(pwd) 42 | 43 | cd $SCRIPT_DIR 44 | cd .. 45 | cd .. 46 | 47 | echo "Check formatting of C/C++ code in 'src'" 48 | find src \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -P "$(nproc)" $clang_format_exe --dry-run -Werror 49 | src_check_rc=$? 50 | 51 | echo "Check formatting of C/C++ code in 'include'" 52 | find include \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -P "$(nproc)" $clang_format_exe --dry-run -Werror 53 | include_check_rc=$? 54 | 55 | echo "Check formatting of C/C++ code in 'test'" 56 | find test \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) -print0 | xargs -0 -P "$(nproc)" $clang_format_exe --dry-run -Werror 57 | test_check_rc=$? 58 | 59 | cd $curr_dir 60 | 61 | if [ $src_check_rc -ne 0 ] || [ $include_check_rc -ne 0 ] || [ $test_check_rc -ne 0 ]; then 62 | echo "Some formatting checks failed. Please run 'autoformat.sh' to fix the issues." 63 | exit 2 64 | else 65 | echo "All checks passed successfully." 66 | exit 0 67 | fi -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "DFTracer Development Container", 3 | "dockerFile": "../infrastructure/docker/Dockerfile.dev", 4 | "context": "..", 5 | "build": { 6 | "args": { 7 | "PYTHON_VERSION": "3.10", 8 | "USERNAME": "developer", 9 | "USER_UID": "1000", 10 | "USER_GID": "1000" 11 | } 12 | }, 13 | "runArgs": [ 14 | "--cap-add=SYS_PTRACE", 15 | "--security-opt", 16 | "seccomp=unconfined" 17 | ], 18 | "workspaceFolder": "/workspace/dftracer", 19 | "workspaceMount": "source=${localWorkspaceFolder},target=/workspace/dftracer,type=bind", 20 | "remoteUser": "developer", 21 | "features": { 22 | "ghcr.io/devcontainers/features/common-utils:2": { 23 | "installZsh": true, 24 | "installOhMyZsh": true, 25 | "upgradePackages": true, 26 | "username": "developer", 27 | "userUid": "1000", 28 | "userGid": "1000" 29 | }, 30 | "ghcr.io/devcontainers/features/git:1": { 31 | "version": "latest" 32 | }, 33 | "ghcr.io/devcontainers/features/git-lfs:1": {} 34 | }, 35 | "customizations": { 36 | "vscode": { 37 | "settings": { 38 | "python.defaultInterpreterPath": "/usr/local/bin/python", 39 | "python.linting.enabled": true, 40 | "python.linting.pylintEnabled": true, 41 | "python.formatting.provider": "black", 42 | "python.testing.pytestEnabled": true, 43 | "python.testing.unittestEnabled": false, 44 | "python.testing.pytestArgs": [ 45 | "test" 46 | ], 47 | "files.watcherExclude": { 48 | "**/build/**": true, 49 | "**/dist/**": true, 50 | "**/__pycache__/**": true, 51 | "**/.pytest_cache/**": true 52 | }, 53 | "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools", 54 | "cmake.configureOnOpen": false, 55 | "terminal.integrated.defaultProfile.linux": "bash" 56 | }, 57 | "extensions": [ 58 | "ms-python.python", 59 | "ms-python.vscode-pylance", 60 | "ms-vscode.cpptools", 61 | "ms-vscode.cmake-tools", 62 | "ms-azuretools.vscode-docker", 63 | "eamodio.gitlens", 64 | "github.copilot", 65 | "github.vscode-pull-request-github", 66 | "yzhang.markdown-all-in-one", 67 | "mhutchie.git-graph", 68 | "redhat.vscode-yaml", 69 | "streetsidesoftware.code-spell-checker" 70 | ] 71 | } 72 | }, 73 | "postCreateCommand": "pip install -e .[test,dfanalyzer]", 74 | "postStartCommand": "git config --global --add safe.directory /workspace/dftracer", 75 | "remoteEnv": { 76 | "DFTRACER_ENABLE": "0", 77 | "PYTHONPATH": "/workspace/dftracer:${PYTHONPATH}" 78 | } 79 | } -------------------------------------------------------------------------------- /script/dftracer_pgzip: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The script is a multi-threaded gzip utility for dftracer traces 4 | # This has the following signature. 5 | # 6 | # usage: dftracer_pgzip [-v] [-d input_directory] 7 | # -v enable verbose mode 8 | # -h display help 9 | # -d input_directory specify input directories. should contain .pfw or .pfw.gz files. 10 | 11 | date_echo() { 12 | dt=$(date '+%d/%m/%Y %H:%M:%S'); 13 | echo "$dt $*" 14 | } 15 | 16 | progress_date_echo() { 17 | dt=$(date '+%d/%m/%Y %H:%M:%S') 18 | echo -ne "$dt $*"\\r 19 | } 20 | 21 | LOG_DIR=$PWD 22 | 23 | function usage { 24 | echo "usage: $(basename "$0") [-v] [-d input_directory]" 25 | echo " -v enable verbose mode" 26 | echo " -h display help" 27 | echo " -d input_directory specify input directories. should contain .pfw or .pfw.gz files." 28 | exit 1 29 | } 30 | while getopts ':cvfd:h' opt; do 31 | case "$opt" in 32 | d) 33 | LOG_DIR="${OPTARG}" 34 | ;; 35 | v) 36 | set -x 37 | ;; 38 | h) 39 | usage 40 | ;; 41 | 42 | :) 43 | echo -e "option requires an argument.\n" 44 | usage 45 | ;; 46 | 47 | ?) 48 | echo -e "Invalid command option.\n" 49 | usage 50 | ;; 51 | esac 52 | done 53 | LOG_DIR=$(realpath "$LOG_DIR") 54 | 55 | shift "$(($OPTIND -1))" 56 | total=$(find "$LOG_DIR" -maxdepth 1 -type f -name "*.pfw" | wc -l) 57 | 58 | if [ "$total" == "0" ]; then 59 | date_echo "The folder does not contain any pfw files." 60 | exit 1 61 | fi 62 | date_echo "Found $total .pfw files to process." 63 | pushd $LOG_DIR > /dev/null || return 64 | JOBS_LIMIT=$(nproc --all) 65 | files=("$LOG_DIR"/*.pfw) 66 | total=${#files[@]} 67 | processed=0 68 | 69 | # loop over logs 70 | for file_index in "${!files[@]}"; do 71 | file=${files[$file_index]} 72 | running_jobs=$(jobs -rp | wc -l) 73 | if [ $running_jobs -ge $JOBS_LIMIT ]; then 74 | date_echo "Waiting for running jobs to be less than $JOBS_LIMIT. Current: $running_jobs" 75 | while [ $running_jobs -ge $JOBS_LIMIT ] 76 | do 77 | sleep 1 78 | running_jobs=$(jobs -rp | wc -l) 79 | done 80 | date_echo "Running jobs are now less than $JOBS_LIMIT. Current: $running_jobs" 81 | fi 82 | { 83 | gzip "$file" && { 84 | ((processed++)) 85 | progress_date_echo "Processed $processed/$total files." 86 | } 87 | } & 88 | done 89 | popd > /dev/null || return 90 | wait 91 | echo "" 92 | date_echo "Gzip Completed. Processed $processed/$total files." 93 | -------------------------------------------------------------------------------- /.gitlab/scripts/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LOG_FILE="$PWD/build.log" 4 | 5 | echo "Running build.sh on $(hostname)" | tee -a "$LOG_FILE" 6 | 7 | # shellcheck source=/dev/null 8 | 9 | export site=$(ls -d $CUSTOM_CI_ENV_DIR/$ENV_NAME/lib/python*/site-packages/ 2>>"$LOG_FILE") 10 | 11 | echo "Remove preinstall version of dlio_benchmark" | tee -a "$LOG_FILE" 12 | echo "Command: pip uninstall dlio_benchmark" | tee -a "$LOG_FILE" 13 | set -x 14 | pip uninstall -y dlio_benchmark >>"$LOG_FILE" 2>&1 15 | set +x 16 | if [ $? -ne 0 ]; then 17 | echo "Failed to uninstall dlio_benchmark. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 18 | exit 1 19 | fi 20 | 21 | set -x 22 | rm -rf $site/*dlio_benchmark* >>"$LOG_FILE" 2>&1 23 | set +x 24 | if [ $? -ne 0 ]; then 25 | echo "Failed to remove dlio_benchmark files. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 26 | exit 1 27 | fi 28 | 29 | echo "Installing DLIO benchmark with url git+$DLIO_BENCHMARK_REPO@$DLIO_BENCHMARK_TAG" | tee -a "$LOG_FILE" 30 | echo "Command: pip install --no-cache-dir git+$DLIO_BENCHMARK_REPO@$DLIO_BENCHMARK_TAG" | tee -a "$LOG_FILE" 31 | set -x 32 | pip install --no-cache-dir git+$DLIO_BENCHMARK_REPO@$DLIO_BENCHMARK_TAG >>"$LOG_FILE" 2>&1 33 | set +x 34 | if [ $? -ne 0 ]; then 35 | echo "Failed to install DLIO benchmark. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 36 | exit 1 37 | fi 38 | 39 | echo "Remove preinstall version of dftracer" | tee -a "$LOG_FILE" 40 | echo "Command: pip uninstall pydftracer" | tee -a "$LOG_FILE" 41 | set -x 42 | pip uninstall -y pydftracer >>"$LOG_FILE" 2>&1 43 | set +x 44 | if [ $? -ne 0 ]; then 45 | echo "Failed to uninstall pydftracer. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 46 | exit 1 47 | fi 48 | 49 | set -x 50 | rm -rf $site/*dftracer* >>"$LOG_FILE" 2>&1 51 | set +x 52 | if [ $? -ne 0 ]; then 53 | echo "Failed to remove dftracer files. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 54 | exit 1 55 | fi 56 | 57 | echo "Installing DFTracer" | tee -a "$LOG_FILE" 58 | echo "Command: pip install --no-cache-dir --force-reinstall git+${DFTRACER_REPO}@${CI_COMMIT_REF_NAME}" | tee -a "$LOG_FILE" 59 | set -x 60 | pip install --no-cache-dir --force-reinstall git+${DFTRACER_REPO}@${CI_COMMIT_REF_NAME} >>"$LOG_FILE" 2>&1 61 | set +x 62 | if [ $? -ne 0 ]; then 63 | echo "Failed to install DFTracer. Check the log file: $LOG_FILE" | tee -a "$LOG_FILE" 64 | exit 1 65 | fi 66 | 67 | python -c "import dftracer; import dftracer.python; print(dftracer.__version__);" 68 | export PATH=$site/dftracer/bin:$PATH -------------------------------------------------------------------------------- /src/dftracer/core/finstrument/functions.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #ifdef DFTRACER_FTRACING_ENABLE 3 | #include 4 | std::shared_ptr dftracer::Function::instance = nullptr; 5 | 6 | thread_local std::unordered_map 7 | dftracer::Function::map = std::unordered_map(); 8 | bool dftracer::Function::stop_trace = false; 9 | int dftracer::Function::enter_event(std::string &name) { 10 | if (stop_trace) return -1; 11 | auto start = this->logger->get_time(); 12 | map.insert_or_assign(name, start); 13 | return 0; 14 | } 15 | 16 | int dftracer::Function::exit_event(std::string &name, TimeResolution &start) { 17 | if (stop_trace) return -1; 18 | auto tmap = map.find(name); 19 | if (tmap != map.end()) { 20 | start = tmap->second; 21 | map.erase(name); 22 | return 0; 23 | } 24 | return -1; 25 | } 26 | 27 | void __cyg_profile_func_enter(void *func, void *caller) { 28 | auto function = dftracer::Function::get_instance(); 29 | if (!function->is_active()) return; 30 | Dl_info info; 31 | if (!dladdr(func, &info)) return; 32 | if (!info.dli_fname) return; 33 | std::string event_name; 34 | if (!info.dli_sname) { 35 | char name[256]; 36 | sprintf(name, "%p", func); 37 | event_name = name; 38 | } else { 39 | event_name = info.dli_sname; 40 | } 41 | 42 | DFTRACER_LOG_DEBUG("Calling function %s", event_name); 43 | function->enter_event(event_name); 44 | } 45 | 46 | void __cyg_profile_func_exit(void *func, void *caller) { 47 | auto function = dftracer::Function::get_instance(); 48 | auto end_time = function->logger->get_time(); 49 | if (!function->is_active()) return; 50 | Dl_info info; 51 | if (!dladdr(func, &info)) return; 52 | if (!info.dli_fname) return; 53 | std::string event_name; 54 | if (!info.dli_sname) { 55 | char name[256]; 56 | sprintf(name, "%p", func); 57 | event_name = name; 58 | } else { 59 | event_name = info.dli_sname; 60 | } 61 | TimeResolution start_time; 62 | int status = function->exit_event(event_name, start_time); 63 | if (status == 0) { 64 | dftracer::Metadata *metadata; 65 | if (function->logger->include_metadata) { 66 | metadata = new dftracer::Metadata(); 67 | const char *so = info.dli_fname; 68 | metadata->insert_or_assign("so", so); 69 | } 70 | function->logger->enter_event(); 71 | function->logger->log(event_name.c_str(), CATEGORY, start_time, 72 | end_time - start_time, metadata); 73 | function->logger->exit_event(); 74 | } 75 | } 76 | #endif -------------------------------------------------------------------------------- /.github/workflows/python-publish.yml: -------------------------------------------------------------------------------- 1 | # This workflow will upload a Python Package using Twine when a release is created 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries 3 | 4 | # This workflow uses actions that are not certified by GitHub. 5 | # They are provided by a third-party and are governed by 6 | # separate terms of service, privacy policy, and support 7 | # documentation. 8 | 9 | name: Upload Python Package 10 | 11 | on: 12 | release: 13 | types: [published] 14 | permissions: 15 | contents: read 16 | 17 | jobs: 18 | deploy: 19 | strategy: 20 | fail-fast: false 21 | matrix: 22 | python: ["3.9", "3.10", "3.11", "3.12"] 23 | os: [ubuntu-22.04, ubuntu-24.04] 24 | name: ${{ matrix.python }}-${{ matrix.os }} 25 | runs-on: ${{ matrix.os }} 26 | 27 | steps: 28 | - uses: actions/checkout@v3 29 | - name: Set up Python 30 | uses: actions/setup-python@v3 31 | with: 32 | python-version: ${{ matrix.python }} 33 | - name: Install dependencies 34 | run: | 35 | sudo apt-get update 36 | sudo apt-get install -y gcc g++ libtool-bin openmpi-bin libopenmpi-dev 37 | python -m pip install --upgrade pip 38 | pip install build wheel auditwheel pybind11 patchelf setuptools>=64 setuptools-scm>=8 39 | - name: Build wheel package 40 | run: | 41 | export DFTRACER_WHEEL=1 42 | python setup.py bdist_wheel 43 | python setup.py sdist 44 | gotcha_so=$(find . -name libgotcha.so.2) 45 | path=`dirname $gotcha_so` 46 | path=`dirname $path` 47 | echo $path 48 | export LD_LIBRARY_PATH=$PWD/$path/lib:$PWD/$path/lib64:$LD_LIBRARY_PATH 49 | echo $LD_LIBRARY_PATH 50 | auditwheel show dist/*.whl 51 | platform=$(auditwheel show dist/*.whl | grep manylinux_ | awk -F'"' '{print $2}') 52 | auditwheel show dist/*.whl | grep manylinux_ 53 | echo "Platform selected is $platform" 54 | auditwheel repair --plat $platform dist/*.whl -w dist/ 55 | rm dist/*linux_x86_64.whl 56 | rm dist/*.tar.gz 57 | - name: Build source package 58 | if: matrix.os == 'ubuntu-24.04' && matrix.python == '3.12' 59 | run: | 60 | export DFTRACER_WHEEL=1 61 | python setup.py sdist 62 | - name: Publish package 63 | uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 64 | with: 65 | user: __token__ 66 | password: ${{ secrets.PYPI_TOKEN }} 67 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | workflow: 2 | rules: 3 | - if: $CI_PIPELINE_SOURCE == "web" 4 | when: always 5 | - when: never 6 | 7 | variables: 8 | GIT_SUBMODULE_STRATEGY: recursive 9 | CUSTOM_CI_BUILDS_DIR: "/usr/workspace/iopp/gitlab-runner-builds" 10 | CUSTOM_CI_ENV_DIR: "/usr/workspace/iopp/gitlab-runner-envs" 11 | # Repository information 12 | DLIO_BENCHMARK_REPO: https://github.com/rayandrew/dlio_benchmark.git 13 | DLIO_BENCHMARK_TAG: feat/ai-logging 14 | DFTRACER_REPO: https://github.com/LLNL/dftracer.git 15 | # test variable 16 | ENV_NAME: dlio_env_2 17 | # test variables 18 | MIN_NODES: 1 19 | MAX_NODES: 8 20 | EXCLUSION_LIST: llama_70b_zero3-0;llama_70b-4 21 | 22 | stages: 23 | - build 24 | - generate 25 | - test 26 | 27 | dft_tuo_build: 28 | extends: .tuo 29 | stage: build 30 | script: 31 | - source .gitlab/scripts/variables.sh 32 | - source .gitlab/scripts/pre.sh 33 | - if [[ "$DEBUG" != "1" ]]; then source .gitlab/scripts/build_dft.sh; else echo "Not building from scratch as running in Debug mode."; fi 34 | 35 | dft_tuo_test: 36 | extends: .tuo 37 | stage: test 38 | script: 39 | - source .gitlab/scripts/variables.sh 40 | - source .gitlab/scripts/pre.sh 41 | - bash .gitlab/scripts/run_dft_hip_test.sh 42 | 43 | dlio_corona_build: 44 | extends: .corona 45 | stage: build 46 | script: 47 | - source .gitlab/scripts/variables.sh 48 | - source .gitlab/scripts/pre.sh 49 | - if [[ "$DEBUG" != "1" ]]; then source .gitlab/scripts/build.sh; else echo "Not building from scratch as running in Debug mode."; fi 50 | 51 | dlio_corona_generate: 52 | extends: .corona 53 | stage: generate 54 | script: 55 | - source .gitlab/scripts/variables.sh 56 | - source .gitlab/scripts/pre.sh 57 | - if [ -f .gitlab/scripts/run_dlio_workload_test_ci.yaml ]; then rm .gitlab/scripts/run_dlio_workload_test_ci.yaml; fi 58 | - python .gitlab/scripts/generate_dlio_job.py --output .gitlab/scripts/run_dlio_workload_test_ci.yaml --log-level INFO 59 | - if [ ! -f .gitlab/scripts/run_dlio_workload_test_ci.yaml ]; then echo 'File not generated!'; exit 1; fi 60 | - cat .gitlab/scripts/run_dlio_workload_test_ci.yaml 61 | artifacts: 62 | paths: 63 | - .gitlab/scripts/run_dlio_workload_test_ci.yaml 64 | 65 | dlio_corona_test: 66 | stage: test 67 | trigger: 68 | include: 69 | - artifact: .gitlab/scripts/run_dlio_workload_test_ci.yaml 70 | job: dlio_corona_generate 71 | strategy: depend 72 | forward: 73 | pipeline_variables: true 74 | 75 | include: 76 | - project: 'lc-templates/id_tokens' 77 | file: 'id_tokens.yml' 78 | - local: '.gitlab/scripts/common.yml' -------------------------------------------------------------------------------- /src/dftracer/core/buffer/buffer.h: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_BUFFER_H 2 | #define DFTRACER_BUFFER_H 3 | #include 4 | #include 5 | // 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | namespace dftracer { 20 | class BufferManager { 21 | public: 22 | BufferManager() 23 | : buffer(nullptr), buffer_pos(0), mtx(), app_name(), rank(-1) {} 24 | ~BufferManager() {} 25 | 26 | void inline set_app_name(const char* name) { app_name = name; } 27 | 28 | inline const char* get_app_name() const { 29 | return app_name.empty() ? nullptr : app_name.c_str(); 30 | } 31 | 32 | void inline set_rank(const int& r) { rank = r; } 33 | 34 | int initialize(const char* filename, HashType hostname_hash); 35 | 36 | int finalize(int index, ProcessID process_id, bool end_sym = false); 37 | 38 | void log_data_event(int index, ConstEventNameType event_name, 39 | ConstEventNameType category, TimeResolution start_time, 40 | TimeResolution duration, dftracer::Metadata* metadata, 41 | ProcessID process_id, ThreadID tid); 42 | 43 | void log_metadata_event(ConstEventNameType name, ConstEventNameType value, 44 | ConstEventNameType ph, ProcessID process_id, 45 | ThreadID tid, bool is_string = true); 46 | 47 | void log_counter_event(int index, ConstEventNameType name, 48 | ConstEventNameType category, TimeResolution start_time, 49 | ProcessID process_id, ThreadID thread_id, 50 | dftracer::Metadata* metadata); 51 | 52 | private: 53 | void compress_and_write_if_needed(size_t size, bool force = false); 54 | char* buffer; 55 | size_t buffer_pos; 56 | std::shared_mutex mtx; 57 | std::string app_name; 58 | int rank; 59 | 60 | std::shared_ptr config; 61 | std::shared_ptr serializer; 62 | std::shared_ptr compressor; 63 | std::shared_ptr writer; 64 | std::shared_ptr aggregator; 65 | }; 66 | } // namespace dftracer 67 | #endif // DFTRACER_BUFFER_H -------------------------------------------------------------------------------- /src/dftracer/core/writer/stdio_writer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | namespace dftracer { 10 | class STDIOWriter { 11 | public: 12 | STDIOWriter() : max_size_(0), fh_(nullptr) {} 13 | void initialize(const char* filename) { 14 | this->filename = filename; 15 | auto conf = 16 | dftracer::Singleton::get_instance(); 17 | max_size_ = conf->write_buffer_size; 18 | fh_ = fopen(filename, "ab+"); 19 | if (fh_ == nullptr) { 20 | DFTRACER_LOG_ERROR("unable to create log file %s: errno=%d (%s)", 21 | filename, errno, strerror(errno)); // GCOVR_EXCL_LINE 22 | } else { 23 | setvbuf(fh_, NULL, _IOLBF, max_size_ + 16 * 1024); 24 | DFTRACER_LOG_INFO("created log file %s", filename); 25 | } 26 | } 27 | 28 | void initialize() {} 29 | 30 | ~STDIOWriter() {} 31 | void finalize(int index) { 32 | if (fh_ != nullptr) { 33 | DFTRACER_LOG_INFO("Finalizing STDIOWriter", ""); 34 | fflush(fh_); 35 | long file_size = 0; 36 | if (fh_ != nullptr) { 37 | fseek(fh_, 0, SEEK_END); 38 | file_size = ftell(fh_); 39 | fseek(fh_, 0, SEEK_SET); 40 | } 41 | int status = fclose(fh_); 42 | if ((index < 5 || file_size == 0) && filename != nullptr) { 43 | unlink(filename); 44 | } 45 | if (status != 0) { 46 | DFTRACER_LOG_ERROR("unable to close log file %s", 47 | this->filename); // GCOVR_EXCL_LINE 48 | } 49 | fh_ = nullptr; 50 | } 51 | } 52 | 53 | // Write data to buffer, flush if necessary 54 | size_t write(const char* data, size_t len, bool force = false) { 55 | if (fh_ != nullptr && (force || len >= max_size_)) { 56 | // Use stdio file locking (flockfile/funlockfile) for FILE* 57 | // needed for fork and spawn cases to maintain consistency 58 | // Note this may not work with nfs and should typically either create a 59 | // new file per fork or use a local filesystem which supports flockfile. 60 | flockfile(fh_); 61 | auto written = std::fwrite(data, 1, len, fh_); 62 | funlockfile(fh_); 63 | if (written != len) { 64 | DFTRACER_LOG_ERROR("unable to write log file %s", 65 | this->filename); // GCOVR_EXCL_LINE 66 | } 67 | } 68 | return len; 69 | } 70 | 71 | private: 72 | const char* filename; 73 | size_t max_size_; 74 | FILE* fh_; 75 | }; 76 | } // namespace dftracer -------------------------------------------------------------------------------- /cmake/configure_files/dftracer_config.hpp.in: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_CONFIG_HPP 2 | #define DFTRACER_CONFIG_HPP 3 | // clang-format off 4 | /* Version string for DFTRACER */ 5 | #define DFTRACER_PACKAGE_VERSION "@DFTRACER_PACKAGE_VERSION@" 6 | #cmakedefine DFTRACER_GIT_VERSION "@DFTRACER_GIT_VERSION@" 7 | #define DFTRACER_GET_VERSION(MAJOR, MINOR, PATCH) (MAJOR * 100000 + MINOR * 100 + PATCH) 8 | #define DFTRACER_VERSION (DFTRACER_GET_VERSION @DFTRACER_PACKAGE_VERSION_FULL@) 9 | #define DFTRACER_VERSION_MAJOR (DFTRACER_VERSION / 100000) 10 | #define DFTRACER_VERSION_MINOR ((DFTRACER_VERSION / 100) % 1000) 11 | #define DFTRACER_VERSION_PATCH (DFTRACER_VERSION % 100) 12 | 13 | /* Compiler used */ 14 | #cmakedefine DFTRACER_CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" 15 | 16 | #cmakedefine DFTRACER_CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" 17 | #cmakedefine DFTRACER_CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" 18 | #cmakedefine DFTRACER_CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" 19 | #cmakedefine DFTRACER_CMAKE_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" 20 | #cmakedefine DFTRACER_CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS@_RELEASE" 21 | 22 | #cmakedefine DFTRACER_CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" 23 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" 24 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" 25 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" 26 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" 27 | 28 | #cmakedefine DFTRACER_CMAKE_C_SHARED_LIBRARY_FLAGS "@CMAKE_C_SHARED_LIBRARY_FLAGS@" 29 | #cmakedefine DFTRACER_CMAKE_CXX_SHARED_LIBRARY_FLAGS "@CMAKE_CXX_SHARED_LIBRARY_FLAGS@" 30 | 31 | /* Macro flags */ 32 | #cmakedefine DFTRACER_GNU_LINUX 1 33 | #cmakedefine DFTRACER_MPI_ENABLE 1 34 | #cmakedefine DFTRACER_FTRACING_ENABLE 1 35 | #cmakedefine DFTRACER_HWLOC_ENABLE 1 36 | #cmakedefine DFTRACER_HIP_TRACING_ENABLE 1 37 | 38 | //========================== 39 | // Common macro definitions 40 | //========================== 41 | 42 | #define DFTRACER_PATH_DELIM "/" 43 | 44 | // #define DFTRACER_NOOP_MACRO do {} while (0) 45 | #define DFTRACER_NOOP_MACRO 46 | 47 | // Detect VAR_OPT 48 | // https://stackoverflow.com/questions/48045470/portably-detect-va-opt-support 49 | #if __cplusplus <= 201703 && defined __GNUC__ && !defined __clang__ && \ 50 | !defined __EDG__ 51 | #define VA_OPT_SUPPORTED false 52 | #else 53 | #define PP_THIRD_ARG(a, b, c, ...) c 54 | #define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(, ), true, false, ) 55 | #define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?) 56 | #endif 57 | 58 | #if !defined(DFTRACER_HASH_SEED) || (DFTRACER_HASH_SEED <= 0) 59 | #define DFTRACER_SEED 104723u 60 | #endif 61 | // clang-format on 62 | #endif /* DFTRACER_CONFIG_H */ -------------------------------------------------------------------------------- /src/dftracer/service/common/datastructure.h: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_SERVER_COMMON_DATASTRUCTURE 2 | #define DFTRACER_SERVER_COMMON_DATASTRUCTURE 3 | namespace dftracer { 4 | struct CpuMetrics { 5 | unsigned long long user = 0; 6 | unsigned long long nice = 0; 7 | unsigned long long system = 0; 8 | unsigned long long idle = 0; 9 | unsigned long long iowait = 0; 10 | unsigned long long irq = 0; 11 | unsigned long long softirq = 0; 12 | unsigned long long steal = 0; 13 | unsigned long long guest = 0; 14 | unsigned long long guest_nice = 0; 15 | }; 16 | 17 | struct MemMetrics { 18 | // Explicitly declare all required metrics as members 19 | unsigned long long MemAvailable = 0; 20 | unsigned long long Buffers = 0; 21 | unsigned long long Cached = 0; 22 | unsigned long long SwapCached = 0; 23 | unsigned long long Active = 0; 24 | unsigned long long Inactive = 0; 25 | unsigned long long Active_anon = 0; 26 | unsigned long long Inactive_anon = 0; 27 | unsigned long long Active_file = 0; 28 | unsigned long long Inactive_file = 0; 29 | unsigned long long Unevictable = 0; 30 | unsigned long long Mlocked = 0; 31 | unsigned long long SwapTotal = 0; 32 | unsigned long long SwapFree = 0; 33 | unsigned long long Dirty = 0; 34 | unsigned long long Writeback = 0; 35 | unsigned long long AnonPages = 0; 36 | unsigned long long Mapped = 0; 37 | unsigned long long Shmem = 0; 38 | unsigned long long KReclaimable = 0; 39 | unsigned long long Slab = 0; 40 | unsigned long long SReclaimable = 0; 41 | unsigned long long SUnreclaim = 0; 42 | unsigned long long KernelStack = 0; 43 | unsigned long long PageTables = 0; 44 | unsigned long long NFS_Unstable = 0; 45 | unsigned long long Bounce = 0; 46 | unsigned long long WritebackTmp = 0; 47 | unsigned long long CommitLimit = 0; 48 | unsigned long long Committed_AS = 0; 49 | unsigned long long VmallocTotal = 0; 50 | unsigned long long VmallocUsed = 0; 51 | unsigned long long VmallocChunk = 0; 52 | unsigned long long Percpu = 0; 53 | unsigned long long HardwareCorrupted = 0; 54 | unsigned long long AnonHugePages = 0; 55 | unsigned long long ShmemHugePages = 0; 56 | unsigned long long ShmemPmdMapped = 0; 57 | unsigned long long FileHugePages = 0; 58 | unsigned long long FilePmdMapped = 0; 59 | unsigned long long HugePages_Total = 0; 60 | unsigned long long HugePages_Free = 0; 61 | unsigned long long HugePages_Rsvd = 0; 62 | unsigned long long HugePages_Surp = 0; 63 | unsigned long long Hugepagesize = 0; 64 | unsigned long long Hugetlb = 0; 65 | unsigned long long DirectMap4k = 0; 66 | unsigned long long DirectMap2M = 0; 67 | unsigned long long DirectMap1G = 0; 68 | }; 69 | } // namespace dftracer 70 | #endif // DFTRACER_SERVER_COMMON_DATASTRUCTURE -------------------------------------------------------------------------------- /docs/models.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | Model tracing 3 | ====================== 4 | 5 | DFTracer can trace the execution of PyTorch models, providing insights into the model's performance and behavior during training. 6 | 7 | 8 | ------------------------- 9 | DFTracer Python APIs 10 | ------------------------- 11 | 12 | This section describes how to use DFTracer for profiling pytorch applications. 13 | 14 | ----- 15 | 16 | Installing DFTracer with model tracing 17 | **************************************** 18 | 19 | Install DFTracer with model tracing 20 | 21 | .. code-block:: bash 22 | pip install dftracer[dynamo] 23 | 24 | Function decorator style profiling 25 | **************************************** 26 | 27 | With python applications, after initializing the dftracer module developers can use decorator provided within dftracer.dynamo to tag functions that need to be profiled. 28 | To use the function decorators, they can be initialized in place or globally to reuse within many functions. 29 | 30 | .. code-block:: python 31 | 32 | dftracer.dynamo import dft_fn as dyn_fn 33 | from dftracer.python import dftracer 34 | 35 | log_inst = dftracer.initialize_log(logfile=None, data_dir=None, process_id=-1) 36 | 37 | dyn = dyn_fn("dynamo") 38 | 39 | class SimpleModel(torch.nn.Module): 40 | def __init__(self): 41 | super(SimpleModel, self).__init__() 42 | self.conv = torch.nn.Conv2d(3, 16, 3, 1) 43 | self.fc = torch.nn.Linear(16 * 15 * 15, 10) 44 | 45 | @dyn.compile 46 | def forward(self, x): 47 | x = self.conv(x) 48 | x = torch.nn.functional.relu(x) 49 | x = torch.nn.functional.max_pool2d(x, 2) 50 | x = x.view(x.size(0), -1) 51 | x = self.fc(x) 52 | return x 53 | 54 | 55 | Model profiling 56 | **************************************** 57 | 58 | .. code-block:: python 59 | from dftracer.dynamo import dft_fn as dyn_fn 60 | from dftracer.python import dftracer 61 | log_inst = dftracer.initialize_log(logfile=None, data_dir=None, process_id=-1) 62 | dyn = dyn_fn("dynamo") 63 | 64 | class SimpleModel(torch.nn.Module): 65 | def __init__(self): 66 | super(SimpleModel, self).__init__() 67 | self.conv = torch.nn.Conv2d(3, 16, 3, 1) 68 | self.fc = torch.nn.Linear(16 * 15 * 15, 10) 69 | 70 | def forward(self, x): 71 | x = self.conv(x) 72 | x = torch.nn.functional.relu(x) 73 | x = torch.nn.functional.max_pool2d(x, 2) 74 | x = x.view(x.size(0), -1) 75 | x = self.fc(x) 76 | return x 77 | 78 | 79 | model = SimpleModel() 80 | model = dyn(model) 81 | 82 | .. _`PyTorch Dynamo`: https://docs.pytorch.org/docs/stable/torch.compiler_dynamo_overview.html 83 | -------------------------------------------------------------------------------- /test/paper/load_recorder.py: -------------------------------------------------------------------------------- 1 | from glob import glob 2 | import pandas as pd 3 | print(f"pd {pd.__version__}") 4 | <<<<<<< HEAD 5 | ======= 6 | 7 | >>>>>>> d419e7e (Paper/ad ae (#100)) 8 | import dask 9 | import dask.dataframe as dd 10 | from dask.distributed import Client, LocalCluster, progress, wait 11 | print(f"dask {dask.__version__}") 12 | import pyarrow as pa 13 | print(f"pa {pa.__version__}") 14 | 15 | import logging 16 | from glob import glob 17 | import argparse 18 | import time 19 | 20 | import recorder_viz 21 | from recorder_viz import RecorderReader 22 | 23 | logging.basicConfig(filename='darshan_main.log', encoding='utf-8', level=logging.DEBUG) 24 | 25 | 26 | def get_json(func, ts, dur, rank): 27 | d = {} 28 | #print(location, start) 29 | d["name"] = func 30 | d["cat"] = "Recorder" 31 | d["ts"] = int(ts) 32 | d["dur"] = int(dur) 33 | d["pid"] = rank 34 | d["tid"] = 0 35 | #print(d) 36 | return d 37 | 38 | 39 | def read_trace(trace_name): 40 | map_events = {} 41 | count = 0 42 | reader = RecorderReader(trace_name) 43 | func_list = reader.funcs 44 | for rank, records in enumerate(reader.records): 45 | lm = reader.LMs[rank] 46 | for record in records: 47 | if len(func_list) > record.func_id: 48 | func_name = func_list[record.func_id] 49 | if record.func_id > 0 and "MPI" not in func_name: 50 | yield get_json(func_name, 0, 10, rank) 51 | 52 | parser = argparse.ArgumentParser( 53 | description="Time functions and print time spent in each function", 54 | formatter_class=argparse.RawDescriptionHelpFormatter, 55 | ) 56 | parser.add_argument("trace_file", help="Trace file to load", type=str) 57 | <<<<<<< HEAD 58 | ======= 59 | 60 | >>>>>>> d419e7e (Paper/ad ae (#100)) 61 | parser.add_argument("--workers", help="Number of workers", type=int, default=1) 62 | args = parser.parse_args() 63 | filename = args.trace_file 64 | 65 | cluster = LocalCluster(n_workers=args.workers) # Launches a scheduler and workers locally 66 | client = Client(cluster) # Connect to distributed cluster and override default 67 | 68 | file_pattern = glob(filename) 69 | 70 | all_records = [] 71 | start = time.time() 72 | 73 | create_bag = dask.bag.from_delayed([dask.delayed(read_trace)(file) 74 | for file in file_pattern]) 75 | columns = {'name':"string", 'cat': "string", 76 | 'pid': "string",'tid': "string", 77 | 'dur': "uint64", 'ts': "uint64"} 78 | events = create_bag.to_dataframe(meta=columns) 79 | #events.head() 80 | n_partition = 1 81 | events = events.repartition(npartitions=n_partition).persist() 82 | progress(events) 83 | _ = wait(events) 84 | 85 | end = time.time() 86 | print(f"Loading Recorder trace took {end-start} seconds.") -------------------------------------------------------------------------------- /.gitlab/scripts/pre.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Enable debugging to echo commands being run 4 | set -x 5 | 6 | # Print the hostname where the script is being executed 7 | echo "Running pre.sh on $(hostname) by $USER on $PWD" 8 | 9 | # Load the required modules for Python, MPI, and GCC 10 | echo "Loading modules: Python ($PYTHON_MODULE), MPI ($MPI_MODULE), and GCC ($GCC_MODULE) and ROCM ($ROCM_MODULE)" 11 | module load $PYTHON_MODULE $MPI_MODULE $GCC_MODULE $ROCM_MODULE 12 | if [ $? -ne 0 ]; then 13 | echo "Error: Failed to load modules." 14 | exit 1 15 | fi 16 | 17 | # Check the values of the loaded modules 18 | echo "PYTHON_MODULE: $PYTHON_MODULE" 19 | echo "MPI_MODULE: $MPI_MODULE" 20 | echo "GCC_MODULE: $GCC_MODULE" 21 | 22 | # Check the values of the environment variables 23 | echo "CUSTOM_CI_ENV_DIR: $CUSTOM_CI_ENV_DIR" 24 | echo "ENV_NAME: $ENV_NAME" 25 | 26 | # Create a new Python virtual environment (if not exist) in the specified directory 27 | if [[ ! -d $CUSTOM_CI_ENV_DIR/$ENV_NAME ]]; then 28 | echo "Creating a new Python virtual environment at $CUSTOM_CI_ENV_DIR/$ENV_NAME" 29 | python -m venv $CUSTOM_CI_ENV_DIR/$ENV_NAME 30 | if [ $? -ne 0 ]; then 31 | echo "Error: Failed to create Python virtual environment." 32 | exit 1 33 | fi 34 | fi 35 | 36 | # Activating environment 37 | echo "Activating env at $CUSTOM_CI_ENV_DIR/$ENV_NAME" 38 | . $CUSTOM_CI_ENV_DIR/$ENV_NAME/bin/activate 39 | if [ $? -ne 0 ]; then 40 | echo "Error: Failed to activate Python virtual environment." 41 | exit 1 42 | fi 43 | 44 | # Upgrade pip 45 | pip install --upgrade pip 46 | if [ $? -ne 0 ]; then 47 | echo "Error: Failed to upgrade pip." 48 | exit 1 49 | fi 50 | 51 | 52 | echo "Defining scheduler function..." 53 | scheduler() { 54 | hostname=$(hostname) 55 | case $hostname in 56 | *"corona"*) 57 | echo "Setting SCHEDULER_CMD for hostname containing 'corona'..." 58 | SCHEDULER_CMD=(flux submit -N $1 --tasks-per-node=$2 -q $QUEUE -t $WALLTIME --exclusive) 59 | ;; 60 | *"tuo"*) 61 | echo "Setting SCHEDULER_CMD for hostname containing 'tuo'..." 62 | SCHEDULER_CMD=(flux submit -N $1 --ntasks-per-node=$2 -p $QUEUE -t $WALLTIME --exclusive) 63 | ;; 64 | *) 65 | echo "Unknown hostname: $hostname" 66 | exit 1 67 | ;; 68 | esac 69 | } 70 | 71 | # Check if torch isn't installed 72 | if ! python -c "import torch" &> /dev/null; then 73 | echo "Torch is not installed. Installing..." 74 | echo "Python source" 75 | which python 76 | pip install -r .gitlab/scripts/hip_requirements.txt 77 | fi 78 | 79 | export LD_LIBRARY_PATH=$CUSTOM_CI_ENV_DIR/$ENV_NAME/lib/python3.11/site-packages/torch/lib:$LD_LIBRARY_PATH 80 | 81 | # Disable debugging 82 | set +x -------------------------------------------------------------------------------- /src/dftracer/core/common/dftracer_main.h: -------------------------------------------------------------------------------- 1 | // 2 | // Created by haridev on 10/5/23. 3 | // 4 | 5 | #ifndef DFTRACER_DFTRACER_MAIN_H 6 | #define DFTRACER_DFTRACER_MAIN_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace dftracer { 30 | class DFTracerCore { 31 | private: 32 | std::string log_file; 33 | std::string data_dirs; 34 | std::shared_ptr conf; 35 | ProcessID process_id; 36 | bool is_initialized; 37 | bool bind; 38 | std::string log_file_suffix; 39 | std::shared_ptr logger; 40 | void initialize(bool _bind, const char *_log_file = nullptr, 41 | const char *_data_dirs = nullptr, 42 | const int *_process_id = nullptr); 43 | 44 | public: 45 | bool include_metadata; 46 | DFTracerCore(ProfilerStage stage, ProfileType type, 47 | const char *log_file = nullptr, const char *data_dirs = nullptr, 48 | const int *process_id = nullptr); 49 | 50 | void reinitialize(); 51 | inline bool is_active() { 52 | DFTRACER_LOG_DEBUG("DFTracerCore.is_active", ""); 53 | return conf->enable; 54 | } 55 | 56 | TimeResolution get_time(); 57 | 58 | void log(ConstEventNameType event_name, ConstEventNameType category, 59 | TimeResolution start_time, TimeResolution duration, 60 | dftracer::Metadata *metadata); 61 | 62 | void log_metadata(ConstEventNameType key, ConstEventNameType value); 63 | 64 | inline int enter_event() { return logger->enter_event(); } 65 | 66 | inline void exit_event() { logger->exit_event(); } 67 | 68 | bool finalize(); 69 | 70 | void initialize() {} 71 | ~DFTracerCore() { DFTRACER_LOG_DEBUG("Destructing DFTracerCore", ""); } 72 | }; 73 | } // namespace dftracer 74 | 75 | #define DFTRACER_MAIN_SINGLETON_INIT(stage, type, ...) \ 76 | dftracer::Singleton::get_instance(stage, type, \ 77 | __VA_ARGS__) 78 | 79 | #define DFTRACER_MAIN_SINGLETON(stage, type) \ 80 | dftracer::Singleton::get_instance(stage, type) 81 | #endif // DFTRACER_DFTRACER_MAIN_H 82 | -------------------------------------------------------------------------------- /test/py/python_test.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import argparse 3 | import os 4 | import time 5 | import numpy as np 6 | from PIL import Image 7 | import h5py 8 | from dftracer.python import dftracer, dft_fn as Profile 9 | parser = argparse.ArgumentParser( 10 | prog='DFTracer testing', 11 | description='What the program does', 12 | epilog='Text at the bottom of help') 13 | parser.add_argument('--log_dir', default="./pfw_logs", type=str, help="The log directory to save to the tracing") 14 | parser.add_argument("--data_dir", default="./data", type=str, help="The directory to save and load data") 15 | parser.add_argument("--format", default="npz", type=str, help="format of the file") 16 | parser.add_argument("--num_files", default=1, type=int, help="Number of files") 17 | parser.add_argument("--niter", default=1, type=int, help="Number of iterations for the experiment") 18 | parser.add_argument("--record_size", default=1048576, type=int, help="size of the record to be written to the file") 19 | args = parser.parse_args() 20 | os.makedirs(f"{args.log_dir}/{args.format}", exist_ok=True) 21 | os.makedirs(f"{args.data_dir}/{args.format}", exist_ok=True) 22 | df = Profile("dft") 23 | @df.log 24 | def data_gen(data): 25 | for i in df.iter(range(args.num_files)): 26 | io.write(f"{args.data_dir}/{args.format}/{i}-of-{args.num_files}.{args.format}", data) 27 | 28 | @df.log 29 | def read_data(epoch): 30 | for i in df.iter(range(args.num_files)): 31 | d = io.read(f"{args.data_dir}/{args.format}/{i}-of-{args.num_files}.{args.format}") 32 | class IOHandler: 33 | def __init__(self, format): 34 | self.format = format 35 | def read(self, filename): 36 | if self.format== "jpeg" or self.format== "png": 37 | return np.asarray(Image.open(filename)) 38 | if self.format== "npz": 39 | return np.load(filename) 40 | if self.format== "hdf5": 41 | fd = h5py.File(filename, 'r') 42 | x = fd['x'][:] 43 | fd.close() 44 | def write(self, filename, a): 45 | if self.format== "jpeg" or self.format== "png": 46 | im = Image.fromarray(a) 47 | #im.show() 48 | im.save(filename) 49 | if self.format== "npz": 50 | with open(filename, 'wb') as f: 51 | np.save(f, a) 52 | if self.format== "hdf5": 53 | fd = h5py.File(filename, 'w') 54 | fd.create_dataset("x", data=a) 55 | fd.close() 56 | if __name__ == "__main__": 57 | io = IOHandler(args.format) 58 | # Writing data 59 | data = np.ones((args.record_size, 1), dtype=np.uint8) 60 | df_logger = dftracer.initialize_log(f"{args.log_dir}_{args.format}.pfw", None, -1) 61 | data_gen(data) 62 | for n in range(args.niter): 63 | read_data(n) 64 | df_logger.finalize() 65 | 66 | -------------------------------------------------------------------------------- /.github/workflows/docker-publish.yml: -------------------------------------------------------------------------------- 1 | name: Build and Push Docker Image 2 | 3 | on: 4 | push: 5 | tags: 6 | - "v*" # Trigger on version tags like v1.0.0, v2.1.3, etc. 7 | workflow_dispatch: # Allow manual triggering 8 | inputs: 9 | tag: 10 | description: "Docker image tag (leave empty for commit SHA)" 11 | required: false 12 | default: "" 13 | 14 | env: 15 | REGISTRY: docker.io 16 | IMAGE_NAME: dftracer/dftracer 17 | 18 | jobs: 19 | build-and-push: 20 | runs-on: ubuntu-latest 21 | permissions: 22 | contents: read 23 | packages: write 24 | 25 | steps: 26 | - name: Checkout repository 27 | uses: actions/checkout@v4 28 | with: 29 | submodules: recursive 30 | 31 | - name: Set up QEMU 32 | uses: docker/setup-qemu-action@v3 33 | 34 | - name: Set up Docker Buildx 35 | uses: docker/setup-buildx-action@v3 36 | 37 | - name: Log in to Docker Hub 38 | uses: docker/login-action@v3 39 | with: 40 | username: ${{ secrets.DOCKER_USERNAME }} 41 | password: ${{ secrets.DOCKER_PASSWORD }} 42 | 43 | - name: Extract metadata (tags, labels) 44 | id: meta 45 | uses: docker/metadata-action@v5 46 | with: 47 | images: ${{ env.IMAGE_NAME }} 48 | tags: | 49 | type=ref,event=branch 50 | type=ref,event=pr 51 | type=semver,pattern={{version}} 52 | type=semver,pattern={{major}}.{{minor}} 53 | type=semver,pattern={{major}} 54 | type=sha,prefix={{branch}}- 55 | type=raw,value=latest,enable={{is_default_branch}} 56 | 57 | - name: Determine version tag 58 | id: version 59 | run: | 60 | if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ github.event.inputs.tag }}" ]; then 61 | echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT 62 | elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then 63 | echo "tag=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT 64 | else 65 | echo "tag=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_OUTPUT 66 | fi 67 | 68 | - name: Build and push Docker image 69 | uses: docker/build-push-action@v5 70 | with: 71 | context: . 72 | file: ./infrastructure/docker/Dockerfile.prod 73 | platforms: linux/amd64,linux/arm64 74 | push: true 75 | tags: ${{ steps.meta.outputs.tags }} 76 | labels: ${{ steps.meta.outputs.labels }} 77 | cache-from: type=gha 78 | cache-to: type=gha,mode=max 79 | build-args: | 80 | DFTRACER_VERSION=${{ steps.version.outputs.tag }} 81 | 82 | - name: Image digest 83 | run: echo "Image pushed with digest ${{ steps.build-and-push.outputs.digest }}" 84 | -------------------------------------------------------------------------------- /cmake/configure_files/dftracer_config_dbg.hpp.in: -------------------------------------------------------------------------------- 1 | #ifndef DFTRACER_CONFIG_HPP 2 | #define DFTRACER_CONFIG_HPP 3 | // clang-format off 4 | /* Version string for DFTRACER */ 5 | #define DFTRACER_PACKAGE_VERSION "@DFTRACER_PACKAGE_VERSION@" 6 | #cmakedefine DFTRACER_GIT_VERSION "@DFTRACER_GIT_VERSION@" 7 | #define DFTRACER_GET_VERSION(MAJOR, MINOR, PATCH) (MAJOR * 100000 + MINOR * 100 + PATCH) 8 | #define DFTRACER_VERSION (DFTRACER_GET_VERSION @DFTRACER_VERSION@) 9 | #define DFTRACER_VERSION_MAJOR (DFTRACER_VERSION / 100000) 10 | #define DFTRACER_VERSION_MINOR ((DFTRACER_VERSION / 100) % 1000) 11 | #define DFTRACER_VERSION_PATCH (DFTRACER_VERSION % 100) 12 | 13 | /* Compiler used */ 14 | #cmakedefine DFTRACER_CMAKE_BUILD_TYPE "@CMAKE_BUILD_TYPE@" 15 | 16 | #cmakedefine DFTRACER_CMAKE_C_COMPILER "@CMAKE_C_COMPILER@" 17 | #cmakedefine DFTRACER_CMAKE_C_FLAGS "@CMAKE_C_FLAGS@" 18 | #cmakedefine DFTRACER_CMAKE_C_FLAGS_DEBUG "@CMAKE_C_FLAGS_DEBUG@" 19 | #cmakedefine DFTRACER_CMAKE_C_FLAGS_RELWITHDEBINFO "@CMAKE_C_FLAGS_RELWITHDEBINFO@" 20 | #cmakedefine DFTRACER_CMAKE_C_FLAGS_RELEASE "@CMAKE_C_FLAGS@_RELEASE" 21 | 22 | #cmakedefine DFTRACER_CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@" 23 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS "@CMAKE_CXX_FLAGS@" 24 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS_DEBUG "@CMAKE_CXX_FLAGS_DEBUG@" 25 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS_RELWITHDEBINFO "@CMAKE_CXX_FLAGS_RELWITHDEBINFO@" 26 | #cmakedefine DFTRACER_CMAKE_CXX_FLAGS_RELEASE "@CMAKE_CXX_FLAGS_RELEASE@" 27 | 28 | #cmakedefine DFTRACER_CMAKE_C_SHARED_LIBRARY_FLAGS "@CMAKE_C_SHARED_LIBRARY_FLAGS@" 29 | #cmakedefine DFTRACER_CMAKE_CXX_SHARED_LIBRARY_FLAGS "@CMAKE_CXX_SHARED_LIBRARY_FLAGS@" 30 | 31 | /* Macro flags */ 32 | #cmakedefine DFTRACER_GNU_LINUX 1 33 | #cmakedefine DFTRACER_MPI_ENABLE 1 34 | #cmakedefine DFTRACER_FTRACING_ENABLE 1 35 | #cmakedefine DFTRACER_HWLOC_ENABLE 1 36 | #cmakedefine DFTRACER_HIP_TRACING_ENABLE 1 37 | 38 | #define DFTRACER_LOGGER_CPP_LOGGER 1 39 | #define DFTRACER_LOGGER_LEVEL_TRACE 1 40 | #define DFTRACER_LOGGER_LEVEL_DEBUG 1 41 | #define DFTRACER_LOGGER_LEVEL_INFO 1 42 | #define DFTRACER_LOGGER_LEVEL_WARN 1 43 | #define DFTRACER_LOGGER_LEVEL_ERROR 1 44 | 45 | //========================== 46 | // Common macro definitions 47 | //========================== 48 | 49 | #define DFTRACER_PATH_DELIM "/" 50 | 51 | // #define DFTRACER_NOOP_MACRO do {} while (0) 52 | #define DFTRACER_NOOP_MACRO 53 | 54 | // Detect VAR_OPT 55 | // https://stackoverflow.com/questions/48045470/portably-detect-va-opt-support 56 | #if __cplusplus <= 201703 && defined __GNUC__ && !defined __clang__ && \ 57 | !defined __EDG__ 58 | #define VA_OPT_SUPPORTED false 59 | #else 60 | #define PP_THIRD_ARG(a, b, c, ...) c 61 | #define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(, ), true, false, ) 62 | #define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?) 63 | #endif 64 | 65 | #if !defined(DFTRACER_HASH_SEED) || (DFTRACER_HASH_SEED <= 0) 66 | #define DFTRACER_SEED 104723u 67 | #endif 68 | // clang-format on 69 | #endif /* DFTRACER_CONFIG_H */ 70 | -------------------------------------------------------------------------------- /dfanalyzer_old/dask/scripts/start_dask_distributed.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -x 3 | source $HOME/.dftracer/configuration.sh 4 | export PYTHONPATH=${DFTRACER_APP}:${PYTHONPATH} 5 | 6 | hostname=`hostname` 7 | DFTRACER_DASK_CONF_NAME="UNSET" 8 | case $hostname in 9 | *"corona"*) 10 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/corona.yaml 11 | ;; 12 | *"ruby"*) 13 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/ruby.yaml 14 | ;; 15 | "quartz"*) 16 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/quartz.yaml 17 | ;; 18 | "polaris"*) 19 | DFTRACER_DASK_CONF_NAME=${DFTRACER_APP}/dfanalyzer_old/dask/conf/polaris.yaml 20 | ;; 21 | esac 22 | 23 | if [[ "$DFTRACER_DASK_CONF_NAME" == "UNSET" ]]; then 24 | echo "UNSUPPORTED $hostname" 25 | exit 1 26 | fi 27 | 28 | source ${DFTRACER_APP}/dfanalyzer_old/dask/scripts/utils.sh 29 | eval $(parse_yaml $DFTRACER_DASK_CONF_NAME DFTRACER_) 30 | 31 | 32 | source ${DFTRACER_ENV}/bin/activate 33 | 34 | # Create necessary directories and validate 35 | if ! mkdir -p ${DFTRACER_CONFIG_LOG_DIR}; then 36 | echo "Error: Failed to create DFTRACER_CONFIG_LOG_DIR (${DFTRACER_CONFIG_LOG_DIR})." 37 | echo "Please update the paths in ~/.dftracer/configuration.yaml." 38 | exit 1 39 | fi 40 | 41 | if ! mkdir -p ${DFTRACER_CONFIG_RUN_DIR}; then 42 | echo "Error: Failed to create DFTRACER_CONFIG_RUN_DIR (${DFTRACER_CONFIG_RUN_DIR})." 43 | echo "Please update the paths in ~/.dftracer/configuration.yaml." 44 | exit 1 45 | fi 46 | 47 | if [ ! -d "${DFTRACER_CONFIG_RUN_DIR}" ]; then 48 | echo "Error: ${DFTRACER_CONFIG_RUN_DIR} does not exist after attempting to create it. Check permissions or paths." 49 | exit 1 50 | fi 51 | 52 | echo "Using DFTRACER_CONFIG_RUN_DIR: ${DFTRACER_CONFIG_RUN_DIR}" 53 | 54 | # Remove old scheduler JSON if it exists 55 | rm -rf ${DFTRACER_CONFIG_RUN_DIR}/scheduler_${USER}.json 56 | 57 | # Start Dask Scheduler 58 | ${DFTRACER_DASK_SCHEDULER} --scheduler-file ${DFTRACER_CONFIG_RUN_DIR}/scheduler_${USER}.json --port ${DFTRACER_SCHEDULER_PORT} > ${DFTRACER_CONFIG_LOG_DIR}/scheduler_${USER}.log 2>&1 & 59 | scheduler_pid=$! 60 | echo $scheduler_pid > ${DFTRACER_CONFIG_RUN_DIR}/scheduler_${USER}.pid 61 | 62 | # Wait for scheduler JSON to be created (timeout after 30 seconds) 63 | file=${DFTRACER_CONFIG_RUN_DIR}/scheduler_${USER}.json 64 | timeout=30 # Time (seconds) to wait for the file 65 | SECONDS=0 66 | 67 | until [ -s "$file" ] || (( SECONDS >= timeout )); do 68 | sleep 1 69 | done 70 | 71 | if [ -f "$file" ]; then 72 | echo "Scheduler with PID $scheduler_pid is running." 73 | else 74 | echo "Error: Scheduler with PID $scheduler_pid failed. Check ${DFTRACER_CONFIG_LOG_DIR}/scheduler_${USER}.log for details." 75 | exit 1 76 | fi 77 | 78 | # Remove old job PID file if it exists 79 | rm -f ${DFTRACER_CONFIG_RUN_DIR}/job_id_${USER}.pid 80 | 81 | # Start Dask Worker 82 | ${DFTRACER_SCHEDULER_CMD} ${DFTRACER_CONFIG_SCRIPT_DIR}/start_dask_worker.sh ${DFTRACER_DASK_CONF_NAME} ${hostname} 83 | -------------------------------------------------------------------------------- /docs/style-guides.rst: -------------------------------------------------------------------------------- 1 | ************ 2 | Style Guides 3 | ************ 4 | 5 | Coding Conventions 6 | ================== 7 | 8 | DFTracer follows the `Google coding style 9 | `_. Please run 10 | ``git clang-format --diff HEAD~1 -q`` to check your patch for style problems before submitting it 11 | for review. 12 | 13 | Styling Code 14 | ------------ 15 | 16 | The clang-format tool can be used to apply much of the required code styling used in 17 | the project. 18 | 19 | .. code-block:: Bash 20 | :caption: To apply style to the source file foo.c: 21 | 22 | clang-format --style=Google --Werror foo.c 23 | 24 | The `.clang-format file 25 | `_ specifies 26 | the options used for this project. For a full list of available clang-format options, 27 | see https://clang.llvm.org/docs/ClangFormat.html. 28 | 29 | .. _style-check-label: 30 | 31 | Verifying Style Checks 32 | ---------------------- 33 | 34 | To check that uncommitted changes meet the coding style, use the following 35 | command: 36 | 37 | .. code-block:: Bash 38 | 39 | git clang-format --diff HEAD~1 -q 40 | 41 | .. tip:: 42 | 43 | This command will only check specific changes and additions to files that 44 | are already tracked by git. Run the command ``git add -N 45 | [...]`` first in order to style check new files as well. 46 | 47 | ------------ 48 | 49 | .. _commit-message-label: 50 | 51 | Commit Message Format 52 | ===================== 53 | 54 | Commit messages for new changes must meet the following guidelines: 55 | 56 | - In 50 characters or less, provide a summary of the change as the first line 57 | in the commit message. 58 | - A body which provides a description of the change. If necessary, please 59 | summarize important information such as why the proposed approach was chosen 60 | or a brief description of the bug you are resolving. Each line of the body 61 | must be 72 characters or less. 62 | 63 | An example commit message for new changes is provided below. 64 | 65 | .. code-block:: none 66 | 67 | Capitalized, short (50 chars or less) summary 68 | 69 | More detailed explanatory text, if necessary. Wrap it to about 72 70 | characters or so. In some contexts, the first line is treated as the 71 | subject of an email and the rest of the text as the body. The blank 72 | line separating the summary from the body is critical (unless you omit 73 | the body entirely); tools like rebase can get confused if you run the 74 | two together. 75 | 76 | Write your commit message in the imperative: "Fix bug" and not "Fixed bug" 77 | or "Fixes bug." This convention matches up with commit messages generated 78 | by commands like git merge and git revert. 79 | 80 | Further paragraphs come after blank lines. 81 | 82 | - Bullet points are okay 83 | 84 | - Typically a hyphen or asterisk is used for the bullet, followed by a 85 | single space, with blank lines in between, but conventions vary here 86 | 87 | - Use a hanging indent 88 | -------------------------------------------------------------------------------- /src/dftracer/core/aggregator/aggregator.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | template <> 4 | std::shared_ptr 5 | dftracer::Singleton::instance = nullptr; 6 | template <> 7 | bool dftracer::Singleton::stop_creating_instances = false; 8 | 9 | #define NUM_INSERT(TYPE) \ 10 | insert_number_value(iter2, time_interval, aggregated_key, key, \ 11 | std::any_cast(value.second)); 12 | 13 | #define GENERAL_INSERT(TYPE) \ 14 | insert_general_value(iter2, time_interval, aggregated_key, key, \ 15 | std::any_cast(value.second)); 16 | namespace dftracer { 17 | bool Aggregator::aggregate(AggregatedKey& aggregated_key) { 18 | bool is_first_local = is_first; 19 | is_first = false; 20 | std::unique_lock lock(mtx); 21 | // Calculate time_interval as the largest multiple of 22 | // config->trace_interval_ms * 1000 less than or equal to start_time 23 | TimeResolution interval_us = config->trace_interval_ms * 1000; 24 | aggregated_key.time_interval = 25 | (aggregated_key.time_interval / interval_us) * interval_us; 26 | auto time_iter = aggregated_data_.find(aggregated_key.time_interval); 27 | if (time_iter == aggregated_data_.end()) { 28 | aggregated_data_.insert_or_assign( 29 | aggregated_key.time_interval, 30 | std::unordered_map()); 31 | } 32 | auto last_interval_ = last_interval; 33 | if (aggregated_key.time_interval > last_interval) { 34 | last_interval = aggregated_key.time_interval; 35 | } 36 | 37 | insert_number_value(aggregated_key.time_interval, aggregated_key, "dur", 38 | aggregated_key.duration); 39 | for (const auto& [key, value] : *aggregated_key.additional_keys) { 40 | if (value.first == MetadataType::MT_VALUE) { 41 | DFTRACER_FOR_EACH_NUMERIC_TYPE(DFTRACER_ANY_CAST_MACRO, value.second, { 42 | insert_number_value(aggregated_key.time_interval, aggregated_key, key, 43 | res.value()); 44 | continue; 45 | }) 46 | DFTRACER_FOR_EACH_STRING_TYPE(DFTRACER_ANY_CAST_MACRO, value.second, { 47 | insert_general_value(aggregated_key.time_interval, aggregated_key, key, 48 | res.value()); 49 | continue; 50 | }) 51 | } 52 | } 53 | 54 | return !is_first_local && last_interval_ != last_interval; 55 | } 56 | int Aggregator::get_previous_aggregations(AggregatedDataType& data, bool all) { 57 | std::unique_lock lock(mtx); 58 | DFTRACER_LOG_INFO("Getting %d timestamps all: %d", aggregated_data_.size(), 59 | all); 60 | for (auto it = aggregated_data_.begin(); it != aggregated_data_.end();) { 61 | if (all || it->first < last_interval) { 62 | data[it->first] = std::move(it->second); 63 | it = aggregated_data_.erase(it); 64 | } else { 65 | ++it; 66 | } 67 | } 68 | return 0; 69 | } 70 | } // namespace dftracer 71 | --------------------------------------------------------------------------------