1- using Test, ParticleDA, MPI, Random, TimerOutputs, HDF5, Serialization
1+ using Test, ParticleDA, MPI, Random, TimerOutputs, HDF5, Serialization, Logging
22TimerOutputs. enable_debug_timings(ParticleDA)
33
44const rng = Random. TaskLocalRNG()
@@ -37,7 +37,7 @@ MPI.Init()
3737my_rank = MPI. Comm_rank(MPI. COMM_WORLD)
3838my_size = MPI. Comm_size(MPI. COMM_WORLD)
3939
40- println( " Number of threads available: " , Threads. nthreads() )
40+ @info " Number of threads available: " , Threads. nthreads()
4141
4242n_particle_per_rank = 1000
4343n_particle = n_particle_per_rank * my_size
@@ -48,13 +48,13 @@ if output_timer
4848 error(" Please provide the output filename for timers." )
4949 end
5050 output_filename = ARGS [2 ]
51- println( " Outputting timers to HDF5 file '$output_filename '" )
51+ @info " Outputting timers to HDF5 file '$output_filename '"
5252end
5353# default: dedup enabled for testing
5454no_dedup = " -nd" in ARGS || " --no-dedup" in ARGS
55- println( " Deduplication enabled: " , ! no_dedup)
55+ @info " Deduplication enabled: " , ! no_dedup
5656optimize_resample = " -o" in ARGS || " --optimize-resample" in ARGS
57- println( " Optimized resampling enabled: " , optimize_resample)
57+ @info " Optimized resampling enabled: " , optimize_resample
5858
5959n_float_per_particle = 100000
6060# total number of floats per rank
@@ -68,7 +68,7 @@ local_states = similar(init_local_states)
6868if verbose
6969 for i = 1 : my_size
7070 if i == my_rank + 1
71- println( " rank " , my_rank, " : local states: " , local_states)
71+ @info " rank $( my_rank) : local states: " , local_states
7272 end
7373 MPI. Barrier(MPI. COMM_WORLD)
7474 end
@@ -88,14 +88,12 @@ local_timer_dicts = Dict{String, Dict{String,Any}}()
8888
8989for (trial_name, indices_func) in trial_sets
9090 if verbose && my_rank == 0
91- println()
92- println(" Resampling particles to indices " , indices)
93- println()
91+ @info " Resampling particles to indices " , indices
9492 end
9593 indices = collect(1 : n_particle) # Placeholder for actual indices
9694 # repeat experiment 10 times to get average time
9795 # warm up run
98- println( " Warm up run..." )
96+ @info " Warm up run..."
9997 ParticleDA. optimized_resample!(indices, my_size)
10098 ParticleDA. copy_states!(
10199 local_states,
@@ -104,7 +102,7 @@ for (trial_name, indices_func) in trial_sets
104102 my_rank,
105103 n_particle_per_rank
106104 )
107- println( " Starting timed runs for trial '$trial_name '..." )
105+ @info " Starting timed runs for trial '$trial_name '..."
108106
109107 timer = TimerOutputs. TimerOutput(" copy_states" )
110108 for _ in 1 : 10
@@ -141,11 +139,11 @@ for (trial_name, indices_func) in trial_sets
141139 # compare
142140 match = local_states == expected
143141
144- println( " rank " , my_rank, " : local_states =" )
145- show(stdout , " text/plain" , local_states); println()
146- println( " rank " , my_rank, " : expected =" )
147- show(stdout , " text/plain" , expected); println()
148- println( " rank " , my_rank, " : match = " , match)
142+ @info " rank $( my_rank) : local_states ="
143+ show(stdout , " text/plain" , local_states);
144+ @info " rank $( my_rank) : expected ="
145+ show(stdout , " text/plain" , expected);
146+ @info " rank $( my_rank) : match = " , match
149147 end
150148 MPI. Barrier(MPI. COMM_WORLD)
151149 end
0 commit comments