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

Non-static bounce buffer option #454

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
test
  • Loading branch information
madsbk committed Sep 2, 2024
commit 49bf4ac9daa4e74987ce98db2508216822b67c51
14 changes: 9 additions & 5 deletions python/kvikio/tests/test_basic_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,17 @@ def test_different_bounce_buffer_sizes(tmp_path, size, tasksize, buffer_size):
def test_bounce_buffer_clear(tmp_path):
"""Test clearing the bounce buffer"""
filename = tmp_path / "test-file"
kvikio.buffer.bounce_buffer_clear()
with kvikio.defaults.set_compat_mode(True), kvikio.defaults.set_num_threads(1):
with kvikio.CuFile(filename, "w") as f:
with kvikio.defaults.set_bounce_buffer_size(1024):
f.write(cupy.arange(10)) # populate the bounce buffer
# Notice, since the bounce buffer size is only checked when the buffer
# is used, we populate the bounce buffer in between we clear it.
f.write(cupy.arange(10))
assert kvikio.buffer.bounce_buffer_clear() == 1024
f.write(cupy.arange(10)) # populate the bounce buffer
assert kvikio.buffer.bounce_buffer_clear() == 0
f.write(cupy.arange(10))
with kvikio.defaults.set_bounce_buffer_size(2048):
with kvikio.CuFile(filename, "w") as f:
f.write(cupy.arange(10)) # populate the bounce buffer
assert kvikio.buffer.bounce_buffer_clear() == 2048
f.write(cupy.arange(10))
assert kvikio.buffer.bounce_buffer_clear() == 2048
assert kvikio.buffer.bounce_buffer_clear() == 0