torch Installation

8. torch Installation#

8.1. Windows#

8.1.1. CPU#

If you don’t have a GPU or want to install the CPU version of torch, you can install with:

install.packages("torch")

8.1.2. GPU#

Since version 0.1.1 torch supports GPU installation on Windows. In order to use GPU’s with torch you need to:

  1. Check your GPU is CUDA compatible or not, click here

  2. Install NVIDIA CUDA toolkit 11.7

    1. Installation Instruction

    2. run nvcc --version in the Command line to check the installation

    H:\>nvcc --version
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2022 NVIDIA Corporation
    Built on Tue_May__3_19:00:59_Pacific_Daylight_Time_2022
    Cuda compilation tools, release 11.7, V11.7.64
    Build cuda_11.7.r11.7/compiler.31294372_0
    
  3. Install CuDNN 8.5.0 for Windows

    1. Move it to C:\Program Files (Recommended)

    2. Add the C:\Program Files\CuDNN8.5.0\bin into System Path

  4. Once you have installed all pre-requisites you can install torch with:

    install.packages("torch")

  5. library(torch) and install additional software automatically

    1. Will get msg Additional software needs to be downloaded and installed for torch to work correctly. when first run library command

    2. Once finished, run cuda_device_count(), it returns the number of GPUs available.

      1. it should give you result 1