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

Performance regression since 0.12.11 #319

Closed
burnpanck opened this issue Jul 6, 2020 · 5 comments
Closed

Performance regression since 0.12.11 #319

burnpanck opened this issue Jul 6, 2020 · 5 comments

Comments

@burnpanck
Copy link

I have some code that performs a parallel line integral using quadpy.line_segment.integrate_adaptive. The integral is of oscillatory type. Previously, I got reasonable looking result in relatively little time. Since the upgrade to 0.14.11, that integration consumes huge amounts of RAM (50 GB+ for 1k line integrals) and never finishes (running out of patience after 10 min +). Downgrading to 0.13.6 did not help, but to 0.12.11 did.
I assume something in the algorithm must have changed such that the stop condition is not reached anymore. It's well possible that previously, the result was inaccurate (but good enough for my use case).

@nschloe
Copy link
Collaborator

nschloe commented Jul 8, 2020

Without an MWE, I can't do anything about it.

@burnpanck
Copy link
Author

I was hoping that you could point out a change in the implementation of the adaptive integration (e.g. a bug fix), which may have changed the interpretation of the convergence criteria (e.g. the recent introduction of eps_abs and eps_rel) and that the runtime might be an inherent case of my integrand. In that case, it would have been difficult to provide an MVP, since the integrand function is distributed over a larger code-base (a physical model that involves among others a linear interpolation of a sampled spectrum).

However, the MVE that I just provided for #316 seems to trigger the same behaviour. So there it is, just use that MVE for this issue aswell.

@nschloe
Copy link
Collaborator

nschloe commented Aug 25, 2020

The MWE in the other bug is too complex. Please provide a shorter one and also post it here.

@burnpanck
Copy link
Author

burnpanck commented Aug 26, 2020

It seems that this is fixed in 0.16. The following shortened example would subdivide until memory exhaustion in 0.15:

import numpy as np
import quadpy

# parameters
lo = -2
hi = 2
A = np.array(1)[...,None]
eps = 1e-7

# integrand
def func(x):
    n_times_p, = x.shape
    print(x.shape)
    return A*np.sign(x)

# perform integration
domain = np.array([lo,hi])
val,error = quadpy.c1.integrate_adaptive(
    func,
    domain,
    kronrod_degree=5,
    eps_abs=eps,
    eps_rel=eps,
)

In 0.12 (when adjusting for the API change of #316), the code runs fine too. Given that the true integral is zero and somewhere between 0.12 and 0.15 eps has been split into eps_rel and eps_abs, it likely had to do with eps_abs not being taken into account correctly.

@nschloe
Copy link
Collaborator

nschloe commented Aug 26, 2020

Good to hear! The default concatenation methods for stopping tests were all, meaning for example that both relative and absolute tolerances had to be fulfilled. It's now any, such that one of the two will suffice.

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

2 participants