firedrakeproject / firedrake

Firedrake is an automated system for the portable solution of partial differential equations using the finite element method (FEM)
https://firedrakeproject.org
Other
521 stars 160 forks source link

Fix MUMPS on macOS #3752

Closed Ig-dolci closed 2 months ago

Ig-dolci commented 3 months ago

Description

Additional flag to fix macOS issue involving MUMPS.

Ig-dolci commented 3 months ago

Could anyone with macOS help verify if this firedrake-install script fixes the parallel issue with MUMPS?

Please try running test_poisson_analytic_linear_parallel() from tests/regression/test_poisson_strong_bcs.py. My machine works correctly with mpiexec -n 2 tests/regression/test_poisson_strong_bcs.py, but fails when run with pytest.

If the pytest also fails for others, it might indicate a parallel issue with pytest rather than with MUMPS.

You can try pytest and python executions also for test_dg_advection_cubed_sphere_parallel() from tests/regression/test_dg_advection.py.

Obs: Without -Wl,-dead_strip_dylibs flag, neither python nor pytest executions work.

Ig-dolci commented 3 months ago

We also have this Colin's test:

from pyop2.mpi import MPI

size = MPI.COMM_WORLD.size
ensemble = Ensemble(COMM_WORLD, size//2)
rank = ensemble.ensemble_comm.rank

mesh = UnitSquareMesh(20, 20, comm=ensemble.comm)
V = FunctionSpace(mesh, "CG", 1)

n_Js = [3, 3]
Js_offset = [0, 3]

u = TrialFunction(V)
v = TestFunction(V)
a = inner(grad(u), grad(v))*dx

for i in range(n_Js[rank]):
    val = Js_offset[rank]+i+1
    x = Function(V)
    L = x*v*dx
    u0 = Function(V)
    bc = DirichletBC(V, Constant(val), "on_boundary")
    solve(a == L, u0, bcs=[bc])
    print(rank, norm(u0), "NOOORMM")

with correct output:

 ~  mpiexec -n 2 python3 mfe.py                                                                                                               
1 3.9999999999999716 NOOORMM
1 5.0 NOOORMM
1 6.000000000000031 NOOORMM
0 0.9999999999999929 NOOORMM
0 1.9999999999999858 NOOORMM
0 3.0000000000000155 NOOORMM
 ~  mpiexec -n 4 python3 mfe.py                                                                                                               
0 0.9999999999999949 NOOORMM
0 1.9999999999999898 NOOORMM
0 2.999999999999998 NOOORMM
0 0.9999999999999949 NOOORMM
0 1.9999999999999898 NOOORMM
0 2.999999999999998 NOOORMM
1 3.9999999999999796 NOOORMM
1 5.0 NOOORMM
1 5.999999999999996 NOOORMM
1 3.9999999999999796 NOOORMM
1 5.0 NOOORMM
1 5.999999999999996 NOOORMM
ksagiyam commented 3 months ago

After a fresh install on my M3 Mac, parallel pytest also fails for me, but running test_poisson_analytic_linear_parallel() directly with mpiexec -n 2 python ... works. Colin's test also passes.

Ig-dolci commented 3 months ago

After a fresh install on my M3 Mac, parallel pytest also fails for me, but running test_poisson_analytic_linear_parallel() directly with mpiexec -n 2 python ... works. Colin's test also passes.

So, I believe we have two options here:

  1. Merge this PR and open an issue for pytest fails.
  2. Or try to figure out the pytest issue, and fix it before merging this PR.

Any thoughts?

ksagiyam commented 3 months ago

1, I think, if this PR fixes a major issue.