Installing both tensorflow and pytorch with gpu support

hello.

i want to install both tf and pt on my rtx 3060 laptop, with windows 10. but i don’t know the most efficient approach to achieve this goal. there are three approaches that come to my mind:

  1. first i go to this link and check for cuda and cudnn versions. i install cuda 11.2 and cudnn 8.1 locally (after downloading the respective files from their sources from nvidia). then, i go here and check for versions. i choose cuda 11.3 and pip install with this command:
    pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
    will my laptop run both tf and pt packages on gpu? do i have to install cuda 11.3 with pip install command for pytorch?

  2. i pip install pytorch with the help of the command above. if i do this, how am i going to install tf?

something to note here. i don’t want to have multiple cuda versions. i want one version which both tf and pt support it. please help me install both these packages with gpu support efficiently. because i don’t know how to install.

thank you very much.

This might not be possible if you install the pre-built binaries as it depends how each framework uses the CUDA runtime.
E.g. the PyTorch binaries ship with their own CUDA runtime, which you are selecting during the install process. If you are installing the pip wheels, the PyTorch lib folder will ship with all ibraries while the conda binaries will install the cudatoolkit or cuda conda package. If TF provides conda binaries with the same dependency, both frameworks might be able to share these libs.
However, I also don’t know if TF actually ships with the CUDA runtime or if your system libraries will be used.

If you really depend on the same CUDA toolkit/runtime for both frameworks, the best approach might be to install a CUDA toolkit locally (you wouldn’t need to do it to run PyTorch-only) and build both frameworks from source.

thank you for your response.
so should i install cuda 11.3 with pip command while installing pt after installing cuda 11.2 for tf?