# The number of communication rounds per global epoch to test
comm_rounds_per_global_epoch=("1""10""100")
procs=`expr$procs_per_machine\*$machines`
echo procs: $procs
# Celeba has 63741 samples
dataset_size=63741
# Calculating the number of samples that each user/proc will have on average
samples_per_user=`expr$dataset_size / $procs`
echo samples per user: $samples_per_user
for b in"${batchsize[@]}"
do
echo batchsize: $b
for r in"${comm_rounds_per_global_epoch[@]}"
do
echo communication rounds per global epoch: $r
# calculating how many batches there are in a global epoch for each user/proc
batches_per_epoch=$(($samples_per_user/$b))
echo batches per global epoch: $batches_per_epoch
# the number of iterations in 25 global epochs
iterations=$($env_python-c"from math import floor; print($batches_per_epoch * $global_epochs) if $r >= $batches_per_epoch else print($global_epochs * $r)")
echo iterations: $iterations
# calculating the number of batches each user/proc uses per communication step (The actual number may be a float, which we round down)
batches_per_comm_round=$($env_python-c"from math import floor; x = floor($batches_per_epoch / $r); print(1 if x==0 else x)")
# since the batches per communication round were rounded down we need to change the number of iterations to reflect that
new_iterations=$($env_python-c"from math import floor; x = floor($batches_per_epoch / $r); y = floor((($batches_per_epoch / $r) - x +1)*$iterations); print($iterations if x==0 else y)")
echo batches per communication round: $batches_per_comm_round