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

No EPR create and receive instructions are issued when using epr_socket inside loop #42

Open
qraa opened this issue Nov 28, 2022 · 0 comments

Comments

@qraa
Copy link
Contributor

qraa commented Nov 28, 2022

I'm trying to run a NetQASM SDK application listed below. However, when executing the application, the application stalls while executing. As can be seen in the compiled subroutine, no create and receive instructions are compiled into the subroutines that are flushed.

Client application

...
create_5x2_outcomes = connection.new_array(10)
with connection.loop(5) as i:
    def post_create(conn, qubit, pair):
        qubit.measure(create_5x2_outcomes.get_future_index(2 * i + pair))
    epr_socket.create_keep(2, sequential=True, post_routine=post_create)
connection.flush()
...

Server application

...
create_5x2_outcomes = connection.new_array(10)
with connection.loop(5) as i:
    def post_create(conn, qubit, pair):
        qubit.measure(create_5x2_outcomes.get_future_index(2 * i + pair))
    epr_socket.recv_keep(2, sequential=True, post_routine=post_create)
connection.flush()
...

Compiled subroutines:

Subroutine
NetQASM version: (0, 10)
App ID: 100
 LN | HLN | CMD
   0    () set R8 2
   1    () array R8 @2
   2    () set R8 10
   3    () array R8 @0
   4    () set R8 20
   5    () array R8 @1
   6    () set R0 0
   7    () set R8 2
   8    () beq R0 R8 14
   9    () set R8 0
  10    () store R8 @2[R0]
  11    () set R8 1
  12    () add R0 R0 R8
  13    () jmp 7
  14    () set R0 0
  15    () set R8 5
  16    () beq R0 R8 60
  17    () set R4 0
  18    () set R5 0
  19    () set R6 0
  20    () set R7 0
  21    () set R8 10
  22    () beq R7 R8 27
  23    () add R4 R4 R1
  24    () set R8 1
  25    () add R7 R7 R8
  26    () jmp 21
  27    () set R8 1
  28    () add R5 R1 R8
  29    () set R7 0
  30    () set R8 10
  31    () beq R7 R8 36
  32    () add R6 R6 R5
  33    () set R8 1
  34    () add R7 R7 R8
  35    () jmp 30
  36    () wait_all @1[R4:R6]
  37    () set R4 9
  38    () set R5 0
  39    () beq R5 R1 45
  40    () set R8 10
  41    () add R4 R4 R8
  42    () set R8 1
  43    () add R5 R5 R8
  44    () jmp 39
  45    () load R3 @1[R4]
  46    () set R2 0
  47    () set R8 3
  48    () bne R3 R8 50
  49    () rot_z R2 16 4
  50    () set R8 1
  51    () bne R3 R8 53
  52    () rot_x R2 16 4
  53    () set R8 2
  54    () bne R3 R8 57
  55    () rot_x R2 16 4
  56    () rot_z R2 16 4
  57    () set R8 1
  58    () add R0 R0 R8
  59    () jmp 15
  60    () ret_arr @0
  61    () ret_arr @1
  62    () ret_arr @2

Subroutine
NetQASM version: (0, 10)
App ID: 100
 LN | HLN | CMD
   0    () set R8 2
   1    () array R8 @2
   2    () set R8 10
   3    () array R8 @0
   4    () set R8 20
   5    () array R8 @1
   6    () set R0 0
   7    () set R8 2
   8    () beq R0 R8 14
   9    () set R8 0
  10    () store R8 @2[R0]
  11    () set R8 1
  12    () add R0 R0 R8
  13    () jmp 7
  14    () set R0 0
  15    () set R8 5
  16    () beq R0 R8 60
  17    () set R4 0
  18    () set R5 0
  19    () set R6 0
  20    () set R7 0
  21    () set R8 10
  22    () beq R7 R8 27
  23    () add R4 R4 R1
  24    () set R8 1
  25    () add R7 R7 R8
  26    () jmp 21
  27    () set R8 1
  28    () add R5 R1 R8
  29    () set R7 0
  30    () set R8 10
  31    () beq R7 R8 36
  32    () add R6 R6 R5
  33    () set R8 1
  34    () add R7 R7 R8
  35    () jmp 30
  36    () wait_all @1[R4:R6]
  37    () set R4 9
  38    () set R5 0
  39    () beq R5 R1 45
  40    () set R8 10
  41    () add R4 R4 R8
  42    () set R8 1
  43    () add R5 R5 R8
  44    () jmp 39
  45    () load R3 @1[R4]
  46    () set R2 0
  47    () set R8 3
  48    () bne R3 R8 50
  49    () rot_z R2 16 4
  50    () set R8 1
  51    () bne R3 R8 53
  52    () rot_x R2 16 4
  53    () set R8 2
  54    () bne R3 R8 57
  55    () rot_x R2 16 4
  56    () rot_z R2 16 4
  57    () set R8 1
  58    () add R0 R0 R8
  59    () jmp 15
  60    () ret_arr @0
  61    () ret_arr @1
  62    () ret_arr @2

Subroutine
NetQASM version: (0, 10)
App ID: 100
 LN | HLN | CMD
   0    () set R2 2
   1    () array R2 @2
   2    () set R2 10
   3    () array R2 @0
   4    () set R2 20
   5    () array R2 @1
   6    () set R0 0
   7    () set R2 2
   8    () beq R0 R2 14
   9    () set R2 0
  10    () store R2 @2[R0]
  11    () set R2 1
  12    () add R0 R0 R2
  13    () jmp 7
  14    () set R2 20
  15    () array R2 @3
  16    () set R2 0
  17    () set R3 0
  18    () store R2 @3[R3]
  19    () set R2 2
  20    () set R3 1
  21    () store R2 @3[R3]
  22    () set R0 0
  23    () set R2 5
  24    () beq R0 R2 48
  25    () set R4 0
  26    () set R5 0
  27    () set R6 0
  28    () set R7 0
  29    () set R2 10
  30    () beq R7 R2 35
  31    () add R4 R4 R1
  32    () set R2 1
  33    () add R7 R7 R2
  34    () jmp 29
  35    () set R2 1
  36    () add R5 R1 R2
  37    () set R7 0
  38    () set R2 10
  39    () beq R7 R2 44
  40    () add R6 R6 R5
  41    () set R2 1
  42    () add R7 R7 R2
  43    () jmp 38
  44    () wait_all @1[R4:R6]
  45    () set R2 1
  46    () add R0 R0 R2
  47    () jmp 23
  48    () ret_arr @0
  49    () ret_arr @1
  50    () ret_arr @2
  51    () ret_arr @3

Subroutine
NetQASM version: (0, 10)
App ID: 100
 LN | HLN | CMD
   0    () set R2 2
   1    () array R2 @2
   2    () set R2 10
   3    () array R2 @0
   4    () set R2 20
   5    () array R2 @1
   6    () set R0 0
   7    () set R2 2
   8    () beq R0 R2 14
   9    () set R2 0
  10    () store R2 @2[R0]
  11    () set R2 1
  12    () add R0 R0 R2
  13    () jmp 7
  14    () set R2 20
  15    () array R2 @3
  16    () set R2 0
  17    () set R3 0
  18    () store R2 @3[R3]
  19    () set R2 2
  20    () set R3 1
  21    () store R2 @3[R3]
  22    () set R0 0
  23    () set R2 5
  24    () beq R0 R2 48
  25    () set R4 0
  26    () set R5 0
  27    () set R6 0
  28    () set R7 0
  29    () set R2 10
  30    () beq R7 R2 35
  31    () add R4 R4 R1
  32    () set R2 1
  33    () add R7 R7 R2
  34    () jmp 29
  35    () set R2 1
  36    () add R5 R1 R2
  37    () set R7 0
  38    () set R2 10
  39    () beq R7 R2 44
  40    () add R6 R6 R5
  41    () set R2 1
  42    () add R7 R7 R2
  43    () jmp 38
  44    () wait_all @1[R4:R6]
  45    () set R2 1
  46    () add R0 R0 R2
  47    () jmp 23
  48    () ret_arr @0
  49    () ret_arr @1
  50    () ret_arr @2
  51    () ret_arr @3
  • I am running NetQASM v0.12.1 on python v3.9.2
@qraa qraa changed the title No EPR create and receive instructions are issued when using epr_socket inside loop. No EPR create and receive instructions are issued when using epr_socket inside loop Nov 28, 2022
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

No branches or pull requests

1 participant