Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ford
pip install --group docs

- name: Build docs with FORD
run: ford FTorch.md
Expand Down Expand Up @@ -109,7 +109,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ford
pip install --group docs

- name: Build docs with FORD
run: ford FTorch.md
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preprocessing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
python-version: '3.13' # Use 3.13 as no PyTorch wheels for 3.14 yet.

- name: Install fypp, the Fortran pre-processor
run: pip install fypp
run: pip install --group preproc

- name: Check ftorch_tensor.fypp matches ftorch_tensor.f90
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
python -m pip install --upgrade pip
python -m venv ../ftorch_venv
. ../ftorch_venv/bin/activate
pip install .[dev] --extra-index-url https://download.pytorch.org/whl/cpu
pip install . --extra-index-url https://download.pytorch.org/whl/cpu --group lint

# Run CMake build to get compile commands for clang
- name: FTorch CMake
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_macos_cpu_clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
python -m pip install --upgrade pip
python -m venv ftorch
. ftorch/bin/activate
pip install . --extra-index-url https://download.pytorch.org/whl/cpu
pip install . --extra-index-url https://download.pytorch.org/whl/cpu --group test

- name: Install gfortran and OpenMPI
# Install from source to avoid compiler mismatch between gfortran versions
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_ubuntu_cpu_gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ jobs:
python -m pip install --upgrade pip
python -m venv ftorch
. ftorch/bin/activate
pip install . --extra-index-url https://download.pytorch.org/whl/cpu
pip install . --extra-index-url https://download.pytorch.org/whl/cpu --group test

- name: Install OpenMPI
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_ubuntu_cpu_intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
python -m pip install --upgrade pip
python -m venv ftorch
. ftorch/bin/activate
pip install . --extra-index-url https://download.pytorch.org/whl/cpu
pip install . --extra-index-url https://download.pytorch.org/whl/cpu --group test

- name: Install Intel tools
uses: rscohn2/setup-oneapi@a5ae4e7697b9cd5dc8a616f94c1e56b87140999d
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_ubuntu_cuda_gnu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ jobs:
. ftorch/bin/activate
# CUDA v12.9 chosen as latest supported by PyTorch
# Check this is <= what GPU-runner has installed (backwards compatible)
pip install . --extra-index-url https://download.pytorch.org/whl/cu129
pip install . --extra-index-url https://download.pytorch.org/whl/cu129 --group test

- name: Install cmake and NVIDIA dev toolkit
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_suite_windows_cpu_intel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
pip install --upgrade pip
python -m venv ftorch
call ftorch\Scripts\activate
pip install .
pip install . --group test

- name: Build FTorch
shell: cmd
Expand Down
2 changes: 1 addition & 1 deletion codespace/build_FTorch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
python3 -m venv venv
# shellcheck source=/dev/null
source venv/bin/activate
pip install . --extra-index-url https://download.pytorch.org/whl/cpu
pip install . --extra-index-url https://download.pytorch.org/whl/cpu --group examples

# Extract the location of the installed packages in the venv
# This is typically `FTorch/build/venv/lib/python3.xx/site-packages/`
Expand Down
2 changes: 1 addition & 1 deletion examples/01_Tensor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To run this example requires:
## Running

To run this example, first install FTorch as described in the main
documentation.
documentation, making use of the `examples` dependency group.

To compile the Fortran code, using the included `CMakeLists.txt`, execute the
following code:
Expand Down
9 changes: 2 additions & 7 deletions examples/02_SimpleNet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation.
Then from this directory create a virtual environment and install the necessary Python
modules:
```
python3 -m venv venv
source venv/bin/activate
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

You can check that everything is working by running `simplenet.py`:
```
Expand Down
9 changes: 2 additions & 7 deletions examples/03_ResNet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation.
Then from this directory create a virtual environment an install the neccessary Python
modules:
```
python3 -m venv venv
source venv/bin/activate
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

You can check that everything is working by running `resnet18.py`:

Expand Down
9 changes: 2 additions & 7 deletions examples/05_MultiIO/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation. Then
from this directory create a virtual environment and install the necessary
Python modules:
```
python3 -m venv venv
source venv/bin/activate
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

You can check everything is working by running `multiionet.py`:
```
Expand Down
9 changes: 2 additions & 7 deletions examples/06_Looping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation. Then
from this directory create a virtual environment and install the necessary
Python modules:
```
python3 -m venv venv
source venv/bin/activate
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

You can check everything is working by running `simplenet.py`:
```
Expand Down
8 changes: 2 additions & 6 deletions examples/07_MultiGPU/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation. Then from
this directory create a virtual environment and install the necessary Python modules:
```
python3 -m venv venv
source venv/bin/activate
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

You can check that everything is working by running `simplenet.py`:
```
Expand Down
3 changes: 0 additions & 3 deletions examples/08_MPI/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ if(NOT DEFINED ENV{VIRTUAL_ENV} AND NOT DEFINED ENV{CONDA_PREFIX})
message(FATAL_ERROR "Please activate your virtualenv or conda environment")
endif()

# Install Python dependencies
execute_process(COMMAND ${Python_EXECUTABLE} -m pip install mpi4py)

# Fortran example
add_executable(mpi_infer_fortran mpi_infer_fortran.f90)
target_link_libraries(mpi_infer_fortran PRIVATE FTorch::ftorch)
Expand Down
10 changes: 2 additions & 8 deletions examples/08_MPI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation. Then
from this directory create a virtual environment and install the necessary
Python modules:
```
python3 -m venv venv
source venv/bin/activate
pip install mpi4py
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

You can check the network is set up correctly by running `simplenet.py`:
```
Expand Down
9 changes: 2 additions & 7 deletions examples/09_Autograd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation.
Then from this directory create a virtual environment and install the necessary
Python modules:
```
python3 -m venv venv
source venv/bin/activate
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

### Tensor manipulation demo

Expand Down
10 changes: 2 additions & 8 deletions examples/10_Optimizers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,8 @@ To run this example requires:

## Running

To run this example install FTorch as described in the main documentation.
Then from this directory create a virtual environment and install the necessary
Python modules:
```
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
To run this example, first install FTorch as described in the main
documentation, making use of the `examples` dependency group.

Run the Python version of the demo with
```
Expand Down
7 changes: 5 additions & 2 deletions pages/developer/developer.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ expected for submissions.
### Developer requirements

Development tools for [pre-processing](#fortran-source-and-fypp),
[code styling](#code-style) etc. are pip-installable using the
[code styling](#code-style) etc. are pip-installable using the `dev` dependency
group in the
[pyproject.toml file](https://github.com/Cambridge-ICCS/FTorch/blob/main/pyproject.toml):
```sh
pip install .[dev]
pip install . --group dev
```
This pulls in the packages in the `docs`, `lint`, `preproc`, and `test`
dependency groups, which can also be used individually.

In order to streamline the process of uploading we provide a pre-commit hook in
[`.githooks/pre-commit`](https://github.com/Cambridge-ICCS/FTorch/blob/main/.githooks/pre-commit).
Expand Down
18 changes: 12 additions & 6 deletions pages/installation/general.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ For instructions on how to install PyTorch, TorchVision, and NumPy, see the
If LibTorch is not installed then FTorch requires PyTorch to be installed.
FTorch's `pt2ts` utility script has PyTorch as a hard requirement, as well as
the `ftorch_utils` Python module included in the FTorch repo. To install
PyTorch, `ftorch_utils`, and the additional dependencies (TorchVision and NumPy)
of FTorch's examples suite, run
PyTorch and `ftorch_utils`, run
```sh
pip install . --extra-index-url <pytorch-wheel-download-url>
```
where `<pytorch-wheel-download-url>` is determined based on the
[matrix](https://pytorch.org/get-started/locally/) on the PyTorch website.

We recommend also installing the additional dependencies for FTorch's examples
(TorchVision, NumPy, matplotlib, and mpi4py) in the same command. This can be
achieved by including the `examples` dependency group, as follows:
```sh
pip install . --extra-index-url <pytorch-wheel-download-url> --group examples
```

If you don't want to install `ftorch_utils` then you can install FTorch's
`torch` and `torchvision` dependencies using
```sh
Expand All @@ -51,10 +57,10 @@ pip install torch torchvision --index-url <pytorch-wheel-download-url>

@note
We recommend installing `torch` and `torchvision` in the same command such as
would be done in the secon command above. Doing so ensures that they are
configured in the same way. If you have installed the `ftorch_utils` module as
in the first command above then there is no need to worry about this because
they are both included as dependencies.
would be done in the third command above. Doing so ensures that they are
configured in the same way. If you have installed the `ftorch_utils` module with
the `examples` dependency group as in the second command above then there is no
need to worry about this because they are both included as dependencies.
@endnote

#### Additional dependencies of the test suite
Expand Down
5 changes: 3 additions & 2 deletions pages/installation/gpu.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ HIP with a LibTorch binary.

#### Installation using pip

To install `ftorch_utils` and its dependencies with GPU support, use
To install `ftorch_utils`, its dependencies, and the additional dependencies
for the examples with GPU support, use
```sh
pip install . --extra-index-url <pytorch-wheel-download-url>
pip install . --extra-index-url <pytorch-wheel-download-url> --group examples
```
or to install `torch` and `torchvision` directly use
```sh
Expand Down
2 changes: 1 addition & 1 deletion pages/installation/systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ rem Activate the virtual environment
call .ftorch\Scripts\activate

rem Install dependencies (--extra-index-url not required on Windows)
pip install .
pip install . --group examples

rem Enable output
ECHO ON
Expand Down
29 changes: 19 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,35 @@ keywords = [
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Fortran",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
]
dependencies = [
"matplotlib",
"numpy",
"torch",
"torchvision",
]
dependencies = ["torch"]
Comment thread
jatkinson1000 marked this conversation as resolved.
Outdated

[project.optional-dependencies]
dev = [
[dependency-groups]
Comment thread
jatkinson1000 marked this conversation as resolved.
examples = ["matplotlib", "mpi4py", "numpy", "torchvision"]
test = [
"pytest",
{include-group = "examples"},
]
docs = ["ford>=7.0.13"]
lint = [
"clang-format==19.1.3",
"clang-tidy==19.1.0",
"cmakelang",
"ford>=7.0.13",
"fortitude-lint==0.7.0",
"fypp==3.2",
"ruff==0.7.3",
]
preproc = ["fypp==3.2"]
dev = [
{include-group = "docs"},
{include-group = "lint"},
{include-group = "preproc"},
{include-group = "test"},
]

[project.scripts]
pt2ts = "ftorch_utils.pt2ts:main_cli"
Expand Down
Loading