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

immutable cached Waveforms and APS2 instructions #69

Open
caryan opened this issue Aug 26, 2016 · 0 comments
Open

immutable cached Waveforms and APS2 instructions #69

caryan opened this issue Aug 26, 2016 · 0 comments
Assignees

Comments

@caryan
Copy link
Contributor

caryan commented Aug 26, 2016

Compiling longish sequences spends ~10% of them time creating APS2 instructions and converting them to 8 byte machine code and another 5% of the time creating Compiler.Waveform, most of which is in hash_shape. It also uses a non-trivial amount of memory. It seems both of these could be solved with conversion to immutable named tuples and caching.

from QGL import *

import psutil
process = psutil.Process(os.getpid())
print("Memory usage: {} MB".format(process.memory_info().rss // (1 << 20)))

q = QubitFactory("q1")
pulseLib = [Cliffords.AC(q, cliffNum) for cliffNum in range(24)]
# over write AC Id to have finite length
pulseLib[0] = Id(q, 2e-8)

def create_seqs(file):
    seqs = []
    with open(file, 'r') as FID:
        lines = FID.readlines()

    for line in lines:
        seq = [pulseLib[int(pulseNum)] for pulseNum in line.split(',')]
        seq.append(MEAS(q))
        seqs.append(seq)

    seqs += create_cal_seqs((q,), 500)

    return seqs

file = "sequence_numbers.csv"
seqs = create_seqs(file)
filenames = compile_to_hardware(seqs, "test/test" )
print("Memory usage: {} MB".format(process.memory_info().rss // (1 << 20)))
Compiled 4505 sequences.
Memory usage: 659 MB

%%timeit
seqs = create_seqs(file)
filenames = compile_to_hardware(seqs, "test/test" )
Compiled 4505 sequences.
Compiled 4505 sequences.
Compiled 4505 sequences.
Compiled 4505 sequences.
1 loop, best of 3: 57.9 s per loop

%load_ext snakeviz
%%snakeviz
seqs = create_seqs(file)
compile_to_hardware(seqs, "test/test" )

sequence_numbers.csv.zip

@caryan caryan self-assigned this Aug 26, 2016
@matthewware matthewware self-assigned this May 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants