Installing tensorflow for CUDA and ROCM within the same Python installation
@samfux84 You're right about the challenges. Currently ROCm and CUDA versions of TensorFlow cannot coexist side-by-side within the same Python package. Could you create separate containers for each TensorFlow version (CUDA and ROCM), then select the desired container based on their specific GPU needs. You can also refer to this [doc](https://www.tensorflow.org/guide/keras/distributed_training) on multiple GPU architectures.
Thank you! @sushreebarsa : Thank you for your reply. I somehow expected that currently it is not possible to have both packages available within one Python installation, but hoped that there is a workaround available.

A very simple solution would be if both packages (Tensorflow for CUDA and for ROCM) would have different package names. Then both packages could be installed within the same Python version.

I think that our current solution will be to have separate Python installations for CUDA and ROCM. This is not really desirable, as it duplicates the work of installing Python (and we plan to provide multiple versions of Python on our cluster).

Long term, it would be desirable to have a single tensorflow package that checks for the GPU type and then uses the appropriate code (Nvidia GPU/ AMD GPU/ Intel or AMD CPU), so that a single installation is sufficient.

Please feel free to close this ticket. @samfux84 Thank you for the response!
Closing this ticket for now. Thank you! Are you satisfied with the resolution of your issue?
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=Yes&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/64658">Yes</a>
<a href="https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPGk4kc1-qMdv3gc6bEP90vY1ew/viewform?entry.85265664=No&entry.2137816233=https://github.com/tensorflow/tensorflow/issues/64658">No</a>

Hi,

The HPC cluster of our university has both, nodes with NVIDIA GPUs and nodes with AMD GPUs (and pure CPU nodes without any GPU). Since tensorflow packages provided for CUDA and ROCM are different but have the same name, we can only install one version for each Python installation.

Is there any solution to have both versions installed for the same Python installation?

Or is there any option to have a single package that can run on CPU, NVIDIA GPUs and AMD GPUs (by detecting the GPU)? The CUDA version can for instance already detect if an NVIDIA GPU is available and will otherwise fallback to the CPU version. So the package can run either on pure CPU nodes without any GPU and also on nodes with NVIDIA GPUs.

Using venvs is not an option, as a user can only have one venv activated at a time. So if we would provide tensorflow through a venv, users could not create their own venvs any more if they would like to use tensorflow.

I guess we cannot be the only institution with this problem, so I hope there is already a solution for having both, the ROCM and CUDA version side by side or within a single Python package?

Any help is appreciated.

Best regards

Sam