Loading
PETSc matrix exact sparsity pattern
PETScSparsityPattern carries per‐row nonzero counts + optional exact column indices. Precise preallocation. No over‐alloc. Copy reuses sparsity when unchanged.
Old code was not sophisticated enough: PETScMatrixOption held crude d_nz/o_nz estimates (uniform nonzeros per row). Wasted memory. Slow preallocation. MatConvert copy blindly allocated full structure.
Should fix the SEGV in pytest. (But by the time of MR review that SEGV is no longer reproducible.) Fixes another pytest assertion in the pytest:
275: __________________________ test_assembly_optimization __________________________
275:
275: tmp_path = PosixPath('/tmp/pytest-of-naumov/pytest-9/test_assembly_optimization0')
275: capfd = <_pytest.capture.CaptureFixture object at 0x7fbb21519940>
275: monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7fbac6b09cd0>
275:
275: @pytest.mark.performance_test
275: def test_assembly_optimization(tmp_path, capfd, monkeypatch):
275: srcdir = Path(__file__).parent.parent.parent
275: testsrcdir = srcdir / "Tests/Data/Parabolic/T/3D_Beier_sandbox"
275: cases = [("base", "beier_sandbox.prj"), ("linear", "beier_sandbox_linear.xml")]
275:
275: # run OGS and save logs
275: for name, prj_or_patch in cases:
275: outdir = tmp_path / name
275: outdir.mkdir()
275: with monkeypatch.context() as ctx:
275: ctx.setenv("OMP_NUM_THREADS", "1") # enforce a single thread
275: status = cli.ogs((testsrcdir / prj_or_patch).as_posix(), o=outdir)
275:
275: captured = capfd.readouterr()
275: with (outdir / "ogs.log").open("w") as fh:
275: fh.write(captured.out)
275:
275: > assert status == 0 # OGS run successful
275: ^^^^^^^^^^^^^^^^^^
275: E assert 63 == 0- Tests covering your feature were added?
- Any new feature or behaviour change was documented?
- Add this merge request to the changelog
Edited by Dmitri Naumov