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

add warning for when UCX_MEM_MMAP_HOOK_MODE is set #626

Open
wants to merge 2 commits into
base: branch-0.16
Choose a base branch
from
Open
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions tests/test_mmap_warn.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os


def test_mem_mmap_hook_warn(caplog):
"""
Test warning for UCX_MEM_MMAP_HOOK_MODE
"""
import logging

os.environ["UCX_MEM_MMAP_HOOK_MODE"] = "none"

# ucp.init will only print INFO LINES
with caplog.at_level(logging.INFO):
import ucp

ucp.init()
assert any(["UCX_MEM_MMAP_HOOK_MODE" in rec.message for rec in caplog.records])
7 changes: 7 additions & 0 deletions ucp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@
if not os.environ.get("UCX_TCP_RX_SEG_SIZE", False):
os.environ["UCX_TCP_RX_SEG_SIZE"] = "8M"

if os.environ.get("UCX_MEM_MMAP_HOOK_MODE", False):
quasiben marked this conversation as resolved.
Show resolved Hide resolved
msg = (
"Setting `UCX_MEM_MMAP_HOOK_MODE` disable IB registration cache "
"which disable GPURDMAincluding GPU direct. \nPlease unset "
"UCX_MEM_MMAP_HOOK_MODE"
quasiben marked this conversation as resolved.
Show resolved Hide resolved
)
logger.warning(msg)

# After handling of environment variable logging, add formatting to the logger
logger = get_ucxpy_logger()
Expand Down