Skip to content
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

Fix flaky memory test #8812

Merged
merged 1 commit into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions tests/ert/performance_tests/test_memory_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path
from typing import List

import memray
import numpy as np
import py
import pytest
Expand Down Expand Up @@ -38,8 +39,6 @@ def poly_template(monkeypatch):
yield folder


@pytest.mark.flaky(reruns=5)
@pytest.mark.limit_memory("130 MB")
@pytest.mark.integration_test
def test_memory_smoothing(poly_template):
ert_config = ErtConfig.from_file("poly.ert")
Expand All @@ -54,12 +53,16 @@ def test_memory_smoothing(poly_template):
name="posterior",
prior_ensemble=prior_ens,
)
smoother_update(
prior_ens,
posterior_ens,
list(ert_config.observations.keys()),
list(ert_config.ensemble_config.parameters),
)
with memray.Tracker(poly_template / "memray.bin"):
smoother_update(
prior_ens,
posterior_ens,
list(ert_config.observations.keys()),
list(ert_config.ensemble_config.parameters),
)

stats = memray._memray.compute_statistics(str(poly_template / "memray.bin"))
assert stats.peak_memory_allocated < 1024**2 * 130


def fill_storage_with_data(poly_template: Path, ert_config: ErtConfig) -> None:
Expand Down