Comments (9)
A possible solution would be to update globals
with felupe.use_numba()
or something similar. For example, the __init__.py
file contains an import statement for a function fun
.
from ._python import fun
If form.assemble(parallel=True)
is called, the functions should be replaced by numba-accelerated functions
def use_numba():
from ._numba import fun
globals().update(fun=fun)
from felupe.
equivalent to globals()["fun"] = fun
or globals().update(fun=fun)
is also import sys; fe = sys.modules[__name__]; fe.fun=fun
from felupe.
In the past (alpha versions) this was complicated but now that everything is organized in folders/files this should be an easy task.
from felupe.
see branch https://github.com/adtzlr/felupe/tree/improve-numba-jit
from felupe.
okay, it seems this commit slows down import time even more.
from felupe.
Inspecting __init__.py
gives:
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
In [1]: import felupe
[0.00519323 0.01053238 2.14523649 0.87573862 0.05784726 0.38405085
0.00819564 0. 0.00375438]
from felupe.
It seems most of the time is spent on importing quadrature
due to quadpy
followed by dof
due to `sparse´.
from felupe.
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)
from felupe.
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()
from felupe.
Related Issues (20)
- Docs: Ex. with (large-strain) plasticity is wrong
- Add a view-method to the element base class
- Load Cases: Re-add old-style arguments
- Add plot methods to `Region` and `Scheme`
- Enhance and refactor the assembly submodule
- Make the `field` submodule public
- Inconsistent class names for Mesh, Field, IntegralForm, ...?
- Docs: Add the assembly submodule
- A `Form` is not supported as item in a `Step`
- Docs & Tests: Non-unique imports
- `Basis` should be removed
- `Boundary()`: Add an option to apply a new point-`mask`
- `Boundary(mask)`: Add support dof-based masks
- Negative cell-volumes for `RegionTriangleMINI` on a `Rectangle` if `n>7`
- Uniaxial compression on a rotated hyperelastic cube
- Automatic reload of regions with modified mesh-points HOT 4
- Add compressible Neo-Hookean material formulation
- Strain Output is wrong
- Low performance of `math.cdya()`
- Pass keyword-arguments to einsum-calls in `math.dot(**kwargs)`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from felupe.