Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How are we doing ensembles? #84

Open
ljwolf opened this issue Nov 26, 2024 · 0 comments
Open

How are we doing ensembles? #84

ljwolf opened this issue Nov 26, 2024 · 0 comments

Comments

@ljwolf
Copy link
Contributor

ljwolf commented Nov 26, 2024

# object-oriented
my_model = create_NPZD_model(
    ...
)

my_ensemble = [
    revise_model(my_model, :min_growth, 8 + normal(0, .1))
    for _ in range(1000)
]

respec_* # create a copy with an adjusted set of attributes

respec(my_model, :field, value)

respec_phyto_args(my_model, 
    :field, value
)

my_sNPZD = respec(
    my_model,
    :predation_function,
    my_exotic_random_predation_function
)

# this operates in place
set!(my_model, :field, value)

## Alternativey hard-coded random initial states can be used, too, to set up an ensemble

my_ensemble = [
    create_NPZD_model(
    phyto_args = Dict(
        "min_growth" => 8 + normal(0,.1)
    )
    ...
) for _ in range(100)
]

my_ensemble_job = agate_ensemble(
    my_ensemble,
    pool = 
)

# under the hood, we use Distribute for 
# the computation for the ensemble

To execute this in parallel, we would define some simulate() function that uses the @parallel macro. See the slurm+Distributed example here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant