Skip to content

Commit 9b350da

Browse files
author
ucabc46
committed
update test script
1 parent 66ed782 commit 9b350da

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

test/mpi_copy_states.jl

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,36 +77,33 @@ buffer = zeros((n_float_per_particle, n_particle_per_rank))
7777

7878

7979
trial_sets = Dict(
80-
"1:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => sort!(sample_indices(n_particle, k=1, p=0.99)),
81-
"10:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => sort!(sample_indices(n_particle, k=10, p=0.99)),
82-
"100:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => sort!(sample_indices(n_particle, k=100, p=0.99)),
83-
"half:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => sort!(sample_indices(n_particle, k=div(n_particle, 2), p=0.99)),
84-
"all:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => collect(1:n_particle),
85-
"1:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => ones(Int, n_particle),
86-
"10:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => sort!(rand(rng, 1:10, n_particle)),
87-
"100:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => sort!(rand(rng, 1:100, n_particle)),
88-
"half:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => sort!(rand(rng, 1:div(n_particle, 2), n_particle)),
89-
"all:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => collect(1:n_particle),
80+
"1:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm:1.0" => () -> sort!(sample_indices(n_particle, k=1, p=1.0)),
81+
"1:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm:0.999" => () -> sort!(sample_indices(n_particle, k=1, p=0.999)),
82+
"1:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm:0.99" => () -> sort!(sample_indices(n_particle, k=1, p=0.99)),
83+
# "10:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => () -> sort!(sample_indices(n_particle, k=10, p=0.99)),
84+
# "100:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm" => () -> sort!(sample_indices(n_particle, k=100, p=0.99)),
85+
"half:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm:1.0" => () -> sort!(sample_indices(n_particle, k=div(n_particle, 2), p=1.0)),
86+
"all:$my_size:$n_particle_per_rank:$n_float_per_particle:randperm:1.0" => () -> collect(1:n_particle),
87+
# "1:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => ones(Int, n_particle),
88+
# "10:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => sort!(rand(rng, 1:10, n_particle)),
89+
# "100:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => sort!(rand(rng, 1:100, n_particle)),
90+
# "half:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => sort!(rand(rng, 1:div(n_particle, 2), n_particle)),
91+
# "all:$my_size:$n_particle_per_rank:$n_float_per_particle:firstperm" => collect(1:n_particle),
9092
)
9193

9294
local_timer_dicts = Dict{String, Dict{String,Any}}()
9395

94-
for (trial_name, indices) in trial_sets
96+
for (trial_name, indices_func) in trial_sets
9597
if verbose && my_rank == 0
9698
println()
9799
println("Resampling particles to indices ", indices)
98100
println()
99101
end
100-
101-
# Convert Set to Vector for indexing
102-
indices = collect(indices)
103-
# Ensure indices are within bounds
104-
@test all(indices .<= n_particle)
105-
@test all(indices .> 0)
106-
102+
indices = [1, 2, 3] # Placeholder for actual indices
107103
# repeat experiment 10 times to get average time
108104
timer = TimerOutputs.TimerOutput("copy_states")
109105
for _ in 1:10
106+
indices = collect(indices_func())
110107
copyto!(local_states, init_local_states)
111108
@timeit timer "overall" begin
112109
if optimize_resample && my_rank == 0

0 commit comments

Comments
 (0)