Skip to content

Commit

Permalink
Stop exporting load
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrebouchard committed Feb 14, 2024
1 parent 7b4c0ba commit 531e9fd
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/src/mpi.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ To analyze the output, see the documentation page on [post-processing for MPI ru
back to your interactive chain via:

```@example local
pt = load(result) # possible thanks to 'pigeons(..., checkpoint = true)' used above
pt = Pigeons.load(result) # possible thanks to 'pigeons(..., checkpoint = true)' used above
```

## Running MPI on a cluster
Expand Down Expand Up @@ -115,7 +115,7 @@ To analyze the output, see the documentation page on [post-processing for MPI ru
back to your interactive chain via:

```
pt = load(mpi_run) # possible thanks to 'pigeons(..., checkpoint = true)' used above
pt = Pigeons.load(mpi_run) # possible thanks to 'pigeons(..., checkpoint = true)' used above
```


Expand Down
4 changes: 2 additions & 2 deletions docs/src/output-mpi-postprocessing.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ however, when running a job via [`MPI`](@ref) or [`ChildProcess`](@ref),
[`pigeons()`](@ref) returns a [`Result`](@ref) struct (which only holds the
directory where samples are stored).

Use [`load()`](@ref) to convert a [`Result`](@ref) into a
Use `Pigeons.load(..)` to convert a [`Result`](@ref) into a
[`PT`](@ref) struct.
This will load the information distributed across several machines
into the interactive node.
Expand Down Expand Up @@ -59,7 +59,7 @@ pt_result = pigeons(target = an_unidentifiable_model,
record = [traces; round_trip; record_default()])
# (*) load the result across all machines into this interactive node
pt = load(pt_result)
pt = Pigeons.load(pt_result)
# collect the statistics and convert to MCMCChains' Chains
# to have axes labels matching variable names in Turing and Stan
Expand Down
3 changes: 2 additions & 1 deletion src/Pigeons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export pigeons, Inputs, PT,
index_process, swap_acceptance_pr, log_sum_ratio, online, round_trip, energy_ac1, traces, disk,
record_online, record_default,
# utils to run on scheduler:
Result, load, setup_mpi, queue_status, queue_ncpus_free, kill_job, watch,
Result, setup_mpi, queue_status, queue_ncpus_free, kill_job, watch,
# load, <- removed to avoid clash - see https://github.com/Julia-Tempering/Pigeons.jl/issues/200
# getting information out of an execution:
stepping_stone, n_tempered_restarts, n_round_trips, process_sample, get_sample,
# variational references:
Expand Down
2 changes: 1 addition & 1 deletion src/pt/checks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function preflight_checks(inputs::Inputs)
"""
end
if mpi_active() && !inputs.checkpoint
@warn "To be able to call load() to retrieve samples in-memory, use pigeons(target = ..., checkpoint = true)"
@warn "To be able to call Pigeons.load() to retrieve samples in-memory, use pigeons(target = ..., checkpoint = true)"
end
if Threads.nthreads() > 1 && !inputs.multithreaded
@warn "More than one threads are available, but explore!() loop is not parallelized as inputs.multithreaded == false"
Expand Down
2 changes: 1 addition & 1 deletion test/test_checkpoint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ end
compare_pts(p1, p2)

r = pigeons(;target, checkpoint = true, on = ChildProcess(n_local_mpi_processes = 2, dependencies=[DynamicPPL,]))
p3 = load(r)
p3 = Pigeons.load(r)
compare_pts(p1, p3)
end
end
2 changes: 1 addition & 1 deletion test/test_lazy_target.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include("supporting/lazy.jl")
n_threads = 2,
dependencies = ["$(@__DIR__)/supporting/lazy.jl"]
))
pt1 = load(r)
pt1 = Pigeons.load(r)
pt2 = pigeons(target = toy_mvn_target(1))

@test Pigeons.recursive_equal(pt1.replicas, pt2.replicas)
Expand Down
6 changes: 3 additions & 3 deletions test/test_resume.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ end
pt = pigeons(; target = toy_mvn_target(1), checkpoint = true, on = ChildProcess(n_local_mpi_processes = 2))
exec = increment_n_rounds!(pt.exec_folder, 2)
r = pigeons(exec, ChildProcess(n_local_mpi_processes = 2))
Pigeons.check_against_serial(load(r))
Pigeons.check_against_serial(Pigeons.load(r))
end

@testset "Extend number of rounds with PT object, on ChildProcess" begin
pt = pigeons(; target = toy_mvn_target(1), checkpoint = true)
pt = increment_n_rounds!(pt, 2)
r = pigeons(pt.exec_folder, ChildProcess(n_local_mpi_processes = 2))
Pigeons.check_against_serial(load(r))
Pigeons.check_against_serial(Pigeons.load(r))
end

@testset "Complex example of increasing number of rounds many times" begin
Expand Down Expand Up @@ -59,5 +59,5 @@ end
result = pigeons(new_exec_folder, ChildProcess(n_local_mpi_processes = 2))

# make sure it is equivalent to doing it in one shot
Pigeons.check_against_serial(load(result))
Pigeons.check_against_serial(Pigeons.load(result))
end
2 changes: 1 addition & 1 deletion test/test_traces.jl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ end
multithreaded = false, # setting to true puts too much pressure on CI instances? https://github.com/Julia-Tempering/Pigeons.jl/actions/runs/5627897144/job/15251121621?pr=90
checkpoint = true,
on = ChildProcess(n_local_mpi_processes = 2, n_threads = 1, dependencies=[DynamicPPL, BridgeStan])) # setting to more than 1 puts too much pressure on CI instances?
pt = load(r)
pt = Pigeons.load(r)
@test length(pt.reduced_recorders.traces) == 1024 * (extended_traces ? 10 : 1)
for chain in Pigeons.chains_with_samples(pt)
marginal = [get_sample(pt, chain, i)[1] for i in 1:1024]
Expand Down

0 comments on commit 531e9fd

Please sign in to comment.