Skip to content

Commit

Permalink
format, docs fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nefrathenrici committed Jul 17, 2024
1 parent 3fc571c commit 92d9618
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 27 deletions.
14 changes: 8 additions & 6 deletions docs/src/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,23 @@ ClimaCalibrate.observation_map
ClimaCalibrate.get_backend
ClimaCalibrate.calibrate
ClimaCalibrate.model_run
ClimaCalibrate.module_load_string
```

## Job Scheduler
```@docs
ClimaCalibrate.wait_for_jobs
log_member_error
kill_job
job_status
ClimaCalibrate.log_member_error
ClimaCalibrate.kill_job
ClimaCalibrate.job_status
ClimaCalibrate.kwargs
ClimaCalibrate.slurm_model_run
generate_sbatch_script
submit_slurm_job
ClimaCalibrate.generate_sbatch_script
ClimaCalibrate.generate_sbatch_directives
ClimaCalibrate.submit_slurm_job
ClimaCalibrate.pbs_model_run
ClimaCalibrate.generate_pbs_script
submit_pbs_job
ClimaCalibrate.submit_pbs_job
```

## EnsembleKalmanProcesses Interface
Expand Down
2 changes: 1 addition & 1 deletion src/backends.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function get_backend()
end

"""
module_load_string(T) where {T<:Type{SlurmBackend}}
module_load_string(backend)
Return a string that loads the correct modules for a given backend when executed via bash.
"""
Expand Down
33 changes: 17 additions & 16 deletions src/pbs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function generate_pbs_script(
hpc_kwargs = Dict(),
)
member_log = path_to_model_log(output_dir, iter, member)

Check warning on line 26 in src/pbs.jl

View check run for this annotation

Codecov / codecov/patch

src/pbs.jl#L26

Added line #L26 was not covered by tests

queue = get(hpc_kwargs, :queue, "main")
walltime = format_pbs_time(get(hpc_kwargs, :time, 45))
num_nodes = get(hpc_kwargs, :ntasks, 1)
Expand All @@ -47,22 +47,23 @@ function generate_pbs_script(
total_ranks = num_nodes * ranks_per_node

Check warning on line 47 in src/pbs.jl

View check run for this annotation

Codecov / codecov/patch

src/pbs.jl#L47

Added line #L47 was not covered by tests


qsub_contents = file -> """
#!/bin/bash
#PBS -N run_$(iter)_$member
#PBS -j oe
#PBS -A UCIT0011
#PBS -q $queue
#PBS -o $member_log
#PBS -l walltime=$walltime
#PBS -l select=$num_nodes:ncpus=$cpus_per_node:ngpus=$gpus_per_node:ompthreads=1
qsub_contents =
file -> """

Check warning on line 51 in src/pbs.jl

View check run for this annotation

Codecov / codecov/patch

src/pbs.jl#L50-L51

Added lines #L50 - L51 were not covered by tests
#!/bin/bash
#PBS -N run_$(iter)_$member
#PBS -j oe
#PBS -A UCIT0011
#PBS -q $queue
#PBS -o $member_log
#PBS -l walltime=$walltime
#PBS -l select=$num_nodes:ncpus=$cpus_per_node:ngpus=$gpus_per_node:ompthreads=1
$module_load_str
$module_load_str
export CLIMACOMMS_DEVICE="$climacomms_device"
export CLIMACOMMS_CONTEXT="MPI"
\$MPITRAMPOLINE_MPIEXEC -n $total_ranks -ppn $ranks_per_node $set_gpu_rank julia --project=$experiment_dir $file
"""
export CLIMACOMMS_DEVICE="$climacomms_device"
export CLIMACOMMS_CONTEXT="MPI"
\$MPITRAMPOLINE_MPIEXEC -n $total_ranks -ppn $ranks_per_node $set_gpu_rank julia --project=$experiment_dir $file
"""

julia_script = """\

Check warning on line 68 in src/pbs.jl

View check run for this annotation

Codecov / codecov/patch

src/pbs.jl#L68

Added line #L68 was not covered by tests
import ClimaCalibrate as CAL
Expand All @@ -86,7 +87,7 @@ function pbs_model_run(
model_interface,
module_load_str;
hpc_kwargs,
debug = false
debug = false,
)
# Type and existence checks
@assert isdir(output_dir) "Output directory does not exist: $output_dir"
Expand Down
2 changes: 1 addition & 1 deletion src/slurm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function generate_sbatch_script(
$slurm_directives
$module_load_str
export CLIMACOMMS_DEVICE=$climacomms_device
export CLIMACOMMS_DEVICE="$climacomms_device"
export CLIMACOMMS_CONTEXT="MPI"
srun --output=$member_log --open-mode=append julia --project=$experiment_dir -e '
Expand Down
8 changes: 7 additions & 1 deletion test/hpc_backend_e2e.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ using Pkg;
Pkg.instantiate(; verbose = true);

import ClimaCalibrate:
get_backend, HPCBackend, JuliaBackend, calibrate, get_prior, kwargs, DerechoBackend
get_backend,
HPCBackend,
JuliaBackend,
calibrate,
get_prior,
kwargs,
DerechoBackend
using Test
import EnsembleKalmanProcesses: get_ϕ_mean_final, get_g_mean_final

Expand Down
8 changes: 6 additions & 2 deletions test/pbs_unit_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ const GPUS_PER_TASK = 2
const EXPERIMENT_DIR = "exp/dir"
const MODEL_INTERFACE = "model_interface.jl"
const MODULE_LOAD_STR = CAL.module_load_string(CAL.DerechoBackend)
const hpc_kwargs =
CAL.kwargs(time = TIME_LIMIT, ntasks = NTASKS, cpus_per_task = CPUS_PER_TASK, gpus_per_task = GPUS_PER_TASK)
const hpc_kwargs = CAL.kwargs(
time = TIME_LIMIT,
ntasks = NTASKS,
cpus_per_task = CPUS_PER_TASK,
gpus_per_task = GPUS_PER_TASK,
)

# Time formatting tests
@test CAL.format_pbs_time(TIME_LIMIT) == "01:30:00"
Expand Down

0 comments on commit 92d9618

Please sign in to comment.