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

UCT/CUDA/CUDA_IPC: add per stream refcount; avoid callbacks when no pending ops on stream #4646

Merged

Conversation

Akshay-Venkatesh
Copy link
Contributor

Why ?

When we arm CUDA-IPC transport to notify an event descriptor through callback threads, today we launch work on all streams that the process has created but there maybe work only on a subset of streams. This results in process waking up almost immediately after armed if at least one stream was empty (highly likely because some peers are not even CUDA-IPC accessible but there are streams created for them and there would never be any real work issued on streams dedicated for those peer GPUs). The way to get around this issue is to maintain a refcount and issue callbacks if there are outstanding ops on the stream.

cc @bureddy @quasiben

@swx-jenkins3
Copy link
Collaborator

Can one of the admins verify this patch?

@mellanox-github
Copy link
Contributor

Mellanox CI: PASSED on 25 workers (click for details)

Note: the logs will be deleted after 11-Jan-2020

Agent/Stage Status
_main ✔️ SUCCESS
hpc-arm-cavium-jenkins_W0 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W1 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W2 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W3 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W0 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W1 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W2 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W3 ✔️ SUCCESS
hpc-test-node-gpu_W0 ✔️ SUCCESS
hpc-test-node-gpu_W1 ✔️ SUCCESS
hpc-test-node-gpu_W2 ✔️ SUCCESS
hpc-test-node-gpu_W3 ✔️ SUCCESS
hpc-test-node-legacy_W0 ✔️ SUCCESS
hpc-test-node-legacy_W1 ✔️ SUCCESS
hpc-test-node-legacy_W2 ✔️ SUCCESS
hpc-test-node-legacy_W3 ✔️ SUCCESS
hpc-test-node-new_W0 ✔️ SUCCESS
hpc-test-node-new_W1 ✔️ SUCCESS
hpc-test-node-new_W2 ✔️ SUCCESS
hpc-test-node-new_W3 ✔️ SUCCESS
r-vmb-ppc-jenkins_W0 ✔️ SUCCESS
r-vmb-ppc-jenkins_W1 ✔️ SUCCESS
r-vmb-ppc-jenkins_W2 ✔️ SUCCESS
r-vmb-ppc-jenkins_W3 ✔️ SUCCESS

@mellanox-github
Copy link
Contributor

Mellanox CI: PASSED on 25 workers (click for details)

Note: the logs will be deleted after 11-Jan-2020

Agent/Stage Status
_main ✔️ SUCCESS
hpc-arm-cavium-jenkins_W0 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W1 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W2 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W3 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W0 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W1 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W2 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W3 ✔️ SUCCESS
hpc-test-node-gpu_W0 ✔️ SUCCESS
hpc-test-node-gpu_W1 ✔️ SUCCESS
hpc-test-node-gpu_W2 ✔️ SUCCESS
hpc-test-node-gpu_W3 ✔️ SUCCESS
hpc-test-node-legacy_W0 ✔️ SUCCESS
hpc-test-node-legacy_W1 ✔️ SUCCESS
hpc-test-node-legacy_W2 ✔️ SUCCESS
hpc-test-node-legacy_W3 ✔️ SUCCESS
hpc-test-node-new_W0 ✔️ SUCCESS
hpc-test-node-new_W1 ✔️ SUCCESS
hpc-test-node-new_W2 ✔️ SUCCESS
hpc-test-node-new_W3 ✔️ SUCCESS
r-vmb-ppc-jenkins_W0 ✔️ SUCCESS
r-vmb-ppc-jenkins_W1 ✔️ SUCCESS
r-vmb-ppc-jenkins_W2 ✔️ SUCCESS
r-vmb-ppc-jenkins_W3 ✔️ SUCCESS

@dmitrygx
Copy link
Member

dmitrygx commented Jan 4, 2020

ok to test

@mellanox-github
Copy link
Contributor

Mellanox CI: PASSED on 25 workers (click for details)

Note: the logs will be deleted after 11-Jan-2020

Agent/Stage Status
_main ✔️ SUCCESS
hpc-arm-cavium-jenkins_W0 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W1 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W2 ✔️ SUCCESS
hpc-arm-cavium-jenkins_W3 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W0 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W1 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W2 ✔️ SUCCESS
hpc-arm-hwi-jenkins_W3 ✔️ SUCCESS
hpc-test-node-gpu_W0 ✔️ SUCCESS
hpc-test-node-gpu_W1 ✔️ SUCCESS
hpc-test-node-gpu_W2 ✔️ SUCCESS
hpc-test-node-gpu_W3 ✔️ SUCCESS
hpc-test-node-legacy_W0 ✔️ SUCCESS
hpc-test-node-legacy_W1 ✔️ SUCCESS
hpc-test-node-legacy_W2 ✔️ SUCCESS
hpc-test-node-legacy_W3 ✔️ SUCCESS
hpc-test-node-new_W0 ✔️ SUCCESS
hpc-test-node-new_W1 ✔️ SUCCESS
hpc-test-node-new_W2 ✔️ SUCCESS
hpc-test-node-new_W3 ✔️ SUCCESS
r-vmb-ppc-jenkins_W0 ✔️ SUCCESS
r-vmb-ppc-jenkins_W1 ✔️ SUCCESS
r-vmb-ppc-jenkins_W2 ✔️ SUCCESS
r-vmb-ppc-jenkins_W3 ✔️ SUCCESS

@pentschev
Copy link
Contributor

@Akshay-Venkatesh I just had a quick chat with @quasiben and I've pointed out that today we don't use CUDA streams with Dask. I have filed an issue in the past rapidsai/dask-cuda#96 to discuss how we could, but today using streams with Dask is not possible/beneficial. I do agree this is an important part of getting the most performance with CUDA, but I just wanted to point out that today we can't really get any performance benefits from this work, unfortunately.

Copy link
Contributor

@brminich brminich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to add test for this?

@Akshay-Venkatesh
Copy link
Contributor Author

is it possible to add test for this?

Will work on this.

@Akshay-Venkatesh
Copy link
Contributor Author

is it possible to add test for this?

@brminich Seems like finding out the number of times a file descriptor has been written is not trivial. As epoll_wait returns only the number of file descriptors that were ready, it looks like that multiple writes to the same file descriptor cannot be distinguished. Also, it seems like if we use an external file descriptor through worker params, we can expect number of file descriptors which are ready to be just one so we cannot see how many streams wrote to cuda_ipc file descriptor unless we peek into the internal state of cuda_ipc UCT. I don't see an easy way to test this case with gtest/uct. Do you have any suggestions on how we can test this?

@Akshay-Venkatesh
Copy link
Contributor Author

@brminich can you let me know if you have any further thoughts on this #4646 (comment)

@brminich
Copy link
Contributor

@alinask, plz review

@brminich brminich merged commit 65e7ce3 into openucx:master Jan 17, 2020
pentschev pushed a commit to pentschev/ucx that referenced this pull request Mar 5, 2020
…stream-refcount

UCT/CUDA/CUDA_IPC: add per stream refcount; avoid callbacks when no pending ops on stream
pentschev pushed a commit to pentschev/ucx that referenced this pull request Apr 6, 2020
…stream-refcount

UCT/CUDA/CUDA_IPC: add per stream refcount; avoid callbacks when no pending ops on stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants