Skip to content

Commit

Permalink
fix tag reference in example (#229)
Browse files Browse the repository at this point in the history
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 <module>
    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: rapidsai/ucx-wheels#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: #229
  • Loading branch information
jameslamb authored May 10, 2024
1 parent 2195cea commit f9b27a5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions python/examples/basic.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit f9b27a5

Please sign in to comment.