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

Memory tests behave differently on one vs. several tests #166

Open
tommyod opened this issue Oct 26, 2023 · 1 comment
Open

Memory tests behave differently on one vs. several tests #166

tommyod opened this issue Oct 26, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@tommyod
Copy link
Collaborator

tommyod commented Oct 26, 2023

There seems to be some state or overhead when running multiple memray tests.

  • Running all three tests in one go reports high memory usage for the first one, lower for the remaining two tests
  • Running one at a time reports a relatively high memory usage for each test

Running all tests

pytest tests -k memory --memray 
==================================================================================== MEMRAY REPORT ===
Allocation results for tests/test_esmda.py::TestESMDAMemory::test_ESMDA_memory_usage_subspace_inversion_without_overwrite at the high watermark

	 📦 Total memory allocated: 127.2MiB
	 📏 Total allocations: 194
	 📊 Histogram of allocation sizes: |▁ █   ▁ ▃|


Allocation results for tests/test_sies.py::test_memory_usage at the high watermark

	 📦 Total memory allocated: 63.8MiB
	 📏 Total allocations: 237
	 📊 Histogram of allocation sizes: |▂ ▄   ▅ █|


Allocation results for tests/test_esmda.py::TestESMDAMemory::test_ESMDA_memory_usage_subspace_inversion_with_overwrite at the high watermark

	 📦 Total memory allocated: 54.8MiB
	 📏 Total allocations: 156
	 📊 Histogram of allocation sizes: |▆   ▅   █|

Running individually

pytest tests -k test_ESMDA_memory_usage_subspace_inversion_without_overwrite --memray
==================================================================================== MEMRAY REPORT ===
Allocation results for tests/test_esmda.py::TestESMDAMemory::test_ESMDA_memory_usage_subspace_inversion_without_overwrite at the high watermark

	 📦 Total memory allocated: 127.2MiB
	 📏 Total allocations: 194
	 📊 Histogram of allocation sizes: |▁ █   ▁ ▃|


pytest tests -k test_memory_usage --memray
==================================================================================== MEMRAY REPORT ===
Allocation results for tests/test_sies.py::test_memory_usage at the high watermark

	 📦 Total memory allocated: 127.8MiB
	 📏 Total allocations: 255
	 📊 Histogram of allocation sizes: |█ ▅ █ ▃ █|

pytest tests -k test_ESMDA_memory_usage_subspace_inversion_with_overwrite --memray
==================================================================================== MEMRAY REPORT ===
Allocation results for tests/test_esmda.py::TestESMDAMemory::test_ESMDA_memory_usage_subspace_inversion_with_overwrite at the high watermark

	 📦 Total memory allocated: 118.8MiB
	 📏 Total allocations: 186
	 📊 Histogram of allocation sizes: |▁ █   ▁ ▃|

@tommyod
Copy link
Collaborator Author

tommyod commented Oct 26, 2023

There also seems to be a bit of state between runs:

<change the test>


(venv) > $ pytest tests --memray -k test_esmda_inversion_memory

==================================================================================== MEMRAY 
Allocation results for tests/test_esmda_inversion.py::test_esmda_inversion_memory at the high watermark

	 📦 Total memory allocated: 128.2MiB




(venv) > $ pytest tests --memray -k test_esmda_inversion_memory
==================================================================================== MEMRAY 
Allocation results for tests/test_esmda_inversion.py::test_esmda_inversion_memory at the high watermark

	 📦 Total memory allocated: 127.2MiB

@tommyod tommyod added the bug Something isn't working label Dec 14, 2023
@eivindjahren eivindjahren added christmas-review Issues and PRs for Christmas review and removed christmas-review Issues and PRs for Christmas review labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants