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

Make purification_type string and change numerical values #554

Conversation

lmpawan10
Copy link
Contributor

@lmpawan10 lmpawan10 commented May 12, 2024

The following changes have been made:

Inside HardwareMonitor.h

  • purification_type declared as string

Inside HardwareMonitor.cc

  • 2002: "R1_Single_X-R1_Single_Z"
  • 3003: "R1_Single_X-R2_Single_Z"
  • 1001: "R1_Single_XZ"
  • 1221: "R1_Single_XZ-R2_Single_ZX"
  • 1011: "R1_Double_X"
  • 1021: "R1_Double_X-R2_Double_Z"
  • 1031: "R1_Double_XZ-R2_Double_ZX"
  • 1061: "R1_Double_X_Single_Z-R2_Double_Z_Single_X"
  • 5555: "CR1_Double_X-CR2_Double_ZX--R1_Single_X-R2_Single_Z"
  • 5556: "CR1_Double_X-R1_Single_Z-R2_Single_X"

Here, R1/R2 is for specifying the number of rounds.
i.e, R1: Round 1, R2: Round 2

"CR1_Double_X-CR2_Double_ZX--R1_Single_X-R2_Single_Z" states that,
Double_X and Double_ZX purification run in Round1 and Round2 respectively only once.
Then, Single_X and Single_Z purification run during Round1 and Round2 respectively and repeat for more rounds if needed.


This change is Reviewable

@lmpawan10 lmpawan10 requested a review from Naphann May 13, 2024 03:39
@lmpawan10 lmpawan10 self-assigned this May 13, 2024
@lmpawan10 lmpawan10 requested a review from zigen May 24, 2024 08:27
@@ -611,8 +612,8 @@ void HardwareMonitor::sendLinkTomographyRuleSet(int my_address, int partner_addr
std::vector<int> partners = {partner_address};

if (num_purification > 0) {
if (purification_type == 2002) { // Performs both X and Z purification for each n.
/// # Purification_type 2002: #
if (purification_type == "R1_Single_X-R1_Single_Z") { // Performs both X and Z purification for each n.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R1_SINGLE_X_R1_SINGLE_Z

  • keep the naming convention: CAPITAL_CASE
  • no dash -

Copy link
Contributor

@Naphann Naphann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest that the general naming should give us the idea of the number of rounds as well. Say we put N rounds, some of the specify protocols run more than N rounds.

Some ideas,

  • 2002: 2N_ALTERNATE_SINGLE_X_WITH_SINGLE_Z
  • 3003: N_ALTERNATE_SINGLE_X_WITH_SINGLE_Z

It can get tricky with 1061, 5555, and 5556. Maybe something similar to below (still need to think of a way to specify it better)

  • 1061: N_ALTERNATE_DOUBLE_X_SINGLE_Z_WITH_DOUBLE_Z_SINGLE_X
  • 5555: 2+N_DOUBLE_X_THEN_DOUBLE_Z_ALTERNATE_SINGLE_X_WITH_SINGLE_Z

Also it is possible that 5555 has wrong implementation, it shouldn't be DSDA or DSDA_INV since the comments said we want 3 qubits.

Reviewed all commit messages.
Reviewable status: 0 of 27 files reviewed, 3 unresolved discussions (waiting on @lmpawan10)


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.h line 55 at r1 (raw file):

  bool X_Purification = false;
  bool Z_Purification = false;
  // int purification_type = -1;

if we don't need it after the change, please delete it.


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.cc line 65 at r1 (raw file):

  Z_Purification = par("z_purification");
  purification_type = par("purification_type").str();
  purification_type = purification_type.substr(1, purification_type.length() - 2);

why not use stdstringValue() of OMNeT?

@lmpawan10
Copy link
Contributor Author

lmpawan10 commented May 25, 2024

@Naphann

what does 2 in 2002: 2N_ALTERNATE_SINGLE_X_WITH_SINGLE_Z mean?

For 5555,

In the first round, I will change DOUBLE_SELECTION_ZX_PURIFICATION to DOUBLE_SELECTION_Z_PURIFICATION.

Copy link
Contributor

@Naphann Naphann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardware monitor takes in the purification type (currently the numerical value) and the number of rounds. For some types, the round input is not the actual message exchanging round. It is much clearer to the users and for semantics to make the number of purification rounds explicitly known from the type.

As we can see from the comments, - rounds: that the input rounds get turned into sometimes n, sometimes 2n, or sometimes 2+n.

Reviewable status: 0 of 27 files reviewed, 3 unresolved discussions (waiting on @lmpawan10)

Copy link
Contributor Author

@lmpawan10 lmpawan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got you. I have made the following changes accordingly.

  • 2002: 2N_ALTERNATE_SINGLE_X_WITH_SINGLE_Z
  • 3003: N_ALTERNATE_SINGLE_X_WITH_SINGLE_Z
  • 1001: N_SINGLE_XZ
  • 1221: N_ALTERNATE_SINGLE_XZ_WITH_SINGLE_ZX
  • 1011: N_DOUBLE_X
  • 1021: N_ALTERNATE_DOUBLE_X_WITH_DOUBLE_Z
  • 1031: N_ALTERNATE_DOUBLE_XZ_WITH_DOUBLE_ZX
  • 1061: N_ALTERNATE_DOUBLE_X_SINGLE_Z_WITH_DOUBLE_Z_SINGLE_X
  • 5555: 2+N_DOUBLE_X_THEN_DOUBLE_Z_ALTERNATE_SINGLE_X_WITH_SINGLE_Z
  • 5556: 1+N_DOUBLE_X_ALTERNATE_SINGLE_Z_WITH_SINGLE_X

Reviewable status: 0 of 29 files reviewed, 3 unresolved discussions

Copy link
Contributor Author

@lmpawan10 lmpawan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 29 files reviewed, 3 unresolved discussions (waiting on @Naphann)


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.h line 55 at r1 (raw file):

Previously, Naphann (Naphan Benchasattabuse) wrote…

if we don't need it after the change, please delete it.

Done.

Copy link
Contributor Author

@lmpawan10 lmpawan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 29 files reviewed, 3 unresolved discussions (waiting on @Naphann)


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.cc line 65 at r1 (raw file):

Previously, Naphann (Naphan Benchasattabuse) wrote…

why not use stdstringValue() of OMNeT?

Done.

Copy link
Contributor Author

@lmpawan10 lmpawan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 29 files reviewed, 3 unresolved discussions (waiting on @lmpawan10, @Naphann, and @zigen)


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.cc line 615 at r1 (raw file):

Previously, zigen (Kentaro "zigen" Teramoto) wrote…

R1_SINGLE_X_R1_SINGLE_Z

  • keep the naming convention: CAPITAL_CASE
  • no dash -

Done.

@lmpawan10 lmpawan10 requested review from Naphann and zigen June 4, 2024 17:20
Copy link
Contributor

@Naphann Naphann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 27 files at r1, 27 of 27 files at r2.
Reviewable status: all files reviewed (commit messages unreviewed), 2 unresolved discussions (waiting on @lmpawan10 and @zigen)


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.cc line 65 at r1 (raw file):

Previously, lmpawan10 (Pawan Poudel) wrote…

Done.

I was thinking of this one https://doc.omnetpp.org/omnetpp4/api/classcPar.html#aea60efd9c5f66088badcf921c8decd68. It would look a little cleaner if it works.

Copy link
Contributor Author

@lmpawan10 lmpawan10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 28 of 29 files reviewed, 2 unresolved discussions (waiting on @Naphann and @zigen)


quisp/modules/QRSA/HardwareMonitor/HardwareMonitor.cc line 65 at r1 (raw file):

Previously, Naphann (Naphan Benchasattabuse) wrote…

I was thinking of this one https://doc.omnetpp.org/omnetpp4/api/classcPar.html#aea60efd9c5f66088badcf921c8decd68. It would look a little cleaner if it works.

Done.

Copy link
Contributor

@Naphann Naphann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @zigen)

Copy link
Contributor

@zigen zigen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks much better than before! thanks! :lgtm:

Reviewed 1 of 1 files at r3, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @lmpawan10)

@Naphann Naphann merged commit bd4c706 into sfc-aqua:master Jul 5, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants