Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add profiling to benchmarks/tpch. Improve profiler to prevent VizTracer nesting. #423

Merged
merged 1 commit into from
Jan 6, 2023

Conversation

xcharleslin
Copy link
Contributor

@xcharleslin xcharleslin commented Jan 5, 2023

Add daft.runners.profiler to benchmarks.tpch. Now, you can run benchmark with DAFT_PROFILING=1 to generate a profile per question.

The profile will be in the form tpch_q{num}_{timestamp}.json.


Adding the profiler to TPCH introduces nested profiling, since there are already profiler calls lower in the Daft code. However, VizTracer does not seem to be nestable. It will complain loudly:

Warning! Overwrite tracer! You should not have two VizTracer recording at the same time!

and then sometimes segfault:

*** SIGSEGV received at time=1672950845 on cpu 2 ***
PC: @     0x7fc5f9ea6306  (unknown)  (unknown)
    @     0x7fc5f9c12320  (unknown)  (unknown)
[2023-01-05 12:34:05,190 E 2576853 2577214] logging.cc:361: *** SIGSEGV received at time=1672950845 on cpu 2 ***
[2023-01-05 12:34:05,190 E 2576853 2577214] logging.cc:361: PC: @     0x7fc5f9ea6306  (unknown)  (unknown)
[2023-01-05 12:34:05,191 E 2576853 2577214] logging.cc:361:     @     0x7fc5f9c12320  (unknown)  (unknown)
Fatal Python error: Segmentation fault

Stack (most recent call first):
<no Python frame>
zsh: segmentation fault (core dumped)

To work around this, I made Daft's viztracer wrapper its own context manager that no-ops if an existing VizTracer is already active.

@xcharleslin xcharleslin marked this pull request as ready for review January 5, 2023 23:43
@xcharleslin xcharleslin merged commit dd09038 into main Jan 6, 2023
@xcharleslin xcharleslin deleted the charles/tpchprofile branch January 6, 2023 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant