Skip to content

Commit

Permalink
file management
Browse files Browse the repository at this point in the history
  • Loading branch information
meandmytram committed Nov 27, 2024
1 parent 7d491e4 commit 125f75c
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions examples/decoding/quantum_surface.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ pip install --no-index numpy scipy opt_einsum tqdm qecstruct more_itertools netw

# Define arrays of lattice sizes, bond dimensions, error rates, and seeds
lattice_sizes=(3 5 7 9 11)
bond_dims=(4 8 16 32 64 128 256 512)
seeds=(123 124 125 126 127 128 129 130 131 132) # 10 random seeds
num_experiments=10 # Per each random seed
bond_dims=(64 128 256)
seeds=(123 124 125 126) # 4 random seeds
num_experiments=25 # Per each random seed
error_model="Bit Flip" # Error model used in the experiments

error_rates=()
Expand All @@ -31,28 +31,33 @@ do
error_rates+=($value)
done

# Create job submission scripts by iterating over combinations of the argments
# Create job submission scripts by iterating over combinations of the arguments
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
# Create a job submission script for each combination
cat > "submit-job-${lattice_size}-${bond_dim}-${error_rate}-${error_model}-${seed}.sh" <<EOS
# Sanitize the error model name by replacing spaces with underscores
sanitized_error_model=$(echo "${error_model}" | sed 's/ /_/g')
# Define job script filename
job_script="submit-job-${lattice_size}-${bond_dim}-${error_rate}-${sanitized_error_model}-${seed}.sh"
# Create the job submission script
cat > "$job_script" <<EOS
#!/bin/bash
#SBATCH --time=10:00:00 # Time limit (hh:mm:ss)
#SBATCH --time=24:00:00 # Time limit (hh:mm:ss)
#SBATCH --cpus-per-task=1 # Number of CPU cores per task
#SBATCH --mem=16000 # Memory per node
#SBATCH --job-name=decoding-quantum-surface-${lattice_size}-${bond_dim}-${error_rate}-${error_model}${seed} # Descriptive job name
#SBATCH --output=decoding-quantum-surface-${lattice_size}-${bond_dim}-${error_rate}-${error_model}${seed}-%j.out # Standard output and error log
#SBATCH --mem=32000 # Memory per node
#SBATCH --job-name=decoding-${lattice_size}-${bond_dim}-${error_rate}-${sanitized_error_model}-${seed} # Descriptive job name
#SBATCH --output=decoding-${lattice_size}-${bond_dim}-${error_rate}-${sanitized_error_model}-${seed}-%j.out # Standard output and error log
module load python/3.11.5
source "$HOME/envs/myenv/bin/activate"
# Run the Python script with the specified arguments
python quantum_decoding.py --lattice_size ${lattice_size} --bond_dim ${bond_dim} --error_rate ${error_rate} --num_experiments ${num_experiments} --error_model ${error_model} --seed ${seed}
python examples/decoding/quantum_surface.py --lattice_size ${lattice_size} --bond_dim ${bond_dim} --error_rate ${error_rate} --num_experiments ${num_experiments} --error_model "${error_model}" --seed ${seed}
EOS
echo "Submitting the job for lattice size ${lattice_size}, bond dimension ${bond_dim}, error rate ${error_rate}, error model ${error_model}, and seed ${seed}."
sbatch "$job_script"
rm "$job_script"
done
done
done
Expand Down

0 comments on commit 125f75c

Please sign in to comment.