pennylane-qrack 0.10.16__tar.gz → 0.10.19__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pennylane-qrack might be problematic. Click here for more details.

Files changed (30) hide show
  1. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/CHANGELOG.md +5 -0
  2. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/Makefile +6 -13
  3. {pennylane_qrack-0.10.16/pennylane_qrack.egg-info → pennylane_qrack-0.10.19}/PKG-INFO +1 -1
  4. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack/QrackDeviceConfig.toml +2 -1
  5. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack/_version.py +1 -1
  6. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack/qrack_device.cpp +12 -6
  7. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack/qrack_device.py +9 -5
  8. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19/pennylane_qrack.egg-info}/PKG-INFO +1 -1
  9. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/tests/test_apply.py +20 -20
  10. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/CMakeLists.txt +0 -0
  11. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/LICENSE +0 -0
  12. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/MANIFEST.in +0 -0
  13. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/README.rst +0 -0
  14. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/catalyst/runtime/include/DataView.hpp +0 -0
  15. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/catalyst/runtime/include/DynamicLibraryLoader.hpp +0 -0
  16. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/catalyst/runtime/include/Exception.hpp +0 -0
  17. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/catalyst/runtime/include/QuantumDevice.hpp +0 -0
  18. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/catalyst/runtime/include/RuntimeCAPI.h +0 -0
  19. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/catalyst/runtime/include/Types.h +0 -0
  20. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack/__init__.py +0 -0
  21. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack.egg-info/SOURCES.txt +0 -0
  22. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack.egg-info/dependency_links.txt +0 -0
  23. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack.egg-info/entry_points.txt +0 -0
  24. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack.egg-info/requires.txt +0 -0
  25. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/pennylane_qrack.egg-info/top_level.txt +0 -0
  26. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/requirements.txt +0 -0
  27. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/setup.cfg +0 -0
  28. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/setup.py +0 -0
  29. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/tests/test_integration.py +0 -0
  30. {pennylane_qrack-0.10.16 → pennylane_qrack-0.10.19}/tests/test_units.py +0 -0
@@ -6,6 +6,9 @@
6
6
 
7
7
  ### Breaking changes 💔
8
8
 
9
+ * The `qml.QubitStateVector` template has been removed. Instead, use `qml.StatePrep`.
10
+ [(#27)](https://github.com/unitaryfund/pennylane-qrack/pull/27/)
11
+
9
12
  ### Deprecations 👋
10
13
 
11
14
  ### Documentation 📝
@@ -14,6 +17,8 @@
14
17
 
15
18
  ### Contributors ✍️
16
19
 
20
+ Andrija Paurevic
21
+
17
22
  This release contains contributions from (in alphabetical order):
18
23
 
19
24
  ---
@@ -24,32 +24,25 @@ help:
24
24
  build-deps:
25
25
  ifneq ($(OS),Windows_NT)
26
26
  ifeq ($(QRACK_PRESENT),)
27
- git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 45c91f5549bfd60e26489c911f20c65699f945ea; cd ..
27
+ git clone https://github.com/unitaryfund/qrack.git; cd qrack; git checkout 87a8b72a7e0af64745aa6b86bf080e828b933851; cd ..
28
28
  endif
29
29
  mkdir -p qrack/build
30
30
  ifeq ($(UNAME_S),Linux)
31
31
  ifeq ($(UNAME_P),x86_64)
32
- cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON ..; make all; \
33
- mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
34
- cd ../../..
32
+ cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON ..; make all; cd ../..
35
33
  else
36
- cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF ..; make all; \
37
- mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
38
- cd ../../..
34
+ cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_DEVRAND=ON -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF ..; make all; cd ../..
39
35
  endif
40
36
  endif
41
37
  ifeq ($(UNAME_S),Darwin)
42
38
  ifeq ($(UNAME_P),x86_64)
43
- cd qrack/build; cmake ..; make all; \
44
- mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
45
- cd ../../..
39
+ cd qrack/build; cmake ..; make all; cd ../..
46
40
  else
47
- cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF ..; make all; \
48
- mkdir ../../_qrack_include; mkdir ../../_qrack_include/qrack; cp -r ../include/* ../../_qrack_include/qrack; cp -r include/* ../../_qrack_include/qrack; \
49
- cd ../../..
41
+ cd qrack/build; cmake -DENABLE_RDRAND=OFF -DENABLE_COMPLEX_X2=OFF -DENABLE_SSE3=OFF -DENABLE_OPENCL=OFF ..; make all; cd ../..
50
42
  endif
51
43
  endif
52
44
  endif
45
+ mkdir _qrack_include; mkdir _qrack_include/qrack; cp -r qrack/include/* _qrack_include/qrack; cp -r qrack/build/include/* _qrack_include/qrack; \
53
46
  cd pennylane_qrack; cmake ..; make all
54
47
 
55
48
  .PHONY: install
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pennylane-qrack
3
- Version: 0.10.16
3
+ Version: 0.10.19
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -58,7 +58,6 @@ Identity = { properties = [ "controllable", "invertible" ] }
58
58
  # SISWAP = {}
59
59
  # SQISW = {}
60
60
  # BasisState = {}
61
- # QubitStateVector = {}
62
61
  # StatePrep = {}
63
62
  # ControlledQubitUnitary = {}
64
63
  # DiagonalQubitUnitary = {}
@@ -140,6 +139,8 @@ is_schmidt_decomposition_parallel = "isSchmidtDecomposeMulti"
140
139
  is_qbdd = "isBinaryDecisionTree"
141
140
  # Use GPU acceleration? (Default is "true")
142
141
  is_gpu = "isOpenCL"
142
+ # Use multi-GPU (or "multi-page") acceleration? (Default is "false")
143
+ is_paged = "isPaged"
143
144
  # Use CPU/GPU method hybridization? (Default is "false")
144
145
  is_hybrid_cpu_gpu = "isCpuGpuHybrid"
145
146
  # Allocate GPU buffer from general host heap? (Default is "false"; "true" might improve performance or reliability in certain cases, like if using an Intel HD as accelerator)
@@ -16,4 +16,4 @@
16
16
  Version number (major.minor.patch[-label])
17
17
  """
18
18
 
19
- __version__ = "0.10.16"
19
+ __version__ = "0.10.19"
@@ -6,7 +6,7 @@
6
6
  #define CL_HPP_TARGET_OPENCL_VERSION 300
7
7
  #include "qrack/qfactory.hpp"
8
8
 
9
- #define QSIM_CONFIG(numQubits) Qrack::CreateArrangedLayersFull(nw, md, sd, sh, bdt, true, tn, hy, oc, numQubits, Qrack::ZERO_BCI, nullptr, Qrack::CMPLX_DEFAULT_ARG, false, true, hp)
9
+ #define QSIM_CONFIG(numQubits) Qrack::CreateArrangedLayersFull(nw, md, sd, sh, bdt, pg, tn, hy, oc, numQubits, Qrack::ZERO_BCI, nullptr, Qrack::CMPLX_DEFAULT_ARG, false, true, hp)
10
10
 
11
11
  std::string trim(std::string s)
12
12
  {
@@ -38,6 +38,7 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
38
38
  bool md;
39
39
  bool bdt;
40
40
  bool oc;
41
+ bool pg;
41
42
  bool hy;
42
43
  bool hp;
43
44
  bool nw;
@@ -386,6 +387,7 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
386
387
  , md(true)
387
388
  , bdt(false)
388
389
  , oc(true)
390
+ , pg(false)
389
391
  , hy(false)
390
392
  , hp(false)
391
393
  , nw(false)
@@ -405,9 +407,10 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
405
407
  keyMap["'is_schmidt_decomposition_parallel'"] = 4;
406
408
  keyMap["'is_qbdd'"] = 5;
407
409
  keyMap["'is_gpu'"] = 6;
408
- keyMap["'is_hybrid_cpu_gpu'"] = 7;
409
- keyMap["'is_host_pointer'"] =8;
410
- keyMap["'noise'"] = 9;
410
+ keyMap["'is_paged'"] = 7;
411
+ keyMap["'is_hybrid_cpu_gpu'"] = 8;
412
+ keyMap["'is_host_pointer'"] =9;
413
+ keyMap["'noise'"] = 10;
411
414
 
412
415
  size_t pos;
413
416
  Qrack::real1_f noiseParam = 0;
@@ -438,12 +441,15 @@ struct QrackDevice final : public Catalyst::Runtime::QuantumDevice {
438
441
  oc = val;
439
442
  break;
440
443
  case 7:
441
- hy = val;
444
+ pg = val;
442
445
  break;
443
446
  case 8:
444
- hp = val;
447
+ hy = val;
445
448
  break;
446
449
  case 9:
450
+ hp = val;
451
+ break;
452
+ case 10:
447
453
  noiseParam = std::stof(value);
448
454
  nw = noiseParam > ZERO_R1;
449
455
  break;
@@ -27,7 +27,7 @@ import numpy as np
27
27
  from pennylane import DeviceError, QuantumFunctionError
28
28
  from pennylane.devices import QubitDevice
29
29
  from pennylane.ops import (
30
- QubitStateVector,
30
+ StatePrep,
31
31
  BasisState,
32
32
  QubitUnitary,
33
33
  CRZ,
@@ -157,8 +157,10 @@ class QrackDevice(QubitDevice):
157
157
  isBinaryDecisionTree = False
158
158
  # Use GPU acceleration? (Default is "true")
159
159
  isOpenCL = True
160
+ # Use multi-GPU (or "multi-page") acceleration? (Default is "false")
161
+ isPaged = True
160
162
  # Use CPU/GPU method hybridization? (Default is "false")
161
- isCpuGpuHybrid = False
163
+ isCpuGpuHybrid = True
162
164
  # Allocate GPU buffer from general host heap? (Default is "false"; "true" might improve performance or reliability in certain cases, like if using an Intel HD as accelerator)
163
165
  isHostPointer = False
164
166
  # Noise parameter. (Default is "0"; depolarizing noise intensity can also be controlled by "QRACK_GATE_DEPOLARIZATION" environment variable)
@@ -188,6 +190,8 @@ class QrackDevice(QubitDevice):
188
190
  self.isBinaryDecisionTree = options["isBinaryDecisionTree"]
189
191
  if "isOpenCL" in options:
190
192
  self.isOpenCL = options["isOpenCL"]
193
+ if "isPaged" in options:
194
+ self.isPaged = options["isPaged"]
191
195
  if "isCpuGpuHybrid" in options:
192
196
  self.isCpuGpuHybrid = options["isCpuGpuHybrid"]
193
197
  if "isHostPointer" in options:
@@ -234,8 +238,8 @@ class QrackDevice(QubitDevice):
234
238
 
235
239
  def _apply(self):
236
240
  for op in self._circuit:
237
- if isinstance(op, QubitStateVector):
238
- self._apply_qubit_state_vector(op)
241
+ if isinstance(op, StatePrep):
242
+ self._apply_state_prep(op)
239
243
  elif isinstance(op, BasisState):
240
244
  self._apply_basis_state(op)
241
245
  elif isinstance(op, QubitUnitary):
@@ -264,7 +268,7 @@ class QrackDevice(QubitDevice):
264
268
 
265
269
  return state_vector.flatten()
266
270
 
267
- def _apply_qubit_state_vector(self, op):
271
+ def _apply_state_prep(self, op):
268
272
  """Initialize state with a state vector"""
269
273
  wires = op.wires
270
274
  input_state = op.parameters[0]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pennylane-qrack
3
- Version: 0.10.16
3
+ Version: 0.10.19
4
4
  Summary: PennyLane plugin for Qrack.
5
5
  Home-page: http://github.com/vm6502q
6
6
  Maintainer: vm6502q
@@ -245,12 +245,12 @@ class TestStateApply:
245
245
  expected = dev._expand_state(expected, op_wires)
246
246
  assert np.allclose(res, expected, tol)
247
247
 
248
- def test_qubit_state_vector(self, init_state, tol):
249
- """Test QubitStateVector application"""
248
+ def test_state_prep(self, init_state, tol):
249
+ """Test StatePrep application"""
250
250
  dev = QrackDevice(1, isOpenCL=False)
251
251
  state = init_state(1)
252
252
 
253
- op = qml.QubitStateVector(state, wires=[0])
253
+ op = qml.StatePrep(state, wires=[0])
254
254
  dev.apply([op])
255
255
  dev._obs_queue = []
256
256
 
@@ -260,12 +260,12 @@ class TestStateApply:
260
260
 
261
261
  @pytest.mark.parametrize("device_wires", [3, 4, 5])
262
262
  @pytest.mark.parametrize("op_wires", [[0], [2], [0, 1], [1, 0], [2, 0]])
263
- def test_qubit_state_vector_on_wires_subset(self, init_state, device_wires, op_wires, tol):
264
- """Test QubitStateVector application on a subset of device wires"""
263
+ def test_state_prep_on_wires_subset(self, init_state, device_wires, op_wires, tol):
264
+ """Test StatePrep application on a subset of device wires"""
265
265
  dev = QrackDevice(device_wires, isOpenCL=False)
266
266
  state = init_state(len(op_wires))
267
267
 
268
- op = qml.QubitStateVector(state, wires=op_wires)
268
+ op = qml.StatePrep(state, wires=op_wires)
269
269
  dev.apply([op])
270
270
  dev._obs_queue = []
271
271
 
@@ -274,7 +274,7 @@ class TestStateApply:
274
274
 
275
275
  assert np.allclose(res, expected, tol)
276
276
 
277
- def test_invalid_qubit_state_vector(self):
277
+ def test_invalid_state_prep(self):
278
278
  """Test that an exception is raised if the state
279
279
  vector is the wrong size"""
280
280
  dev = QrackDevice(2, isOpenCL=False)
@@ -284,7 +284,7 @@ class TestStateApply:
284
284
  ValueError,
285
285
  match="State vector must have shape \\(2\\*\\*wires,\\) or \\(batch_size, 2\\*\\*wires\\).",
286
286
  ):
287
- op = qml.QubitStateVector(state, wires=[0, 1])
287
+ op = qml.StatePrep(state, wires=[0, 1])
288
288
  dev.apply([op])
289
289
 
290
290
  @pytest.mark.parametrize("op,mat", single_qubit)
@@ -293,7 +293,7 @@ class TestStateApply:
293
293
  dev = QrackDevice(1, isOpenCL=False)
294
294
  state = init_state(1)
295
295
 
296
- dev.apply([qml.QubitStateVector(state, wires=[0]), op])
296
+ dev.apply([qml.StatePrep(state, wires=[0]), op])
297
297
  dev._obs_queue = []
298
298
 
299
299
  res = dev.state
@@ -328,7 +328,7 @@ class TestStateApply:
328
328
  state = init_state(1)
329
329
 
330
330
  op.data = [theta]
331
- dev.apply([qml.QubitStateVector(state, wires=[0]), op])
331
+ dev.apply([qml.StatePrep(state, wires=[0]), op])
332
332
  dev._obs_queue = []
333
333
 
334
334
  res = dev.state
@@ -368,7 +368,7 @@ class TestStateApply:
368
368
  state = init_state(1)
369
369
 
370
370
  op.data = [phi, theta, omega]
371
- dev.apply([qml.QubitStateVector(state, wires=[0]), op])
371
+ dev.apply([qml.StatePrep(state, wires=[0]), op])
372
372
  dev._obs_queue = []
373
373
 
374
374
  res = dev.state
@@ -406,7 +406,7 @@ class TestStateApply:
406
406
  dev = QrackDevice(2, isOpenCL=False)
407
407
  state = init_state(2)
408
408
 
409
- dev.apply([qml.QubitStateVector(state, wires=[0, 1]), op])
409
+ dev.apply([qml.StatePrep(state, wires=[0, 1]), op])
410
410
  dev._obs_queue = []
411
411
 
412
412
  res = dev.state
@@ -442,7 +442,7 @@ class TestStateApply:
442
442
  state = init_state(N)
443
443
 
444
444
  op = qml.QubitUnitary(mat, wires=list(range(N)))
445
- dev.apply([qml.QubitStateVector(state, wires=list(range(N))), op])
445
+ dev.apply([qml.StatePrep(state, wires=list(range(N))), op])
446
446
  dev._obs_queue = []
447
447
 
448
448
  res = dev.state
@@ -486,7 +486,7 @@ class TestStateApply:
486
486
  dev = QrackDevice(3, isOpenCL=False)
487
487
  state = init_state(3)
488
488
 
489
- dev.apply([qml.QubitStateVector(state, wires=[0, 1, 2]), op])
489
+ dev.apply([qml.StatePrep(state, wires=[0, 1, 2]), op])
490
490
  dev._obs_queue = []
491
491
 
492
492
  res = dev.state
@@ -517,7 +517,7 @@ class TestStateApply:
517
517
  dev = QrackDevice(4, isOpenCL=False)
518
518
  state = init_state(4)
519
519
 
520
- dev.apply([qml.QubitStateVector(state, wires=[0, 1, 2, 3]), op])
520
+ dev.apply([qml.StatePrep(state, wires=[0, 1, 2, 3]), op])
521
521
  dev._obs_queue = []
522
522
 
523
523
  res = dev.state
@@ -532,7 +532,7 @@ class TestStateApply:
532
532
  state = init_state(2)
533
533
 
534
534
  op.data = [theta]
535
- dev.apply([qml.QubitStateVector(state, wires=[0, 1]), op])
535
+ dev.apply([qml.StatePrep(state, wires=[0, 1]), op])
536
536
 
537
537
  dev._obs_queue = []
538
538
 
@@ -573,7 +573,7 @@ class TestStateApply:
573
573
  state = init_state(2)
574
574
 
575
575
  op.data = [phi, theta, omega]
576
- dev.apply([qml.QubitStateVector(state, wires=[0, 1]), op])
576
+ dev.apply([qml.StatePrep(state, wires=[0, 1]), op])
577
577
  dev._obs_queue = []
578
578
 
579
579
  res = dev.state
@@ -582,12 +582,12 @@ class TestStateApply:
582
582
  expected = [(x * x.conj()).real for x in expected]
583
583
  assert np.allclose(res, expected, tol)
584
584
 
585
- def test_apply_errors_qubit_state_vector(self):
585
+ def test_apply_errors_state_prep(self):
586
586
  """Test that apply fails for incorrect state preparation."""
587
587
  dev = QrackDevice(2, isOpenCL=False)
588
588
 
589
589
  with pytest.raises(ValueError, match="Sum of amplitudes-squared does not equal one."):
590
- dev.apply([qml.QubitStateVector(np.array([1, -1]), wires=[0])])
590
+ dev.apply([qml.StatePrep(np.array([1, -1]), wires=[0])])
591
591
 
592
592
  with pytest.raises(
593
593
  ValueError,
@@ -595,7 +595,7 @@ class TestStateApply:
595
595
  ):
596
596
  p = np.array([1, 0, 1, 1, 0]) / np.sqrt(3)
597
597
  dev.reset()
598
- dev.apply([qml.QubitStateVector(p, wires=[0, 1])])
598
+ dev.apply([qml.StatePrep(p, wires=[0, 1])])
599
599
 
600
600
  def test_apply_errors_basis_state(self):
601
601
  """Test that apply fails for incorrect basis state preparation."""