emu-sv 2.3.0__py3-none-any.whl → 2.4.0__py3-none-any.whl
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.
- emu_sv/__init__.py +1 -1
- emu_sv/density_matrix_state.py +3 -1
- emu_sv/state_vector.py +1 -1
- emu_sv/sv_backend_impl.py +11 -20
- {emu_sv-2.3.0.dist-info → emu_sv-2.4.0.dist-info}/METADATA +2 -2
- {emu_sv-2.3.0.dist-info → emu_sv-2.4.0.dist-info}/RECORD +7 -7
- {emu_sv-2.3.0.dist-info → emu_sv-2.4.0.dist-info}/WHEEL +0 -0
emu_sv/__init__.py
CHANGED
emu_sv/density_matrix_state.py
CHANGED
|
@@ -80,7 +80,9 @@ class DensityMatrix(State[complex, torch.Tensor]):
|
|
|
80
80
|
self.matrix.shape == other.matrix.shape
|
|
81
81
|
), "States do not have the same number of sites"
|
|
82
82
|
|
|
83
|
-
return torch.vdot(
|
|
83
|
+
return torch.vdot(
|
|
84
|
+
self.matrix.flatten(), other.matrix.to(self.matrix.device).flatten()
|
|
85
|
+
)
|
|
84
86
|
|
|
85
87
|
@classmethod
|
|
86
88
|
def from_state_vector(cls, state: StateVector) -> DensityMatrix:
|
emu_sv/state_vector.py
CHANGED
|
@@ -134,7 +134,7 @@ class StateVector(State[complex, torch.Tensor]):
|
|
|
134
134
|
), "States do not have the same shape"
|
|
135
135
|
|
|
136
136
|
# by our internal convention inner and norm return to cpu
|
|
137
|
-
return torch.vdot(self.vector, other.vector).cpu()
|
|
137
|
+
return torch.vdot(self.vector, other.vector.to(self.vector.device)).cpu()
|
|
138
138
|
|
|
139
139
|
def sample(
|
|
140
140
|
self,
|
emu_sv/sv_backend_impl.py
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
from abc import abstractmethod
|
|
2
2
|
import time
|
|
3
3
|
import typing
|
|
4
|
+
import torch
|
|
4
5
|
|
|
5
6
|
from emu_sv.hamiltonian import RydbergHamiltonian
|
|
6
7
|
from emu_sv.lindblad_operator import RydbergLindbladian
|
|
7
8
|
from pulser import Sequence
|
|
8
|
-
import torch
|
|
9
|
-
from resource import RUSAGE_SELF, getrusage
|
|
10
9
|
|
|
11
10
|
from pulser.backend import Results, Observable, State, EmulationConfig
|
|
12
|
-
from emu_base import PulserData
|
|
13
|
-
from emu_base.noise import pick_dark_qubits
|
|
11
|
+
from emu_base import PulserData, get_max_rss
|
|
14
12
|
|
|
15
13
|
from emu_sv.state_vector import StateVector
|
|
16
14
|
from emu_sv.density_matrix_state import DensityMatrix
|
|
@@ -46,20 +44,12 @@ class Statistics(Observable):
|
|
|
46
44
|
assert isinstance(state, StateVector | DensityMatrix)
|
|
47
45
|
assert isinstance(config, SVConfig)
|
|
48
46
|
duration = self.data[-1]
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
elif isinstance(state, DensityMatrix) and state.matrix.is_cuda:
|
|
56
|
-
max_mem_per_device = (
|
|
57
|
-
torch.cuda.max_memory_allocated(device) * 1e-6
|
|
58
|
-
for device in range(torch.cuda.device_count())
|
|
59
|
-
)
|
|
60
|
-
max_mem = max(max_mem_per_device)
|
|
61
|
-
else:
|
|
62
|
-
max_mem = getrusage(RUSAGE_SELF).ru_maxrss * 1e-3
|
|
47
|
+
max_mem = get_max_rss(
|
|
48
|
+
isinstance(state, StateVector)
|
|
49
|
+
and state.vector.is_cuda
|
|
50
|
+
or isinstance(state, DensityMatrix)
|
|
51
|
+
and state.matrix.is_cuda
|
|
52
|
+
)
|
|
63
53
|
|
|
64
54
|
config.logger.info(
|
|
65
55
|
f"step = {len(self.data)}/{self.timestep_count}, "
|
|
@@ -118,8 +108,9 @@ class BaseSVBackendImpl:
|
|
|
118
108
|
|
|
119
109
|
def init_dark_qubits(self) -> None:
|
|
120
110
|
if self._config.noise_model.state_prep_error > 0.0:
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
bad_atoms = self._pulser_data.hamiltonian.bad_atoms
|
|
112
|
+
self.well_prepared_qubits_filter = torch.tensor(
|
|
113
|
+
[bool(bad_atoms[x]) for x in self._pulser_data.qubit_ids]
|
|
123
114
|
)
|
|
124
115
|
else:
|
|
125
116
|
self.well_prepared_qubits_filter = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: emu-sv
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Pasqal State Vector based pulse emulator built on PyTorch
|
|
5
5
|
Project-URL: Documentation, https://pasqal-io.github.io/emulators/
|
|
6
6
|
Project-URL: Repository, https://github.com/pasqal-io/emulators
|
|
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
25
25
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
26
26
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
27
27
|
Requires-Python: >=3.10
|
|
28
|
-
Requires-Dist: emu-base==2.
|
|
28
|
+
Requires-Dist: emu-base==2.4.0
|
|
29
29
|
Description-Content-Type: text/markdown
|
|
30
30
|
|
|
31
31
|
<div align="center">
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
emu_sv/__init__.py,sha256=
|
|
1
|
+
emu_sv/__init__.py,sha256=Oc9_UlpE7Nioggmg-pX4_8iQnh7_o9jl8n_wBTu5NJg,771
|
|
2
2
|
emu_sv/custom_callback_implementations.py,sha256=_7XLIDzJ-p3DVqz-Jyv0eYbl8nih2x2p-pM4cBCLumA,6367
|
|
3
3
|
emu_sv/dense_operator.py,sha256=AvgntJNwwtf3Wl66CIWSwUezVYV3vignCL24SQQQwQg,5901
|
|
4
|
-
emu_sv/density_matrix_state.py,sha256=
|
|
4
|
+
emu_sv/density_matrix_state.py,sha256=6QmLZvqEHLR64r0nD7D2jZIiAYOgciNVCjh3ywfvIs0,7243
|
|
5
5
|
emu_sv/hamiltonian.py,sha256=CqNGuWJlO2ZljK47wt130s-5uKiOldQUsC3tjwk1mKA,6106
|
|
6
6
|
emu_sv/lindblad_operator.py,sha256=pgjRNLBcvEM2-qxM8uy9wL74OtrD4A8trQeERi_AXH8,8892
|
|
7
|
-
emu_sv/state_vector.py,sha256=
|
|
7
|
+
emu_sv/state_vector.py,sha256=dkAnxEQxK-4Fn6UxhDbcb1z1EsHFUpOyVy0mjHkKFBI,9894
|
|
8
8
|
emu_sv/sv_backend.py,sha256=-soOkSEzEBK1dCKnYnbtvYjmNZtZra1_4jP3H1ROOtM,737
|
|
9
|
-
emu_sv/sv_backend_impl.py,sha256=
|
|
9
|
+
emu_sv/sv_backend_impl.py,sha256=OYsJK_DJ8dmq3QZLKiBejXrq22R5Auyye-pai07NeeY,8798
|
|
10
10
|
emu_sv/sv_config.py,sha256=J4yb9-Na5hAbShDySzPfbt0WXvL8JpfrTEikTK8nH9s,5943
|
|
11
11
|
emu_sv/time_evolution.py,sha256=_VH4f2RF6lGKzO08WxTYJ5Aw8_pTTMRKcyMnIuxH03I,13382
|
|
12
12
|
emu_sv/utils.py,sha256=t0nMDVo6DF5bQW-vbsyRMCmvkyNxCU-v0Enmns9aOAU,1151
|
|
13
|
-
emu_sv-2.
|
|
14
|
-
emu_sv-2.
|
|
15
|
-
emu_sv-2.
|
|
13
|
+
emu_sv-2.4.0.dist-info/METADATA,sha256=HKTJmI_Ra3dcFw2QthE2TEvEiYcvcZmrHkrFMuGY794,3595
|
|
14
|
+
emu_sv-2.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
15
|
+
emu_sv-2.4.0.dist-info/RECORD,,
|
|
File without changes
|