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

Profiler: Improve compatibility with Pluto.jl and friends. #2139

Merged
merged 3 commits into from
Nov 1, 2023

Conversation

maleadt
Copy link
Member

@maleadt maleadt commented Nov 1, 2023

By using a results object instead of writing to stdout.

As suggested by @vchuravy in https://discourse.julialang.org/t/how-would-i-retrieve-the-result-from-cuda-profile/105548

@thomasfaingnaert This removes CUDA.@profiled again, as the results are now returned by CUDA.@profile. I would also suggest adding some accessors, e.g., kernel_times(::ProfileResults) (or an iterator), to avoid breaking GemmKernels.jl over and over again.

By using a results object instead of writing to stdout.
print(stdout isa Base.TTY ? IOContext(stdout, :limit => true) : stdout, data; kwargs...)
function print(io::IO, data; trace=false, raw=false)
data = deepcopy(data)
function Base.show(io::IO, results::ProfileResults)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now it will be a long day before I understand our show methods hierarchy, but should this be?

Suggested change
function Base.show(io::IO, results::ProfileResults)
function Base.show(io::IO, ::MIME"text/plain", results::ProfileResults)

Copy link
Member Author

@maleadt maleadt Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we do, in this case atleast. Basically, you want the ProfileResults to be rendered, almost always. So when doing display, which IIUC is MIME"text/plain", but also when doing string or print (which I think doesn't use a MIME input?), or when rendering in Pluto (which, again IIUC, uses text/html).

I'm probably misunderstanding though, as I'm not very familiar with the show method hierarchy either, but I did verify the above cases and the output is rendered correctly.

Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (2ae5376) 72.19% compared to head (b9ea174) 72.11%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2139      +/-   ##
==========================================
- Coverage   72.19%   72.11%   -0.09%     
==========================================
  Files         159      159              
  Lines       14386    14382       -4     
==========================================
- Hits        10386    10371      -15     
- Misses       4000     4011      +11     
Files Coverage Δ
src/profile.jl 75.59% <98.18%> (-3.29%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@maleadt maleadt merged commit d11ba2a into master Nov 1, 2023
1 check passed
@maleadt maleadt deleted the tb/profile_object branch November 1, 2023 16:17
thomasfaingnaert added a commit to JuliaGPU/GemmKernels.jl that referenced this pull request Nov 3, 2023
ref JuliaGPU/CUDA.jl#2139

Probably should add methods to CUDA.jl to access the kernel times
instead of grabbing them directly from the dataframe.
thomasfaingnaert added a commit to JuliaGPU/GemmKernels.jl that referenced this pull request Nov 7, 2023
ref JuliaGPU/CUDA.jl#2139

Probably should add methods to CUDA.jl to access the kernel times
instead of grabbing them directly from the dataframe.
thomasfaingnaert added a commit to JuliaGPU/GemmKernels.jl that referenced this pull request Nov 7, 2023
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

2 participants