Skip to content

Commit 74dd8f3

Browse files
jlapeyrestylewarning
authored andcommitted
Update performance test for changes in memory model
modified: scripts/prof.lisp The program used for profiling is now created by parsing a string. The previous implementation depended on details of addressing memory of the qvm. These details have changed since this profiling code was last edited.
1 parent a166164 commit 74dd8f3

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

scripts/prof.lisp

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,27 @@
55
(in-package #:qvm)
66

77
(defun hadamard-program (n)
8-
(make-instance
9-
'quil:parsed-program
10-
:executable-code (loop :with v := (make-array (* 2 n))
11-
:for i :below n
12-
:do (setf (aref v i)
13-
(make-instance
14-
'quil:unresolved-application
15-
:operator "H"
16-
:arguments (list (quil:qubit i))))
17-
(setf (aref v (+ n i))
18-
(make-instance
19-
'quil:measure
20-
:qubit (quil:qubit i)
21-
:address (quil:address i)))
22-
:finally (return v))))
8+
(quil:parse-quil
9+
(with-output-to-string (s)
10+
(format s "DECLARE ro BIT[~d]~%" n)
11+
(dotimes (q n)
12+
(format s "H ~d~%" q))
13+
(dotimes (q n)
14+
(format s "MEASURE ~d ro[~d]~%" q q)))))
2315

2416
(defun testme ()
2517
(prepare-for-parallelization 1)
26-
(setf qvm::*qubits-required-for-parallelization* 100)
27-
18+
(setf qvm::*qubits-required-for-parallelization* 49)
19+
2820
(setf qvm:*transition-verbose* t)
2921
(let ((q (make-qvm 25))
3022
(p (hadamard-program 25)))
31-
(load-program q p)
23+
(load-program q p :supersede-memory-subsystem t)
3224
(sb-sprof:with-profiling (:max-samples 10000
3325
:report :flat
3426
:threads :all
3527
:mode :time)
3628
(run q)))
3729
nil)
3830

39-
4031
;;; MAIN
41-
42-
43-

0 commit comments

Comments
 (0)