The documentation for CUDA says that "Open MPI supports building with CUDA libraries and running on systems without CUDA libraries or hardware." I was expecting the same for ROCm support, but it does not seem to be the case at least for 5.0.0rc12 where even running ompi_info does not work if OpenMPI was built with ROCm, but installed on a system without ROCm:
$ ompi_info | grep "MPI extensions"
ompi_info: error while loading shared libraries: libamdhip64.so.5: cannot open shared object file: No such file or directory
It is because ompi_info links to libopen-pal.so.80 which links to libamdhip64.so.5.
It is also weird that the --with-rocm configure flag actually requires HIP (it checks for hip/hip_runtime.h and libamdhip64) which is a high-level abstraction layer for ROCm and CUDA.