Skip to content

Commit

Permalink
Address reviewer comments. (idaholab#27688)
Browse files Browse the repository at this point in the history
  • Loading branch information
grmnptr committed May 22, 2024
1 parent e8990bb commit f1108f3
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -27,19 +31,18 @@ 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.

!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!

Expand All @@ -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
Expand All @@ -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!

Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down

0 comments on commit f1108f3

Please sign in to comment.