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

unset CUDF_SPILL after a pytest #14958

Merged
merged 6 commits into from
Feb 3, 2024
Merged
Changes from 3 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
67 changes: 37 additions & 30 deletions python/cudf/cudf/tests/test_spilling.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,37 +223,44 @@ def reload_options():
cudf.core.buffer.spill_manager._global_manager_uninitialized = True
importlib.reload(cudf.options)

monkeypatch.setenv("CUDF_SPILL_ON_DEMAND", "off")
monkeypatch.setenv("CUDF_SPILL", "off")
with monkeypatch.context() as m:
monkeypatch.setenv("CUDF_SPILL_ON_DEMAND", "off")
vyasr marked this conversation as resolved.
Show resolved Hide resolved
monkeypatch.setenv("CUDF_SPILL", "off")
reload_options()
assert get_global_manager() is None

monkeypatch.setenv("CUDF_SPILL", "on")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager._spill_on_demand is False
assert manager._device_memory_limit is None
assert manager.statistics.level == 0

monkeypatch.setenv("CUDF_SPILL_DEVICE_LIMIT", "1000")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager._device_memory_limit == 1000
assert manager.statistics.level == 0

monkeypatch.setenv("CUDF_SPILL_STATS", "1")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager.statistics.level == 1

monkeypatch.setenv("CUDF_SPILL_STATS", "2")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager.statistics.level == 2
monkeypatch.delenv("CUDF_SPILL")
monkeypatch.delenv("CUDF_SPILL_ON_DEMAND")
monkeypatch.delenv("CUDF_SPILL_DEVICE_LIMIT")
monkeypatch.delenv("CUDF_SPILL_STATS")
vyasr marked this conversation as resolved.
Show resolved Hide resolved
reload_options()
reload_options()
assert get_global_manager() is None

monkeypatch.setenv("CUDF_SPILL", "on")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager._spill_on_demand is False
assert manager._device_memory_limit is None
assert manager.statistics.level == 0

monkeypatch.setenv("CUDF_SPILL_DEVICE_LIMIT", "1000")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager._device_memory_limit == 1000
assert manager.statistics.level == 0

monkeypatch.setenv("CUDF_SPILL_STATS", "1")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager.statistics.level == 1

monkeypatch.setenv("CUDF_SPILL_STATS", "2")
reload_options()
manager = get_global_manager()
assert isinstance(manager, SpillManager)
assert manager.statistics.level == 2


def test_spill_device_memory(manager: SpillManager):
Expand Down
Loading