-
Notifications
You must be signed in to change notification settings - Fork 160
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
BUG: Regression in Performance after Installing Firedrake #3030
Comments
Assuming this is still an issue, could you try a separate fresh install (please download the latest version of the install script!) now that we have pinned Cython. It's possible that the slow init is a result of some packages being installed with latest Cython and some with older Cython. I have not been able to reproduce this issue locally. |
I have reinstalled using the updated firedrake-install script after I completely removed the previous venv. I have also uninstalled and reinstalled homebrew and then completed a further reinstallation. The same performance issue is present. I have run helmholtz.py (with graph plotting removed) using both my M1 Max and a Linux Workstation (3 month+ old venv) for comparison. I have attached the profiles. They are usually of comparable performance. Is there anything else I can reinstall to enable a fresh implementation? |
If you update (or do a fresh install) on the Linux workstation do you also see the performance regression? If you don't want to risk losing the old performant venv you can use |
I will say that the profiles do look very similar to a first run (doing code gen) vs second run (using cached code). The Helmholtz example (in the demos directory) is also very small, only a 10x10 grid with CG1 elements. To get meaningful profiling data we need to increase the number of dofs. Maybe you could add some timings? I have attached an example profiling test on my desktop along with its output for comparison: test_script.sh: #!/bin/bash
# Clean caches
firedrake-clean
# Create a minimal Helmholtz problem (without plotting)
cat <<EOF >minimal_helmholtz.py
from firedrake import *
mesh = UnitSquareMesh(10, 10)
V = FunctionSpace(mesh, "CG", 1)
u = TrialFunction(V)
v = TestFunction(V)
f = Function(V)
x, y = SpatialCoordinate(mesh)
f.interpolate((1+8*pi*pi)*cos(x*pi*2)*cos(y*pi*2))
a = (inner(grad(u), grad(v)) + inner(u, v)) * dx
L = inner(f, v) * dx
u = Function(V)
solve(a == L, u, solver_parameters={'ksp_type': 'cg', 'pc_type': 'none'})
File("helmholtz.pvd").write(u)
f.interpolate(cos(x*pi*2)*cos(y*pi*2))
print(sqrt(assemble(dot(u - f, u - f) * dx)))
EOF
# Time and profile minimal Helmholtz
echo "10x10 cold cache"
time python minimal_helmholtz.py -log_view :no_cache_profile.txt:ascii_flamegraph
flamegraph.pl no_cache_profile.txt > no_cache_profile.svg
# Time and profile minimal Helmholtz with hot cache
echo "10x10 hot cache"
time python minimal_helmholtz.py -log_view :hot_cache_profile.txt:ascii_flamegraph
flamegraph.pl hot_cache_profile.txt > hot_cache_profile.svg
# Increase problem size
sed -i "s/(10, 10)/(1000, 1000)/g" minimal_helmholtz.py
# Run bigger problem
echo "1000x1000 hot cache"
time python minimal_helmholtz.py -log_view :big_hot_cache_profile.txt:ascii_flamegraph
flamegraph.pl big_hot_cache_profile.txt > big_hot_cache_profile.svg output:
|
@rdm4317 any update? |
@JDBetteridge I have run the requested profiles, here are the results: Mac: 10x10 cold cache 10x10 hot cache 1000x1000 hot cache
Linux WS: 10x10 cold cache 10x10 hot cache 1000x1000 hot cache
|
For a simple hyperelasticity example, I am getting different TSFC behaviours. Mac:
Linux:
Here is the code:
|
I reproduced this execution with test.sh at M2 Mac. See the results: 10x10 cold cache 10x10 hot cache 1000x1000 hot cache I had |
I see tsfc warning at each step both on my mac and on my Linux machine. It looks more like an issue of the latest Firedrake than macos vs. Linux to me. Can everyone please put the output of |
@ksagiyam I have updated my post with this output |
|
Testing on my Linux machine indicates that this PR on Constant #2927 somehow broke the caching. (Firedrake + PyOP2 + tsfc) I used the above hyperelasticity problem as an example. Right before #2927:
Cold cache:
Hot cache:
Right after #2927:
Cold cache:
Hot cache:
|
Hey @ksagiyam, did you work out how to fix this? |
Sorry I have been on holiday for the past two weeks so haven't seen this. I think that this is a known performance problem with the recent changes to how we use |
Yes, those branches at least fix the problem stated above. Cold cache:
Hot cache:
|
Closing this issue as I believe it is fixed by #3011. Please reopen it if this is not the case. |
Thanks @connorjward, I have just updated my installation and the performance is much improved. |
Description:
I encountered a performance regression after successfully installing Firedrake. Although the installation was completed without errors (after pinning the cython version to 0.29.36), the performance has noticeably dropped.
Steps to Reproduce:
Expected Behaviour:
The performance should be consistent or improved compared to the previous environment.
Actual Behavior:
The performance has significantly dropped after installing Firedrake.
Environment:
Operating System: MacOS 13.4.1
Python Version: 3.10.8
Firedrake Version: 0.13.0+5767.g32bda80fc
The text was updated successfully, but these errors were encountered: