Skip to content

Commit ef1181c

Browse files
Added documentation (#5)
added documentation --------- Co-authored-by: turquoisedragon2926 <rarockiasamy3@gatech.edu>
1 parent a96bac0 commit ef1181c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1704
-590
lines changed

.github/workflows/Documenter.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ jobs:
1313
- uses: julia-actions/setup-julia@latest
1414
with:
1515
version: '1.9.4'
16+
- name: Set up Python
17+
uses: actions/setup-python@v2
18+
with:
19+
python-version: '3.x' # Ensures that Python 3.x is used
20+
- name: Install Python dependencies
21+
run: python3 -m pip install matplotlib
1622
- name: Install dependencies
1723
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
1824
- name: Build and deploy

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ movies/
1414
utilites/
1515
notes.md
1616
Manifest.toml
17+
!logo.png

Project.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ version = "2.0.2"
55

66
[deps]
77
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
8-
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
9-
DocumenterTools = "35a29f4d-8980-5a13-9543-d66fff28ecb8"
108
DrWatson = "634d3b9d-ee7a-5ddf-bec9-22491ea816e1"
119
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
1210
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"

README.md

Lines changed: 22 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -1,147 +1,36 @@
1-
# Distributed Fourier Neural Operators
1+
# ParametricDFNOs.jl
22

3-
## Description
3+
[![][license-img]][license-status]
4+
[![Documenter](https://github.com/slimgroup/ParametericDFNOs.jl/actions/workflows/Documenter.yml/badge.svg)](https://github.com/slimgroup/ParametericDFNOs.jl/actions/workflows/Documenter.yml)
5+
[![TagBot](https://github.com/slimgroup/ParametericDFNOs.jl/actions/workflows/TagBot.yml/badge.svg)](https://github.com/slimgroup/ParametericDFNOs.jl/actions/workflows/TagBot.yml)
46

5-
The Fourier Neural Operator (FNO) is a neural network designed to approximate solutions to partial differential equations (PDEs), specifically for two-phase flows such as CO2 plume evolution in carbon capture and storage (CCS) processes, atmospheric fields, etc. By transforming inputs to frequency space using spectral convolution operators and leveraging the efficiency of Fourier transforms, FNOs offer a significant speed-up in simulation times compared to traditional methods. This project involves extending FNOs to operate in a distributed fashion for handling large-scale, realistic three-dimensional two-phase flow problems.
7+
<!-- [![][zenodo-img]][zenodo-status] -->
68

7-
We offer support for distributed 2D and 3D time varying problems.
8-
## Getting Started
9+
`ParametricDFNOs.jl` is a Julia Language-based scientific library designed to facilitate training Fourier Neural Operators involving large-scale data using [`ParametricOperators.jl`](https://github.com/slimgroup/ParametricOperators.jl). We offer support for distributed 2D and 3D time varying problems.
910

10-
### Dependencies
11+
## Setup
1112

12-
- `Julia 1.8.5`
13-
- MPI distribution.
13+
```julia
14+
julia> using Pkg
15+
julia> Pkg.activate("path/to/your/environment")
16+
julia> Pkg.add("ParametricDFNOs")
17+
```
1418

15-
### Installing
19+
This will add `ParametricDFNOs.jl` as dependency to your project
1620

17-
```
18-
git clone https://github.com/turquoisedragon2926/dfno.git
19-
cd dfno
20-
julia
21-
> ] instantiate .
22-
> using MPI
23-
> MPI.install_mpiexecjl()
24-
```
21+
## Documentation
2522

26-
NOTE: Add mpiexecjl to your PATH
23+
Check out the [Documentation](https://slimgroup.github.io/ParametricDFNOs.jl) for more or get started by running some [examples](https://github.com/turquoisedragon2926/ParametricDFNOs.jl-Examples)!
2724

28-
### Executing program on custom dataset for 2D time varying
29-
1. Open `examples/training/training_2d.jl`
25+
## Issues
3026

31-
2. Update data reading function.
32-
33-
* We have provided a wrapper for distributed reading if you do not have a data reading function set up. In order to use this, implement the following two functions:
34-
35-
```
36-
function dist_read_x_tensor(file_name, key, indices)
37-
data = nothing
38-
h5open(file_name, "r") do file
39-
dataset = file[key]
40-
data = dataset[indices...]
41-
end
42-
return reshape(data, 1, (size(data)...))
43-
end
44-
```
45-
46-
```
47-
function dist_read_y_tensor(file_name, key, indices)
48-
data = nothing
49-
h5open(file_name, "r") do file
50-
dataset = file[key]
51-
data = dataset[indices...]
52-
end
53-
return reshape(data, 1, (size(data)...))
54-
end
55-
```
56-
57-
* See `examples/perlmutter/data.jl` on example for how to use this for even cases where your samples are stored across multiple files.
58-
59-
3. Pass required hyperparams following the ModelConfig:
60-
61-
* Line to modify:
62-
63-
```
64-
modelConfig = DFNO_2D.ModelConfig(nblocks=4, partition=partition)
65-
```
66-
67-
* Options:
68-
```
69-
struct ModelConfig
70-
nx::Int = 64
71-
ny::Int = 64
72-
nt::Int = 51
73-
nc_in::Int = 4
74-
nc_mid::Int = 128
75-
nc_lift::Int = 20
76-
nc_out::Int = 1
77-
mx::Int = 8
78-
my::Int = 8
79-
mt::Int = 4
80-
nblocks::Int = 4
81-
dtype::DataType = Float32
82-
partition::Vector{Int} = [1, 4]
83-
end
84-
```
85-
86-
4. Modify parameters to train config based on requirement:
87-
88-
* Line to modify:
89-
```
90-
trainConfig = DFNO_2D.TrainConfig(
91-
epochs=200,
92-
x_train=x_train,
93-
y_train=y_train,
94-
x_valid=x_valid,
95-
y_valid=y_valid,
96-
)
97-
```
98-
99-
* Options:
100-
```
101-
struct TrainConfig
102-
nbatch::Int = 2
103-
epochs::Int = 1
104-
seed::Int = 1234
105-
plot_every::Int = 1
106-
learning_rate::Float32 = 1f-4
107-
x_train::Any
108-
y_train::Any
109-
x_valid::Any
110-
y_valid::Any
111-
end
112-
```
113-
114-
5. Execute the program with number of required workers
115-
116-
```
117-
mpiexecjl --project=./ -n 4 julia examples/training/training_2d.jl
118-
```
119-
120-
## Help
121-
122-
Common problems or issues.
123-
124-
```
125-
This section will be updated with common issues and fixes
126-
```
27+
This section will contain common issues and corresponding fixes. Currently, we only provide support for Julia-1.9
12728

12829
## Authors
12930

130-
[Richard Rex](https://www.linkedin.com/in/richard-rex/) - Georgia Institute of Technology
131-
132-
## Version History
133-
134-
* v2.0.0
135-
* Various bug fixes and memory optimizations
136-
* Ability to scale to $512^3$ across 500 GPUs
137-
138-
* v1.0.0
139-
* Initial working DFNO
140-
141-
## License
142-
143-
This project is licensed under the Creative Commons License - see the LICENSE.md file for details
144-
145-
## Acknowledgments
31+
Richard Rex, [richardr2926@gatech.edu](mailto:richardr2926@gatech.edu) <br/>
14632

147-
This research was carried out with the support of Georgia Research Alliance, Extreme Scale Solutions and partners of the ML4Seismic Center.
33+
[license-status]:LICENSE
34+
<!-- [zenodo-status]:https://doi.org/10.5281/zenodo.6799258 -->
35+
[license-img]:http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat?style=plastic
36+
<!-- [zenodo-img]:https://zenodo.org/badge/DOI/10.5281/zenodo.3878711.svg?style=plastic -->

docs/make.jl

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,23 @@ using ParametricDFNOs
33

44
makedocs(
55
sitename = "ParametricDFNOs.jl",
6+
doctest=false, clean=true,
7+
authors="Richard Rex",
68
format = Documenter.HTML(),
7-
# modules = [ParametricOperators],
9+
modules = [ParametricDFNOs],
810
pages=[
911
"Introduction" => "index.md",
1012
"Quick Start" => "quickstart.md",
11-
"Distribution" => "distribution.md",
1213
"Examples" => [
13-
"3D FFT" => "examples/3D_FFT.md",
14-
"Distributed 3D FFT" => "examples/3D_DFFT.md",
15-
"3D Conv" => "examples/3D_Conv.md",
16-
"Distributed 3D Conv" => "examples/3D_DConv.md",
14+
"2D Forward and Gradient" => "examples/simple_2D.md",
15+
"2D Training" => "examples/training_2D.md",
16+
"3D Forward and Gradient" => "examples/simple_3D.md",
17+
"3D Custom Dataset" => "examples/custom_3D.md",
1718
],
18-
"API" => "api.md",
19+
"API" => [
20+
"2D Time varying" => "api/DFNO_2D.md",
21+
"3D Time varying" => "api/DFNO_3D.md",
22+
"Utilites" => "api/UTILS.md",],
1923
"Future Work" => "future.md",
2024
"Citation" => "citation.md"
2125
]
@@ -24,6 +28,8 @@ makedocs(
2428
# Automatically deploy documentation to gh-pages.
2529
deploydocs(
2630
repo = "github.com/slimgroup/ParametricDFNOs.jl.git",
31+
push_preview=true,
2732
devurl = "dev",
28-
devbranch = "release",
33+
devbranch = "master",
34+
versions = ["dev" => "dev", "stable" => "v^"],
2935
)

docs/src/api.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/src/api/DFNO_2D.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# 2D Time varying FNO
2+
3+
!!! tip "2D Time varying"
4+
The implementation allows for discretization along time dimension to be 1 (only 1 time step). But you can also treat time as any other dimension, so this could also be as a generic 3D FNO
5+
6+
## 2D Model
7+
8+
```@autodocs
9+
Modules = [ParametricDFNOs.DFNO_2D]
10+
Order = [:type, :function]
11+
Pages = ["model.jl"]
12+
```
13+
14+
## 2D Forward Pass
15+
16+
```@autodocs
17+
Modules = [ParametricDFNOs.DFNO_2D]
18+
Order = [:type, :function]
19+
Pages = ["forward.jl"]
20+
```
21+
22+
## 2D Training
23+
24+
```@autodocs
25+
Modules = [ParametricDFNOs.DFNO_2D]
26+
Order = [:type, :function]
27+
Pages = ["train.jl"]
28+
```
29+
30+
## 2D Data Loading
31+
32+
!!! warning "Critical component"
33+
See [Data Partitioning](@ref) for instructions on how to set it up properly.
34+
35+
```@autodocs
36+
Modules = [ParametricDFNOs.DFNO_2D]
37+
Order = [:type, :function]
38+
Pages = ["data.jl"]
39+
```
40+
41+
```@autodocs
42+
Modules = [ParametricDFNOs.DFNO_2D.UTILS]
43+
Order = [:type, :function]
44+
Pages = ["utils.jl"]
45+
```
46+
47+
## 2D Plotting
48+
49+
```@autodocs
50+
Modules = [ParametricDFNOs.DFNO_2D]
51+
Order = [:type, :function]
52+
Pages = ["plot.jl"]
53+
```
54+
55+
## 2D Checkpoints
56+
57+
```@autodocs
58+
Modules = [ParametricDFNOs.DFNO_2D]
59+
Order = [:type, :function]
60+
Pages = ["weights.jl"]
61+
```

docs/src/api/DFNO_3D.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# 3D Time varying FNO
2+
3+
!!! tip "3D Time varying"
4+
The implementation allows for discretization along time dimension to be 1 (only 1 time step). But you can also treat time as any other dimension, so this could also be as a generic 4D FNO
5+
6+
## 3D Model
7+
8+
```@autodocs
9+
Modules = [ParametricDFNOs.DFNO_3D]
10+
Order = [:type, :function]
11+
Pages = ["model.jl"]
12+
```
13+
14+
## 3D Forward Pass
15+
16+
```@autodocs
17+
Modules = [ParametricDFNOs.DFNO_3D]
18+
Order = [:type, :function]
19+
Pages = ["forward.jl"]
20+
```
21+
22+
## 3D Training
23+
24+
```@autodocs
25+
Modules = [ParametricDFNOs.DFNO_3D]
26+
Order = [:type, :function]
27+
Pages = ["train.jl"]
28+
```
29+
30+
## 3D Data Loading
31+
32+
!!! warning "Critical component"
33+
See [Data Partitioning](@ref) for instructions on how to set it up properly.
34+
35+
```@autodocs
36+
Modules = [ParametricDFNOs.DFNO_3D]
37+
Order = [:type, :function]
38+
Pages = ["data.jl"]
39+
```
40+
41+
!!! tip "Distributed read for complex storage scenarios"
42+
View [Custom 3D Time varying FNO](@ref) for an example of how you can extend this distributed read to a complex storage scheme.
43+
44+
```@autodocs
45+
Modules = [ParametricDFNOs.DFNO_3D.UTILS]
46+
Order = [:type, :function]
47+
Pages = ["utils.jl"]
48+
```
49+
50+
## 3D Plotting
51+
52+
```@autodocs
53+
Modules = [ParametricDFNOs.DFNO_3D]
54+
Order = [:type, :function]
55+
Pages = ["plot.jl"]
56+
```
57+
58+
## 3D Checkpoints
59+
60+
```@autodocs
61+
Modules = [ParametricDFNOs.DFNO_3D]
62+
Order = [:type, :function]
63+
Pages = ["weights.jl"]
64+
```

docs/src/api/UTILS.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Utilities
2+
3+
!!! note "Distributed Loss Function"
4+
We provide a distributed relative L2 loss but most distributed loss functions should be straight-forward to build with [`ParametricOperators.jl`](https://github.com/slimgroup/ParametricOperators.jl)
5+
6+
```@autodocs
7+
Modules = [ParametricDFNOs.UTILS]
8+
Order = [:type, :function]
9+
Pages = ["utils.jl"]
10+
```
11+
12+
### GPU Helpers
13+
14+
```@autodocs
15+
Modules = [ParametricDFNOs.DFNO_2D]
16+
Order = [:type, :function]
17+
Pages = ["DFNO_2D.jl"]
18+
```
19+
20+
```@autodocs
21+
Modules = [ParametricDFNOs.DFNO_3D]
22+
Order = [:type, :function]
23+
Pages = ["DFNO_3D.jl"]
24+
```

docs/src/assets/logo.png

806 KB
Loading

0 commit comments

Comments
 (0)