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

(Profiled) Code spends most of its time in Internal.Devel.check #317

Open
fhaust opened this issue Feb 12, 2020 · 6 comments
Open

(Profiled) Code spends most of its time in Internal.Devel.check #317

fhaust opened this issue Feb 12, 2020 · 6 comments

Comments

@fhaust
Copy link
Contributor

fhaust commented Feb 12, 2020

I just profiled some hmatrix heavy code and found that it spends 70% of its time in Internal.Devel.check which sounds strange to me. From what I gathered that function is used to check the return code of the FPU?

To be fair, this might be an non issue when the code is running not profiled due to optimizations kicking in?

@idontgetoutmuch
Copy link
Member

I have no idea - if you could post an example, I could investigate a bit further.

@StefanHubner
Copy link

StefanHubner commented May 31, 2020

I just found the same. I attached the profile file.
Indeed, this could just be an FFI call being attributed to that function by the profiler.

profile.zip

EDIT: forked the repository and tried it without the error check function which sped up the particular part of my code about 10 fold (from 44sec to 4sec).

profile.nocheck.zip

EDIT 2: Turns out, as suspected, being lazy, this never evaluated the FFI call.

I suppose this implies that the issue can be closed.

@idontgetoutmuch
Copy link
Member

@StefanHubner Thanks for investigating - just to be clear: this speed up only happens when profiling? So the problem seems to be one with profiling not with hmatrix itself?

@StefanHubner
Copy link

StefanHubner commented Jun 7, 2020

@idontgetoutmuch No, the speed-up came from it never being evaluated. The error code checking is not costly but the computational expense of the FFI call is attributed to the check function.
I hope this makes sense!

@dschrempf
Copy link

dschrempf commented Jul 6, 2020

I am having the same issue. It seems that the FFI call is evaluated when the error value is checked, and so, the computation happens in Internal.Deve.check. Is it possible to change this behavior to get more informative profiling results?

EDIT: The actual computation is a Matrix-Vector multiplication and a dot product alla (vTranspose <# matrix) <.> v.

@HuwCampbell
Copy link
Collaborator

I think we could very well inline calls to check and (#|), their definitions are quite small, and it would probably push the cost centre to the c calls. There's also the option of explicit cost centre annotations.

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

No branches or pull requests

5 participants