-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restart capability and offline FOM interface (#9)
* restart capability * run_samples and collect_samples workflow. * pick_samples workflow and factorizing train/greedy sampling. * burgers1d.ipynb has the entire workflow now. * update README with prerequisites. * offline fom wrapper * offline bash script example * separate param_space from physics. * offline fom export * template for prototyping. * refactored between picksample and runsample.
- Loading branch information
1 parent
abda363
commit d484837
Showing
16 changed files
with
1,244 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/bash | ||
|
||
check_result () { | ||
# $1: Result output of the previous command ($?) | ||
# $2: Name of the previous command | ||
if [ $1 -eq 0 ]; then | ||
echo "$2 succeeded" | ||
else | ||
echo "$2 failed" | ||
exit -1 | ||
fi | ||
} | ||
|
||
# First stage will be PickSample, which will produce parameter point files in hdf5 format. | ||
# Each lasdi command will save a restart file, which will be read on the next lasdi command. | ||
# So all stages are run by the same command, directed differently by the restart file. | ||
lasdi burgers1d.offline.yml | ||
check_result $? initial-picksample | ||
|
||
# Run/save FOM solution with offline FOM solver. | ||
burgers1d burgers1d.offline.yml | ||
check_result $? initial-runsample | ||
|
||
# Collect FOM solution. | ||
lasdi burgers1d.offline.yml | ||
check_result $? initial-collect | ||
|
||
# Train latent dynamics model. | ||
lasdi burgers1d.offline.yml | ||
check_result $? initial-train | ||
|
||
for k in {0..8} | ||
do | ||
# Pick a new sample from greedy sampling | ||
lasdi burgers1d.offline.yml | ||
check_result $? pick-sample | ||
|
||
# A cycle of offline FOM/CollectSamples | ||
burgers1d burgers1d.offline.yml | ||
check_result $? run-sample | ||
|
||
lasdi burgers1d.offline.yml | ||
check_result $? collect-sample | ||
|
||
# Train latent dynamics model. | ||
lasdi burgers1d.offline.yml | ||
check_result $? train | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
lasdi: | ||
type: gplasdi | ||
gplasdi: | ||
# device: mps | ||
n_samples: 20 | ||
lr: 0.001 | ||
max_iter: 2000 | ||
n_iter: 200 | ||
max_greedy_iter: 2000 | ||
ld_weight: 0.1 | ||
coef_weight: 1.e-6 | ||
path_checkpoint: checkpoint | ||
path_results: results | ||
|
||
workflow: | ||
use_restart: true | ||
restart_file: restarts/burgers1d.restart.npy | ||
offline_greedy_sampling: | ||
train_param_file: sampling/new_train.burgers1d.h5 | ||
test_param_file: sampling/new_test.burgers1d.h5 | ||
train_sol_file: sampling/new_Xtrain.burgers1d.h5 | ||
test_sol_file: sampling/new_Xtest.burgers1d.h5 | ||
|
||
parameter_space: | ||
parameters: | ||
- name: a | ||
min: 0.7 | ||
max: 0.9 | ||
test_space_type: uniform | ||
sample_size: 11 | ||
log_scale: false | ||
- name: w | ||
min: 0.9 | ||
max: 1.1 | ||
test_space_type: uniform | ||
sample_size: 11 | ||
log_scale: false | ||
test_space: | ||
type: grid | ||
|
||
latent_space: | ||
type: ae | ||
ae: | ||
hidden_units: [100] | ||
latent_dimension: 5 | ||
|
||
latent_dynamics: | ||
type: sindy | ||
sindy: | ||
fd_type: sbp12 | ||
coef_norm_order: fro | ||
|
||
physics: | ||
type: burgers1d | ||
burgers1d: | ||
offline_driver: true | ||
number_of_timesteps: 1001 | ||
simulation_time: 1. | ||
grid_size: [1001] | ||
xmin: -3. | ||
xmax: 3. |
Oops, something went wrong.