From 10ca0f664c4b28f70fe3043c40250752d406ef9f Mon Sep 17 00:00:00 2001 From: jowezarek Date: Tue, 3 Feb 2026 10:47:52 +0100 Subject: [PATCH] fix sf issue --- examples/performance/README.md | 36 ++++++++++++++++++- .../compare_3d_matrix_assembly_speed.py | 2 +- psydac/api/discretization.py | 5 ++- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/examples/performance/README.md b/examples/performance/README.md index 5f26b596b..a9a96650f 100644 --- a/examples/performance/README.md +++ b/examples/performance/README.md @@ -67,7 +67,7 @@ Test cases Data ---- -2025-09-09 17:28:19 (added by Julian O. - ThinkPad T14 on performance mode) +2025-09-09 17:28:19 (added by Julian O. - ThinkPad T14 in performance mode) ---------- | Test case | old assembly | new assembly | old discretization | new discretization | @@ -84,3 +84,37 @@ Data | 3.5 | 0.577 | 0.057 | 1.51 | 1.784 | | 3.6 | 0.598 | 0.209 | 2.411 | 1.848 | +2026-02-03 09:53:14 (added by Julian O. - ThinkPad T14 in performance mode - after a suspicion that we don't use the newly added SF algorithm by default anymore) +---------- + +| Test case | old assembly | new assembly | old discretization | new discretization | +| --- | --- | --- | --- | --- | +| 2.1 | 25.953 | 27.642 | 17.806 | 9.641 | +| 2.2 | 2.818 | 3.324 | 6.66 | 3.463 | +| 2.3 | 48.497 | 49.256 | 22.308 | 9.821 | +| 3.1.1 | 0.428 | 0.476 | 2.183 | 1.238 | +| 3.1.2 | 0.983 | 1.336 | 2.323 | 1.2 | +| 3.1.3 | 0.848 | 0.786 | 4.028 | 2.252 | +| 3.2 | 1.676 | 1.369 | 1.513 | 1.662 | +| 3.3 | 0.949 | 0.586 | 1.327 | 1.288 | +| 3.4 | 0.694 | 0.923 | 1.144 | 1.161 | +| 3.5 | 0.612 | 0.558 | 1.564 | 1.511 | +| 3.6 | 1.865 | 0.624 | 2.379 | 1.76 | + +2026-02-03 10:37:52 (added by Julian O. - ThinkPad T14 in performance mode - after fixing the above issue) +---------- + +| Test case | old assembly | new assembly | old discretization | new discretization | +| --- | --- | --- | --- | --- | +| 2.1 | 30.908 | 2.164 | 21.086 | 21.173 | +| 2.2 | 3.193 | 0.581 | 6.229 | 4.364 | +| 2.3 | 43.744 | 3.914 | 21.244 | 23.042 | +| 3.1.1 | 0.242 | 0.043 | 1.713 | 1.798 | +| 3.1.2 | 0.561 | 0.045 | 1.701 | 1.522 | +| 3.1.3 | 0.897 | 0.161 | 4.085 | 3.296 | +| 3.2 | 1.043 | 0.046 | 1.364 | 1.691 | +| 3.3 | 0.57 | 0.082 | 1.045 | 2.024 | +| 3.4 | 1.656 | 0.073 | 1.775 | 2.204 | +| 3.5 | 0.563 | 0.074 | 1.788 | 2.274 | +| 3.6 | 0.768 | 0.211 | 3.307 | 1.865 | + diff --git a/examples/performance/compare_3d_matrix_assembly_speed.py b/examples/performance/compare_3d_matrix_assembly_speed.py index ebb04bf7f..4e2d9b944 100644 --- a/examples/performance/compare_3d_matrix_assembly_speed.py +++ b/examples/performance/compare_3d_matrix_assembly_speed.py @@ -627,7 +627,7 @@ def make_square_torus_geometry_3d(ncells, degree, comm=None): if mpi_rank == 0: # Write performance table to MarkDown file - with open('matrix_assembly_speed_log.md', 'a') as f: + with open('README.md', 'a') as f: f.write(txt) # Remove temporary folders diff --git a/psydac/api/discretization.py b/psydac/api/discretization.py index 3702dee29..5db8d794a 100644 --- a/psydac/api/discretization.py +++ b/psydac/api/discretization.py @@ -659,7 +659,10 @@ def discretize(a, *args, **kwargs): if isinstance(a, sym_BilinearForm): # Currently sum factorization can only be used for interior domains from sympde.expr.evaluation import DomainExpression - is_interior_expr = isinstance(kernel_expr, DomainExpression) + if isinstance(kernel_expr, tuple): + is_interior_expr = isinstance(kernel_expr[0], DomainExpression) + else: + is_interior_expr = isinstance(kernel_expr, DomainExpression) if kwargs.pop('sum_factorization') and is_interior_expr: return DiscreteBilinearForm_SF(a, kernel_expr, *args, **kwargs)