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

Fix performance regression in 3 or more qubits RB #905

Closed
wants to merge 1 commit into from

Conversation

itoko
Copy link
Contributor

@itoko itoko commented Sep 14, 2022

Summary

Fix the performance regression of RB for 3 or more qubits Cliffords, which was introduced in the recent refactoring of RB module #898

Details and comments

Change back to avoid using slow Clifford.compose as much as possible and use faster QuantumCircuit.compose and Clifford.from_circuit instead for 3 or more qubits Cliffords, that was the technique used in the original code before #898 but missed to be included in #898.

As shown in the table below, this PR recovers the original performance. (Code to measure the performance of 3Q RB)

[after-this-PR]
    full_sampling          backend  max_length  num_samples                    method    seconds  num_runs
0           False      fake_manila          20            3             time_circuits   1.661291         1
1           False      fake_manila          20            3  time_transpiled_circuits   4.292393         1
2           False      fake_manila          20            6             time_circuits   3.375736         1
3           False      fake_manila          20            6  time_transpiled_circuits   7.549929         1
4           False      fake_manila          40            3             time_circuits   2.772556         1
5           False      fake_manila          40            3  time_transpiled_circuits   6.404932         1
6           False      fake_manila          40            6             time_circuits   5.390166         1
7           False      fake_manila          40            6  time_transpiled_circuits  12.694415         1
8           False      fake_mumbai          20            3             time_circuits   1.630835         1
9           False      fake_mumbai          20            3  time_transpiled_circuits   5.511165         1
10          False      fake_mumbai          20            6             time_circuits   3.343967         1
11          False      fake_mumbai          20            6  time_transpiled_circuits  10.307006         1
12          False      fake_mumbai          40            3             time_circuits   2.551411         1
13          False      fake_mumbai          40            3  time_transpiled_circuits   8.743302         1
14          False      fake_mumbai          40            6             time_circuits   5.347619         1
15          False      fake_mumbai          40            6  time_transpiled_circuits  17.490494         1
16          False  fake_washington          20            3             time_circuits   1.590835         1
17          False  fake_washington          20            3  time_transpiled_circuits  15.676607         1
18          False  fake_washington          20            6             time_circuits   3.243143         1
19          False  fake_washington          20            6  time_transpiled_circuits  23.216102         1
20          False  fake_washington          40            3             time_circuits   2.629359         1
21          False  fake_washington          40            3  time_transpiled_circuits  20.105627         1
22          False  fake_washington          40            6             time_circuits   5.276347         1
23          False  fake_washington          40            6  time_transpiled_circuits  41.768356         1

[main]
    full_sampling          backend  max_length  num_samples                    method    seconds  num_runs
0           False      fake_manila          20            3             time_circuits   6.361049         1
1           False      fake_manila          20            3  time_transpiled_circuits   9.400935         1
2           False      fake_manila          20            6             time_circuits  13.168127         1
3           False      fake_manila          20            6  time_transpiled_circuits  17.275917         1
4           False      fake_manila          40            3             time_circuits  10.803795         1
5           False      fake_manila          40            3  time_transpiled_circuits  14.360775         1
6           False      fake_manila          40            6             time_circuits  21.231920         1
7           False      fake_manila          40            6  time_transpiled_circuits  32.218625         1
8           False      fake_mumbai          20            3             time_circuits   6.478630         1
9           False      fake_mumbai          20            3  time_transpiled_circuits  10.717985         1
10          False      fake_mumbai          20            6             time_circuits  12.797258         1
11          False      fake_mumbai          20            6  time_transpiled_circuits  20.825657         1
12          False      fake_mumbai          40            3             time_circuits  11.569653         1
13          False      fake_mumbai          40            3  time_transpiled_circuits  18.167764         1
14          False      fake_mumbai          40            6             time_circuits  23.377687         1
15          False      fake_mumbai          40            6  time_transpiled_circuits  35.131031         1
16          False  fake_washington          20            3             time_circuits   5.729617         1
17          False  fake_washington          20            3  time_transpiled_circuits  21.061335         1
18          False  fake_washington          20            6             time_circuits  11.404692         1
19          False  fake_washington          20            6  time_transpiled_circuits  33.093630         1
20          False  fake_washington          40            3             time_circuits  10.356137         1
21          False  fake_washington          40            3  time_transpiled_circuits  32.811150         1
22          False  fake_washington          40            6             time_circuits  24.519854         1
23          False  fake_washington          40            6  time_transpiled_circuits  65.782916         1

[before-898]
    full_sampling          backend  max_length  num_samples                    method    seconds  num_runs
0           False      fake_manila          20            3             time_circuits   1.239760         1
1           False      fake_manila          20            3  time_transpiled_circuits   4.570645         1
2           False      fake_manila          20            6             time_circuits   2.490214         1
3           False      fake_manila          20            6  time_transpiled_circuits   8.229670         1
4           False      fake_manila          40            3             time_circuits   2.401180         1
5           False      fake_manila          40            3  time_transpiled_circuits   7.136153         1
6           False      fake_manila          40            6             time_circuits   4.711962         1
7           False      fake_manila          40            6  time_transpiled_circuits  13.858979         1
8           False      fake_mumbai          20            3             time_circuits   1.182070         1
9           False      fake_mumbai          20            3  time_transpiled_circuits   5.678319         1
10          False      fake_mumbai          20            6             time_circuits   2.271423         1
11          False      fake_mumbai          20            6  time_transpiled_circuits  10.940199         1
12          False      fake_mumbai          40            3             time_circuits   2.332980         1
13          False      fake_mumbai          40            3  time_transpiled_circuits   9.905238         1
14          False      fake_mumbai          40            6             time_circuits   4.764303         1
15          False      fake_mumbai          40            6  time_transpiled_circuits  19.541976         1
16          False  fake_washington          20            3             time_circuits   1.219157         1
17          False  fake_washington          20            3  time_transpiled_circuits  16.669695         1
18          False  fake_washington          20            6             time_circuits   2.551022         1
19          False  fake_washington          20            6  time_transpiled_circuits  25.928957         1
20          False  fake_washington          40            3             time_circuits   2.294674         1
21          False  fake_washington          40            3  time_transpiled_circuits  21.894724         1
22          False  fake_washington          40            6             time_circuits   4.168826         1
23          False  fake_washington          40            6  time_transpiled_circuits  44.483864         1

@itoko itoko marked this pull request as ready for review September 14, 2022 05:02
@itoko
Copy link
Contributor Author

itoko commented Jan 19, 2023

Close as this fix is included in #982 (via #922)

@itoko itoko closed this Jan 19, 2023
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.

1 participant