Hi, I am aware of the build time and runtime checks outlined in https://www.open-mpi.org/faq/?category=runcuda#mpi-cuda-aware-support, so please bear with me til the end.
We are looking for a runtime way to check whether CUDA awareness is actually turned on in Open MPI, see the original discussion in the mpi4py repo. It turns out that the existing API MPIX_Query_cuda_support() is useless. I quote @jsquyres:
Honestly, I don鈥檛 think we thought anyone was using it. 馃檪
The reason is it only tells us if --with-cuda is set at build time, but the smcuda btl could still be ejected (as defaulted in conda-forge's openmpi package: https://github.com/conda-forge/openmpi-feedstock/pull/56) and thus no CUDA awareness.
The situation becomes even more complicated when UCX is in use. As pointed out by @jsquyres, Open MPI could be built without CUDA while UCX is, and in this situation we still get CUDA awareness (but MPIX_Query_cuda_support() would return false)! For this, I am requesting the UCX side to support a runtime query (https://github.com/openucx/ucx/issues/5471), which should be incorporated here if UCX is in use by Open MPI.
In short, it would be great if Open MPI could set up a mechanism (hopefully another public API, but leave the existing MPIX_Query_cuda_support() intact to avoid confusion) for us to query, at runtime:
I hope I do not misunderstand the situation or miss any critical pieces of information. Thanks.
cc: @dalcinl
ii. When UCX is used: whether UCX has CUDA support
I didn't expect I could follow up here so quickly 馃榿 @yosefe and @bureddy kindly pointed out in https://github.com/openucx/ucx/issues/5471 that ucp_context_query() can be used to query the CUDA support from UCX, and that Open MPI already uses this API during initialization (#7898). I think we can just take the information recorded there when UCX is in use, so half of the problem is resolved!
The situation becomes even more complicated when UCX is in use. As pointed out by @jsquyres, Open MPI could be built without CUDA while UCX is, and in this situation we still get CUDA awareness (but MPIX_Query_cuda_support() would return false)!
In this case cuda awareness is partial. UCX still depends on OMPI cuda support for collectives and cuda datatype pack/unpack.
ideally, both OMPI and UCX has to build with cuda support.
@bureddy I don't know if you want to address this here or over at the UCX issue, but I think the customer ask is that MPIX_Query_cuda() be improved (or replaced with something better?). In the original discussion, two needs were identified:
Both of those can be narrowed down further, I'm sure. But the point is that the current MPIX_Query_cuda() really isn't very useful, because all it does is return a configure-time constant that indicates where Open MPI -- not even UCX -- is compiled with CUDA support or not.
You have to keep in mind that when we added that function all CUDA support was through the OB1 PML, so the answer was always correct. Now we will need to interrogate the selected PML to check if the capability is supported.