-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nathanael Efrat-Henrici
committed
Oct 27, 2023
1 parent
d999e75
commit a26f63a
Showing
9 changed files
with
165 additions
and
658 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,51 @@ | ||
#!/bin/bash | ||
#SBATCH --time=24:00:00 | ||
#SBATCH --job-name=cal-job-array | ||
#SBATCH --ntasks=40 | ||
#SBATCH --cpus-per-task=8 | ||
#SBATCH --mem-per-cpu=8G | ||
#SBATCH --output=calibration-job_array-%j.out | ||
#SBATCH --mail-user=nat.henrici@gmail.com | ||
#SBATCH --mail-type=BEGIN,END,FAIL | ||
|
||
# Load required modules | ||
module load julia/1.9.3 cuda/12.2 ucx/1.14.1_cuda-12.2 openmpi/4.1.5_cuda-12.2 hdf5/1.12.2-ompi415 | ||
export OMPI_MCA_opal_warn_on_missing_libcuda=0 | ||
|
||
# Check if a job ID is provided as a command-line argument | ||
job_id=${1?Error: no job ID given} | ||
echo "Running job: $job_id" | ||
|
||
# Instantiate the Julia project | ||
julia --project=examples -e 'using Pkg; Pkg.instantiate(;verbose=true)' | ||
|
||
echo 'Initializing ensemble for calibration.' | ||
|
||
julia --project=examples -e " | ||
import CalibrateAtmos | ||
using Distributions | ||
using EnsembleKalmanProcesses.ParameterDistributions | ||
CalibrateAtmos.initialize(\"$job_id\")" | ||
|
||
# Get ensemble size and the number of iterations from configuration file | ||
ensemble_size=$(grep "ensemble_size:" examples/$job_id/ekp_config.yml | awk '{print $2}') | ||
n_iterations=$(grep "n_iterations:" examples/$job_id/ekp_config.yml | awk '{print $2}') | ||
|
||
# Loop over iterations | ||
# tasks_per_task=$(( $ensemble_size / $SLURM_NTASKS )) | ||
tasks_per_task=4 | ||
dep="" | ||
for i in $(seq 0 $n_iterations) | ||
do | ||
echo "Scheduling Iteration $i" | ||
echo "Dep for model run iter $i: $dep" | ||
|
||
ensemble_array_id=$(sbatch --dependency=$dep --parsable --job=model-$i --ntasks=$tasks_per_task --array=1-$ensemble_size examples/model_run.sbatch $job_id $i) | ||
dep="afterany:$ensemble_array_id" | ||
echo "Dep for update at iter $i: $dep" | ||
format_i=$(printf "iteration_%03d" "$i") | ||
|
||
update_id=$(sbatch --dependency=$dep --job=update-$i --output=output/$job_id/$format_i/update_log.out --parsable examples/update.sbatch $job_id $i) | ||
dep="afterany:$update_id" | ||
echo "ekp update job $i: $update_id" | ||
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
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,23 @@ | ||
#!/bin/bash | ||
#SBATCH --time=24:00:00 | ||
|
||
# Extract command-line arguments | ||
job_id=$1 | ||
iteration=$2 | ||
|
||
# Print job information | ||
current_time=$(date +"%Y-%m-%d %H:%M:%S") | ||
echo "Current timestamp: $current_time" | ||
echo "Running job: $job_id" | ||
echo "Iteration $iteration, Member $SLURM_ARRAY_TASK_ID" | ||
|
||
format_i=$(printf "iteration_%03d" "$iteration") | ||
member=$(printf "member_%03d" "$SLURM_ARRAY_TASK_ID") | ||
# Run the forward model | ||
srun --output=output/$job_id/$format_i/$member/model_log.out julia --project=examples -e " | ||
using ClimaComms | ||
println(ClimaComms.init(ClimaComms.context())) | ||
import CalibrateAtmos | ||
atmos_config = CalibrateAtmos.get_atmos_config($SLURM_ARRAY_TASK_ID, $iteration, \"$job_id\") | ||
CalibrateAtmos.run_forward_model(atmos_config) | ||
" |
12 changes: 9 additions & 3 deletions
12
examples/sphere_held_suarez_rhoe_equilmoist/atmos_config.yml
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 |
---|---|---|
@@ -1,10 +1,16 @@ | ||
dt: 200secs | ||
t_end: 800days | ||
t_end: 560days | ||
ode_algo: ARS343 | ||
dt_save_to_disk: 5hours | ||
dt_save_to_disk: 50days | ||
moist: equil | ||
forcing: held_suarez | ||
precip_model: 0M | ||
job_id: sphere_held_suarez_rhoe_equilmoist | ||
output_dir: output/sphere_held_suarez_rhoe_equilmoist | ||
restart_file: examples/sphere_held_suarez_rhoe_equilmoist/day200.0.hdf5 | ||
restart_file: examples/sphere_held_suarez_rhoe_equilmoist/day200.0.hdf5 | ||
output_default_diagnostics: false | ||
diagnostics: | ||
- reduction_time: average | ||
short_name: ta | ||
period: 60days | ||
writer: nc |
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,16 @@ | ||
#!/bin/sh | ||
#SBATCH --time=01:00:00 | ||
|
||
job_id=$1 | ||
i=$2 | ||
|
||
current_time=$(date +"%Y-%m-%d %H:%M:%S") | ||
echo "Current timestamp: $current_time" | ||
echo "Iteration $i" | ||
|
||
julia --project=examples -e ' | ||
import CalibrateAtmos | ||
include("examples/'$job_id'/observation_map.jl") | ||
observation_map('$i', "'$job_id'") | ||
CalibrateAtmos.update_ensemble("'${job_id}'", '$i') | ||
' |
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