Skip to content

Commit

Permalink
more global parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
meandmytram committed Feb 5, 2025
1 parent 530242b commit 19a3c35
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 38 deletions.
38 changes: 21 additions & 17 deletions examples/decoding/quantum_surface.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#!/bin/bash

# Define arrays of lattice sizes, bond dimensions, error rates, and seeds
lattice_sizes=(3 5)
bond_dims=(10)
seeds=(
123 # 10 random seeds 124 125 126 127 128 129 130 131 132
)
num_experiments=10000 # Per each random seed
error_model="Bitflip" # Error model used in the experiments
bias_prob=1e-1 # The decoder bias probability
tolerance=1e-6 # The numerical tolerance for the MPS within the decoder.
num_processes=16 # Number of processes to use in parallel
silent=true # Whether to suppress the output of the Python script
lattice_sizes=(3) # Array of lattice sizes
bond_dims=(10) # Array of bond dimensions
seeds=(123 124 125 126 127 128 129 130 131 132) # Array of (10) random seeds
num_experiments=10000 # Runs per each random seed
error_model="Bitflip" # The error model
bias_probs=(1e-8 1e-4 1e-3 1e-2 1e-1) # Array of decoder bias probabilities
tolerances=(1e-17 1e-12 1e-8 1e-4 1e-2 1e-1) # Array of numerical tolerances for the MPS within the decoder
cuts=(1e-17 1e-12 1e-8 1e-6 1e-4 1e-3 1e-2) # Array of SVD cut-offs for the MPS within the decoder
num_processes=16 # The number of processes to use in parallel
silent=false # Whether to suppress the output of the Python script

error_rates=()
start=0.01
Expand All @@ -23,16 +21,22 @@ do
error_rates+=($current)
current=$(echo "$current + $step" | bc -l)
done

error_rates=(0.1)
# Iterate over combinations of the arguments and run the Python script
for seed in "${seeds[@]}"; do
for lattice_size in "${lattice_sizes[@]}"; do
for bond_dim in "${bond_dims[@]}"; do
for error_rate in "${error_rates[@]}"; do
# Print current configuration
echo "Running for lattice size ${lattice_size}, bond dimension ${bond_dim}, error rate ${error_rate}, error model ${error_model}, and seed ${seed}."
# Run the Python script
poetry run python examples/decoding/quantum_surface.py --lattice_size ${lattice_size} --bond_dim ${bond_dim} --error_rate ${error_rate} --num_experiments ${num_experiments} --bias_prob ${bias_prob} --error_model "${error_model}" --seed ${seed} --num_processes ${num_processes} --silent ${silent} --tolerance ${tolerance}
for bias_prob in "${bias_probs[@]}"; do
for tolerance in "${tolerances[@]}"; do
for cut in "${cuts[@]}"; do
# Print current configuration
echo "Running for lattice size ${lattice_size}, bond dimension ${bond_dim}, error rate ${error_rate}, error model ${error_model}, and seed ${seed}."
# Run the Python script
poetry run python examples/decoding/quantum_surface.py --lattice_size ${lattice_size} --bond_dim ${bond_dim} --error_rate ${error_rate} --num_experiments ${num_experiments} --bias_prob ${bias_prob} --error_model "${error_model}" --seed ${seed} --num_processes ${num_processes} --silent ${silent} --tolerance ${tolerance} --cut ${cut}
done
done
done
done
done
done
Expand Down
46 changes: 25 additions & 21 deletions examples/decoding/quantum_surface_cc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,16 @@ pip install --no-index --upgrade pip
pip install --no-index numpy scipy opt_einsum tqdm qecstruct more_itertools networkx
pip install git+ssh://[email protected]/quicophy/matrex.git

# Define arrays of lattice sizes, bond dimensions, error rates, and seeds
lattice_sizes=(3 5 7)
bond_dims=(20)
seeds=(
123 124 125 126 127 128 129 130 131 132
) # 10 random seeds
num_experiments=100 # Per each random seed
error_model="Bitflip" # Error model used in the experiments
bias_prob=0.1 # The decoder bias probability
tolerance=1e-6 # The numerical tolerance for the MPS within the decoder.
num_processes=16 # Number of processes to use in parallel
silent=true # Whether to suppress the output of the Python script
lattice_sizes=(2 4) # Array of lattice sizes
bond_dims=(10) # Array of bond dimensions
seeds=(123 124 125 126 127 128 129 130 131 132) # Array of (10) random seeds
num_experiments=10000 # Runs per each random seed
error_model="Bitflip" # The error model
bias_probs=(1e-8 1e-4 1e-3 1e-2 1e-1) # Array of decoder bias probabilities
tolerances=(1e-17 1e-12 1e-8 1e-4 1e-2 1e-1) # Array of numerical tolerances for the MPS within the decoder
cuts=(1e-17 1e-12 1e-8 1e-6 1e-4 1e-3 1e-2) # Array of SVD cut-offs for the MPS within the decoder
num_processes=16 # The number of processes to use in parallel
silent=false # Whether to suppress the output of the Python script

error_rates=()
start=0.105
Expand All @@ -43,12 +41,15 @@ for seed in "${seeds[@]}"; do
for lattice_size in "${lattice_sizes[@]}"; do
for bond_dim in "${bond_dims[@]}"; do
for error_rate in "${error_rates[@]}"; do
# Define job script filename
job_script="submit-job-${lattice_size}-${bond_dim}-${error_rate}-${error_model}-${seed}.sh"
# Create the job submission script
cat > "$job_script" <<EOS
for bias_prob in "${bias_probs[@]}"; do
for tolerance in "${tolerances[@]}"; do
for cut in "${cuts[@]}"; do
# Define job script filename
job_script="submit-job-${lattice_size}-${bond_dim}-${error_rate}-${error_model}-${seed}.sh"
# Create the job submission script
cat > "$job_script" <<EOS
#!/bin/bash
#SBATCH --time=96:00:00 # Time limit (hh:mm:ss)
#SBATCH --time=12:00:00 # Time limit (hh:mm:ss)
#SBATCH --cpus-per-task=${num_processes} # Number of CPU cores per task
#SBATCH --mem=16000 # Memory per node
#SBATCH --job-name=decoding-${lattice_size}-${bond_dim}-${error_rate}-${error_model}-${seed} # Descriptive job name
Expand All @@ -58,11 +59,14 @@ module load python/3.11.5
source "$HOME/envs/myenv/bin/activate"
# Run the Python script with the specified arguments
python examples/decoding/quantum_surface.py --lattice_size ${lattice_size} --bond_dim ${bond_dim} --error_rate ${error_rate} --bias_prob ${bias_prob} --num_experiments ${num_experiments} --error_model "${error_model}" --seed ${seed} --num_processes ${num_processes} --silent ${silent} --tolerance ${tolerance}
python examples/decoding/quantum_surface.py --lattice_size ${lattice_size} --bond_dim ${bond_dim} --error_rate ${error_rate} --bias_prob ${bias_prob} --num_experiments ${num_experiments} --error_model "${error_model}" --seed ${seed} --num_processes ${num_processes} --silent ${silent} --tolerance ${tolerance} --cut ${cut}
EOS
echo "Submitting the job for lattice size ${lattice_size}, bond dimension ${bond_dim}, error rate ${error_rate}, error model ${error_model}, bias probability ${bias_prob} and seed ${seed}."
sbatch "$job_script"
rm "$job_script"
echo "Submitting the job for lattice size ${lattice_size}, bond dimension ${bond_dim}, error rate ${error_rate}, error model ${error_model}, bias probability ${bias_prob} and seed ${seed}."
sbatch "$job_script"
rm "$job_script"
done
done
done
done
done
done
Expand Down

0 comments on commit 19a3c35

Please sign in to comment.