|
1 | | -# Distributed Fourier Neural Operators |
| 1 | +# ParametricDFNOs.jl |
2 | 2 |
|
3 | | -## Description |
| 3 | +[![][license-img]][license-status] |
| 4 | +[](https://github.com/slimgroup/ParametericDFNOs.jl/actions/workflows/Documenter.yml) |
| 5 | +[](https://github.com/slimgroup/ParametericDFNOs.jl/actions/workflows/TagBot.yml) |
4 | 6 |
|
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] --> |
6 | 8 |
|
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. |
9 | 10 |
|
10 | | -### Dependencies |
| 11 | +## Setup |
11 | 12 |
|
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 | + ``` |
14 | 18 |
|
15 | | -### Installing |
| 19 | +This will add `ParametricDFNOs.jl` as dependency to your project |
16 | 20 |
|
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 |
25 | 22 |
|
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)! |
27 | 24 |
|
28 | | -### Executing program on custom dataset for 2D time varying |
29 | | -1. Open `examples/training/training_2d.jl` |
| 25 | +## Issues |
30 | 26 |
|
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 |
127 | 28 |
|
128 | 29 | ## Authors |
129 | 30 |
|
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/> |
146 | 32 |
|
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 --> |
0 commit comments