-
Notifications
You must be signed in to change notification settings - Fork 11
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
[v1.0.1] Tune import time #92
Comments
A possible solution would be to update from ._python import fun If def use_numba():
from ._numba import fun
globals().update(fun=fun) |
equivalent to |
In the past (alpha versions) this was complicated but now that everything is organized in folders/files this should be an easy task. |
okay, it seems this commit slows down import time even more. |
Inspecting from .__about__ import __version__
import time
t = []
t.append(time.time())
from . import math
t.append(time.time())
from . import mesh
t.append(time.time())
from . import quadrature
t.append(time.time())
from . import dof
t.append(time.time())
from . import element
t.append(time.time())
from . import tools
t.append(time.time())
from . import constitution
t.append(time.time())
from . import solve
t.append(time.time())
from . import region
t.append(time.time())
import numpy as np
print(np.diff(np.array(t)))
# ... produces
|
It seems most of the time is spent on importing |
As we only use Legendre-Gauss rules quadpy could be removed - NumPy has them built-in. See https://numpy.org/doc/stable/reference/routines.polynomials.legendre.html points, weights = numpy.polynomial.legendre.leggauss(deg) |
x, y = np.polynomial.legendre.leggauss(3)
w, v, u = np.meshgrid(x, x, x, indexing="ij")
points = np.vstack((u.ravel(), v.ravel(), w.ravel())).T
weights = np.einsum("i,j,k",y,y,y).ravel() |
Guess: if numba is installed, felupe compiles the parallel version of the integrate method of a form on import - even if it is not used. This should be handled in a better way in the future.
The text was updated successfully, but these errors were encountered: