From f9b27a5610026ee18051e38953b45e96f6872e82 Mon Sep 17 00:00:00 2001 From: James Lamb Date: Fri, 10 May 2024 09:19:44 -0500 Subject: [PATCH] fix tag reference in example (#229) Running the example at `python/examples/basic.py` results in the following ```text [1715298582.923398] [f059c9da14bb:1 :0] parser.c:2033 UCX WARN unused environment variable: UCX_MEMTYPE_CACHE (maybe: UCX_MEMTYPE_CACHE?) [1715298582.923398] [f059c9da14bb:1 :0] parser.c:2033 UCX WARN (set UCX_WARN_UNUSED_ENV_VARS=n to suppress this warning) Traceback (most recent call last): File "/opt/work/./python/examples/basic.py", line 259, in main() File "/opt/work/./python/examples/basic.py", line 227, in main listener_ep.tag_send(Array(send_bufs[0]), tag=ucx_api.UCXTag(0)), AttributeError: module 'ucxx._lib.libucxx' has no attribute 'UCXTag'. Did you mean: 'UCXXTag'? ``` It looks to me like that suggestion is right, and that that class is callsed `UCXXTag`: https://github.com/rapidsai/ucxx/blob/2195ceabf35b404b3ae6b09f784d1d312b4b6fce/python/ucxx/_lib/tag.pyx#L8 This PR proposes the following: * fixing that reference * adding a print statement at the end so that you know the example reached the end successfully without having to inspect the exit code of the process ## Notes for Reviewers I found this because I was using this example to smoke test changes to the new ucx wheels: https://github.com/rapidsai/ucx-wheels/pull/5 ### How I tested this ```shell docker run \ --rm \ --gpus 1 \ -v $(pwd):/opt/work \ -w /opt/work \ -it rapidsai/citestwheel:cuda12.2.2-ubuntu22.04-py3.10 \ pip install 'ucxx-cu12==0.38.*,>=0.0.0a0' && python ./python/examples/basic.py ``` Authors: - James Lamb (https://github.com/jameslamb) - Peter Andreas Entschev (https://github.com/pentschev) Approvers: - Peter Andreas Entschev (https://github.com/pentschev) URL: https://github.com/rapidsai/ucxx/pull/229 --- python/examples/basic.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/python/examples/basic.py b/python/examples/basic.py index d2368a4a..7138a756 100644 --- a/python/examples/basic.py +++ b/python/examples/basic.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. +# SPDX-FileCopyrightText: Copyright (c) 2022-2024, NVIDIA CORPORATION & AFFILIATES. # SPDX-License-Identifier: BSD-3-Clause import argparse @@ -224,12 +224,12 @@ def listener_callback(conn_request): recv_bufs = recv_buffer_requests.py_buffers else: requests = [ - listener_ep.tag_send(Array(send_bufs[0]), tag=ucx_api.UCXTag(0)), - listener_ep.tag_send(Array(send_bufs[1]), tag=ucx_api.UCXTag(1)), - listener_ep.tag_send(Array(send_bufs[2]), tag=ucx_api.UCXTag(2)), - ep.tag_recv(Array(recv_bufs[0]), tag=ucx_api.UCXTag(0)), - ep.tag_recv(Array(recv_bufs[1]), tag=ucx_api.UCXTag(1)), - ep.tag_recv(Array(recv_bufs[2]), tag=ucx_api.UCXTag(2)), + listener_ep.tag_send(Array(send_bufs[0]), tag=ucx_api.UCXXTag(0)), + listener_ep.tag_send(Array(send_bufs[1]), tag=ucx_api.UCXXTag(1)), + listener_ep.tag_send(Array(send_bufs[2]), tag=ucx_api.UCXXTag(2)), + ep.tag_recv(Array(recv_bufs[0]), tag=ucx_api.UCXXTag(0)), + ep.tag_recv(Array(recv_bufs[1]), tag=ucx_api.UCXXTag(1)), + ep.tag_recv(Array(recv_bufs[2]), tag=ucx_api.UCXXTag(2)), ] if args.asyncio_wait_future: