Skip to content

Commit

Permalink
add wait to notify the end of simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
Naphann committed Jul 26, 2024
1 parent 014ba0f commit 6b093c8
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 26 deletions.
67 changes: 46 additions & 21 deletions quisp/batch-simulation.sh
Original file line number Diff line number Diff line change
@@ -1,39 +1,64 @@
#!/bin/bash

pids=()

# for i in 1 2 4 8 16 32 64;
# do
# echo "Welcome $i times"
# ./quisp -n "./networks:./channels:./modules:./simulations" -i \
# ./images ./simulations/mim_generation_test.ini -u Cmdenv -c "memory_$i" --cmdenv-status-frequency=10s > "out-$i" &
# echo "Running first exp with $i memories"
# ./quisp -n "./networks:./channels:./modules:./simulations" \
# -i ./images./simulations/mim_generation_test.ini -u Cmdenv \
# -c "memory_$i" --cmdenv-status-frequency=10s > "out-$i" &
# pids += ($ !)
# done

# for i in 0 1 2 3 4 5 6 7 8 9 10;
# do
# alicedist="$((20 - $i))"
# echo "Welcome $i times $alicedist"
# ./quisp -n "./networks:./channels:./modules:./simulations" -i \
# ./images ./simulations/cross_validation.ini -u Cmdenv -c "mim_imbalanced_${alicedist}_${i}" --cmdenv-status-frequency=10s > "exp2-raw-${alicedist}_${i}" &
# alicedist = "$((20 - $i))"
# echo "Running imbalanced BSA placement with distance $i - $alicedist"
# ./quisp -n "./networks:./channels:./modules:./simulations" \
# -i ./images./simulations/cross_validation.ini -u Cmdenv \
# -c "mim_imbalanced_${alicedist}_${i}" --cmdenv-status-frequency=10s > "exp2-raw-${alicedist}_${i}" &
# pids += ($ !)
# done

for cnot in 0 025 05 075 1 125 15 175 2 225 25 275 3 325 35 375 4 425 45 475;
for cnot in 0 025 05 075 1 125 15 175 2 225 25 275 3 325 35 375 4 425 45 475 5;
do
echo "Welcome cnot: $cnot, meas $meas, without decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" -i \
./images ./simulations/cross_validation_config_generated.ini -u Cmdenv -c "swapping_validation_cnot_${cnot}_meas_0_with_1ms_decoherence" --cmdenv-status-frequency=10s > "exp3-raw-${cnot}_0_with_1ms_decoherence" &
echo "Running experiment 3 - CNOT error: $cnot, measurement error: 0, with 1ms decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" \
-i ./images ./simulations/cross_validation_config_generated.ini -u Cmdenv \
-c "swapping_validation_cnot_${cnot}_meas_0_with_1ms_decoherence" \
--cmdenv-status-frequency=10s > "exp3-raw-${cnot}_0_with_1ms_decoherence" &
pids+=($!)

echo "Welcome cnot: $cnot, meas $meas, with 1ms decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" -i \
./images ./simulations/cross_validation_config_generated.ini -u Cmdenv -c "swapping_validation_cnot_${cnot}_meas_0_without_decoherence" --cmdenv-status-frequency=10s > "exp3-raw-${cnot}_0_without_decoherence" &
echo "Running experiment 3 - CNOT error: $cnot, measurement error: 0, without decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" \
-i ./images ./simulations/cross_validation_config_generated.ini -u Cmdenv \
-c "swapping_validation_cnot_${cnot}_meas_0_without_decoherence" \
--cmdenv-status-frequency=10s > "exp3-raw-${cnot}_0_without_decoherence" &
pids+=($!)
done

for meas in 025 05 075 1 125 15 175 2 225 25 275 3 325 35 375 4 425 45 475;
for meas in 025 05 075 1 125 15 175 2 225 25 275 3 325 35 375 4 425 45 475 5;
do
echo "Welcome cnot: $cnot, meas $meas, without decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" -i \
./images ./simulations/cross_validation_config_generated.ini -u Cmdenv -c "swapping_validation_cnot_0_meas_${meas}_with_1ms_decoherence" --cmdenv-status-frequency=10s > "exp3-raw-0_${meas}_with_1ms_decoherence" &
echo "Running experiment 3 - CNOT error: 0, measurement error: $meas, with 1ms decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" \
-i ./images ./simulations/cross_validation_config_generated.ini -u Cmdenv \
-c "swapping_validation_cnot_0_meas_${meas}_with_1ms_decoherence" \
--cmdenv-status-frequency=10s > "exp3-raw-0_${meas}_with_1ms_decoherence" &
pids+=($!)

echo "Welcome cnot: $cnot, meas $meas, with 1ms decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" -i \
./images ./simulations/cross_validation_config_generated.ini -u Cmdenv -c "swapping_validation_cnot_0_meas_${meas}_without_decoherence" --cmdenv-status-frequency=10s > "exp3-raw-0_${meas}_without_decoherence" &
echo "Running experiment 3 - CNOT error: 0, measurement error: $meas, without decoherence"
./quisp -n "./networks:./channels:./modules:./simulations" \
-i ./images ./simulations/cross_validation_config_generated.ini -u Cmdenv \
-c "swapping_validation_cnot_0_meas_${meas}_without_decoherence" \
--cmdenv-status-frequency=10s > "exp3-raw-0_${meas}_without_decoherence" &
pids+=($!)
done

# wait for all pids
for pid in ${pids[*]};
do
echo "waiting on pid = $pid"
wait $pid done
done
echo "All simulations finished"
4 changes: 2 additions & 2 deletions quisp/runtime/RuntimeManager.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "RuntimeManager.h"
#include <iostream>
#include "omnetpp/cexception.h"
#include "omnetpp/csimulation.h"
#include <iostream>

namespace quisp::runtime {

Expand All @@ -23,7 +23,7 @@ void RuntimeManager::exec() {
it->exec();
if (it->terminated) {
it = runtimes.erase(it);
std::cout << "sim time: " << simTime() << std::endl;
std::cout << "sim time: " << simTime() << std::endl;
} else {
++it;
}
Expand Down
6 changes: 3 additions & 3 deletions quisp/simulations/general_config.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[General]
repeat = 1
seed-set = ${repetition}
sim-time-limit = 5000s
sim-time-limit = 250s
**.initial_notification_timing_buffer = 10s # when to start the BSA timing notification.
**.app.request_generation_interval = 2s
**.logger.enabled_log = false
Expand Down Expand Up @@ -59,6 +59,6 @@ sim-time-limit = 5000s
**.y_measurement_error_rate = 0

# simulation parameters
**.app.number_of_bellpair = 1000000
**.app.number_of_bellpair = 50000
**.buffers = 1
**.qrsa.hm.num_measure = 1000000
**.qrsa.hm.num_measure = 50000

0 comments on commit 6b093c8

Please sign in to comment.