diff --git a/modules/doc/content/getting_started/installation/install_libtorch.md b/modules/doc/content/getting_started/installation/install_libtorch.md index 132ca7bb1a08..9afd9a0edacc 100644 --- a/modules/doc/content/getting_started/installation/install_libtorch.md +++ b/modules/doc/content/getting_started/installation/install_libtorch.md @@ -4,7 +4,11 @@ The way one enables LibTorch [!cite](paszke2019pytorch) capabilities in MOOSE de the operating system (Linux or Mac) and if we use HPC or just a local workstation. !alert! note -Before we review the main approaches, it is important to emphasize that +Before trying to install MOOSE with libtorch make sure to check out the [compatibility matrix] +(https://github.com/pytorch/pytorch/blob/main/RELEASE.md#release-compatibility-matrix) +which will tell you if the required packages are compatible with the ones required by MOOSE. + +Furthermore, it is important to emphasize that linking MOOSE with libtorch on +Linux machines+ is not supported if the compiler stack has been built using a `libc` version below 2.27 (for `libtorch v 1.8+`) or 2.23 (for `libtorch v1.4-1.8`). Furthermore, we do not support `libtorch` versions below @@ -27,11 +31,10 @@ The user can choose from three alternatives when it comes to installing `libtorc - +Install using conda:+ - For ARM and Intel Mac workstations the user can install libtorch using conda together - with the MOOSE packages: + For ARM and Intel Mac workstations the user can install libtorch using conda within the `moose` environment: ```bash - conda create -n moose-torch moose-dev pytorch + conda install pytorch ``` This will provide the headers and libraries needed to use libtorch. @@ -39,7 +42,7 @@ The user can choose from three alternatives when it comes to installing `libtorc !alert! note The same process works for Linux workstations if the user requires CPU support only. - For notes on the GPU support, navigate to the bottom of this site. + For notes on the GPU support, [click here](gpu-notes). !alert-end! @@ -51,7 +54,7 @@ The user can choose from three alternatives when it comes to installing `libtorc ./scripts/setup_libtorch.sh ``` - which downloads `libtorch` from the official site and sets it up in the `framework\contrib` + which downloads `libtorch` from the official site and sets it up in the `framework/contrib` directory. !alert! note @@ -71,7 +74,7 @@ The user can choose from three alternatives when it comes to installing `libtorc ``` Note that we do not support `libtorch` below a version of 1.4. The default - version downloaded by the script is 1.10. + version downloaded by the script is 2.1. !alert-end! @@ -107,16 +110,20 @@ by the `setup_libtorch.sh` script. For conda-based installations the user can link to the conda-based libtorch libraries using the approach above (using a typical installation path within conda): - -./configure --with-libtorch=/yourcondadirector/mambaforge3/envs/moose-torch/lib/python3.10/site-packages/torch - ```bash -./configure --with-libtorch=${CONDA_PREFIX}/lib/python3.10/site-packages/torch +./configure --with-libtorch=${CONDA_PREFIX}/lib/python[!package!minimum_python]/site-packages/torch ``` !alert! note + The python version can be different depending on the distribution, so make sure you double-check if the directory you point to actually exists! +An easy way to find if the library exists within the conda package is running the following command in the terminal: + +```bash +find ${CONDA_PREFIX} -type d -name torch +``` + !alert-end! ## Build MOOSE with libtorch @@ -137,7 +144,7 @@ serves as a good example on how to achieve this for applications. !alert-end! -## GPU Support +## GPU Support id=gpu-notes When using ARM Macs the conda-based installation supports both CPU and GPU devices. For GPU acceleration through Metal, users need to select MPS as a device when writing source code.