diff --git a/docs/source/howto/run_httomo.rst b/docs/source/howto/run_httomo.rst index eab0b58ae..6e308aefa 100644 --- a/docs/source/howto/run_httomo.rst +++ b/docs/source/howto/run_httomo.rst @@ -496,3 +496,39 @@ YAML pipeline. .. note:: HTTomo currently only accepts YAML pipelines as files and JSON pipelines as strings. Ie, both YAML pipelines provided as strings and JSON pipelines provided as files are not currently supported. + +Developer options ++++++++++++++++++ + +Tracing +####### + +One tool that can be used to record CPU traces, along with CPU and memory usage statistics is `VizTracer`_. + +.. _VizTracer: https://viztracer.readthedocs.io + +To enable CPU and memory usage statistic recording in the traces use the :code:`--no-standalone` option of httomo. + +VizTracer +######### + +Recording a trace with viztracer: + +:code:`python -m viztracer --plugin "vizplugins --cpu_usage --memory_usage" --output_file output.json -m httomo run --no-standalone data.nxs pipeline.yaml output_directory` + +Recording a trace for multiple ranks: + +:code:`mpirun -n 4 bash -c 'python -m viztracer --plugin "vizplugins --cpu_usage --memory_usage" --output_file output_rank_${OMPI_COMM_WORLD_RANK}.json -m httomo run --no-standalone data.nxs pipeline.yaml output_directory'` + +A separate file is created for each rank. +VizTracer can combine them into a single json file: + +:code:`viztracer --combine output_rank_*.json -o output.json` + +VizTracer's output json files can be viewed by vizviewer offline: + +:code:`vizviewer output.json` + +Or by using the online version of `Perfetto`_. + +.. _Perfetto: https://ui.perfetto.dev \ No newline at end of file diff --git a/httomo/__main__.py b/httomo/__main__.py index 9ae637f13..b73ba062c 100644 --- a/httomo/__main__.py +++ b/httomo/__main__.py @@ -1,4 +1,10 @@ +import sys from .cli import main if __name__ == "__main__": - main() + standalone_mode = True + if "--no-standalone" in sys.argv: + standalone_mode = False + sys.argv.remove("--no-standalone") + + main(standalone_mode=standalone_mode)