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

Fix small issues #25

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ DocMeta.setdocmeta!(Experimenter, :DocTestSetup, :(using Experimenter); recursiv
makedocs(;
modules=[Experimenter],
authors="Jamie Mair <[email protected]> and contributors",
repo="https://github.com/JamieMair/Experimenter.jl/blob/{commit}{path}#{line}",
sitename="Experimenter.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://JamieMair.github.io/Experimenter.jl",
edit_link="main",
assets=String[],
),
pages=[
Expand All @@ -26,6 +24,5 @@ makedocs(;
)

deploydocs(;
repo="github.com/JamieMair/Experimenter.jl",
devbranch="main",
repo="github.com/JamieMair/Experimenter.jl"
)
40 changes: 21 additions & 19 deletions test/runner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ end

function get_heterogeneous_config()
return Dict{Symbol,Any}(
:x => IterableVariable([1, 2]),
:x => IterableVariable([1, 2, 3]),
:y => IterableVariable([1, 2]),
)
end
Expand Down Expand Up @@ -81,23 +81,25 @@ end
end

@testset "Heterogeneous Running" begin
# Launch two processes with access to 2 threads
ps = addprocs(2; exeflags=["--threads=2"])
database = open_db("runner test"; in_memory=true)
experiment = get_heterogeneous_experiment("heterogeneous distributed execution test", get_heterogeneous_config())

# Launch 2 threads per node
@execute experiment database HeterogeneousMode(2) false directory


trials = get_trials_by_name(database, experiment.name)
for pid in ps
thread_ids = [t.results[:thread_id] for t in trials if t.results[:distributed_id] == pid]
unique_threads = length(unique(thread_ids))
@test unique_threads == 2
@test unique_threads == length(thread_ids)

if get(ENV, "CI", "false") != "true"
# Launch two processes with access to 2 threads
ps = addprocs(2; exeflags=["--threads=2"])
database = open_db("runner test"; in_memory=true)
experiment = get_heterogeneous_experiment("heterogeneous distributed execution test", get_heterogeneous_config())

# Launch 2 threads per node
@execute experiment database HeterogeneousMode(2) false directory


trials = get_trials_by_name(database, experiment.name)
for pid in ps
max_threads = maximum([t.results[:num_threads] for t in trials if t.results[:distributed_id] == pid])
max_threads = min(max_threads, length([true for t in trials if t.results[:distributed_id] == pid]))
thread_ids = [t.results[:thread_id] for t in trials if t.results[:distributed_id] == pid]
unique_threads = length(unique(thread_ids))
@test unique_threads == max_threads
end
# Cleanup
rmprocs(ps...)
end
# Cleanup
rmprocs(ps...)
end
6 changes: 4 additions & 2 deletions test/trial_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ function run_heterogeneous_experiment(config, trial_id)

# Simulate work
s = 0.0
for i in 1:500000000
s += rand() / 1000
for i in 1:100000000
s += rand() / 10000
end

results[:sum] = s

return results
end
Loading