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

Disable UCP_FEATURE_WAKEUP in non-blocking mode #565

Open
wants to merge 2 commits into
base: branch-0.15
Choose a base branch
from
Open
Show file tree
Hide file tree
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
18 changes: 12 additions & 6 deletions ucp/_libs/ucx_api.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ cdef class UCXContext(UCXObject):
ucp_context_h _handle
dict _config

def __init__(self, config_dict):
def __init__(self, config_dict, blocking_progress_mode=False):
cdef ucp_params_t ucp_params
cdef ucp_worker_params_t worker_params
cdef ucs_status_t status
Expand All @@ -199,11 +199,17 @@ cdef class UCXContext(UCXObject):
UCP_PARAM_FIELD_REQUEST_SIZE | # noqa
UCP_PARAM_FIELD_REQUEST_INIT)

# We always request UCP_FEATURE_WAKEUP even when in blocking mode
# See <https://github.com/rapidsai/ucx-py/pull/377>
ucp_params.features = (UCP_FEATURE_TAG | # noqa
UCP_FEATURE_WAKEUP | # noqa
UCP_FEATURE_STREAM)
# We only enable UCP_FEATURE_WAKEUP on blocking mode. This is
# required for shared memory, which is currently only supported
# by non-blocking mode, and that doesn't implement UCP_FEATURE_WAKEUP.
# See <https://github.com/openucx/ucx/issues/5322>
if blocking_progress_mode is True:
ucp_params.features = (UCP_FEATURE_TAG | # noqa
UCP_FEATURE_WAKEUP | # noqa
UCP_FEATURE_STREAM)
else:
ucp_params.features = (UCP_FEATURE_TAG | # noqa
UCP_FEATURE_STREAM)

ucp_params.request_size = sizeof(ucx_py_request)
ucp_params.request_init = (
Expand Down
10 changes: 6 additions & 4 deletions ucp/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,17 +229,19 @@ class ApplicationContext:
def __init__(self, config_dict={}, blocking_progress_mode=None):
self.progress_tasks = []

# For now, a application context only has one worker
self.context = ucx_api.UCXContext(config_dict)
self.worker = ucx_api.UCXWorker(self.context)

if blocking_progress_mode is not None:
self.blocking_progress_mode = blocking_progress_mode
elif "UCXPY_NON_BLOCKING_MODE" in os.environ:
self.blocking_progress_mode = False
else:
self.blocking_progress_mode = True

# For now, a application context only has one worker
self.context = ucx_api.UCXContext(
config_dict, blocking_progress_mode=self.blocking_progress_mode
)
self.worker = ucx_api.UCXWorker(self.context)

if self.blocking_progress_mode:
self.epoll_fd = self.worker.init_blocking_progress_mode()
weakref.finalize(
Expand Down