Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] GCI with shot noise #75

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
script with job arrays
MatteoRobbiati committed Jul 9, 2024
commit 4c4c10641c38b01d02bb64d7800e5574f8544e2c
47 changes: 35 additions & 12 deletions run.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
#!/bin/bash
#SBATCH --job-name=tlfim
#SBATCH --output=tlfim_shots.log
#SBATCH --job-name=10q_sgd
#SBATCH --output=sgd_%A_%a.log
#SBATCH --array=0-39 # Total number of combinations minus one

NQUBITS=10
NLAYERS=3
# Define arrays of seeds and layers
SEEDS=(1 2 3 4 42)
LAYERS=(3 4 5 6 7 8 9 10)

# Calculate the number of layers and seeds
NUM_SEEDS=${#SEEDS[@]}
NUM_LAYERS=${#LAYERS[@]}

# Calculate the total number of combinations
TOTAL_COMBINATIONS=$((NUM_SEEDS * NUM_LAYERS))

# Check if the job array index is within bounds
if [ ${SLURM_ARRAY_TASK_ID} -ge ${TOTAL_COMBINATIONS} ]; then
echo "Error: SLURM_ARRAY_TASK_ID=${SLURM_ARRAY_TASK_ID} exceeds number of combinations."
exit 1
fi

# Calculate the seed and layer for the current job
SEED_INDEX=$((SLURM_ARRAY_TASK_ID / NUM_LAYERS))
LAYER_INDEX=$((SLURM_ARRAY_TASK_ID % NUM_LAYERS))

SEED=${SEEDS[$SEED_INDEX]}
NLAYERS=${LAYERS[$LAYER_INDEX]}

# Parameters
NQUBITS=10
DBI_STEPS=0
NBOOST=0
BOOST_FREQUENCY=100

NSHOTS=500
SEED=42
BOOST_FREQUENCY=2000
NSHOTS=100

OPTIMIZER="sgd"
BACKEND="tensorflow"
OPTIMIZER_OPTIONS="{ \"optimizer\": \"Adam\", \"learning_rate\": 0.005, \"nmessage\": 1, \"nepochs\": $BOOST_FREQUENCY }"
OPTIMIZER_OPTIONS="{ \"optimizer\": \"Adam\", \"learning_rate\": 0.05, \"nmessage\": 1, \"nepochs\": $BOOST_FREQUENCY }"
DECAY_RATE_LR=1.

python3 main.py --nqubits $NQUBITS --nlayers $NLAYERS --optimizer $OPTIMIZER \
--output_folder results/big_architectures_small_lr --backend $BACKEND \
# Run the main.py script with the current parameters
python3 main.py --nqubits $NQUBITS --nlayers $NLAYERS --optimizer $OPTIMIZER \
--output_folder results/j1j2_hdw_eff --backend $BACKEND \
--dbi_step $DBI_STEPS --seed $SEED \
--boost_frequency $BOOST_FREQUENCY --nboost $NBOOST \
--optimizer_options "$OPTIMIZER_OPTIONS" \
--hamiltonian "TLFIM" --nshots $NSHOTS
--hamiltonian "J1J2" --ansatz "hdw_efficient"