emu-mps 2.5.2__py3-none-any.whl → 2.6.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_mps/__init__.py CHANGED
@@ -36,4 +36,4 @@ __all__ = [
36
36
  "EntanglementEntropy",
37
37
  ]
38
38
 
39
- __version__ = "2.5.2"
39
+ __version__ = "2.6.0"
emu_mps/mps_config.py CHANGED
@@ -29,8 +29,8 @@ import pathlib
29
29
 
30
30
  class MPSConfig(EmulationConfig):
31
31
  """
32
- The configuration of the emu-mps MPSBackend. The kwargs passed to this class
33
- are passed on to the base class.
32
+ The configuration of the emu-mps MPSBackend. The kwargs passed to this
33
+ class are passed on to the base class.
34
34
  See the API for that class for a list of available options.
35
35
 
36
36
  Args:
@@ -38,26 +38,34 @@ class MPSConfig(EmulationConfig):
38
38
  only calculated if the evaluation_times are divisible by dt.
39
39
  precision: Up to what precision the state is truncated.
40
40
  Defaults to `1e-5`.
41
- max_bond_dim: The maximum bond dimension that the state is allowed to have.
41
+ max_bond_dim: The maximum bond dimension that the state is allowed
42
+ to have.
42
43
  Defaults to `1024`.
43
44
  max_krylov_dim:
44
- The size of the krylov subspace that the Lanczos algorithm maximally builds
45
+ The size of the krylov subspace that the Lanczos algorithm
46
+ maximally builds
45
47
  extra_krylov_tolerance:
46
- The Lanczos algorithm uses this*precision as the convergence tolerance
48
+ The Lanczos algorithm uses this*precision as the convergence
49
+ tolerance
47
50
  num_gpus_to_use: number of GPUs to be used in a given simulation.
48
- - if it is set to a number `n > 0`, the state will be distributed across `n` GPUs.
51
+ - if it is set to a number `n > 0`, the state will be distributed
52
+ across `n` GPUs.
49
53
  - if it is set to `n = 0`, the entire simulation runs on the CPU.
50
- - if it is `None` (the default value), the backend internally chooses the number of GPUs
54
+ - if it is `None` (the default value), the backend internally
55
+ chooses the number of GPUs
51
56
  based on the hardware availability during runtime.
52
57
  As shown in the benchmarks, using multiple GPUs might
53
- alleviate memory pressure per GPU, but the runtime should be similar.
54
- optimize_qubit_ordering: Optimize the register ordering. Improves performance and
55
- accuracy, but disables certain features.
56
- interaction_cutoff: Set interaction coefficients below this value to `0`.
57
- Potentially improves runtime and memory consumption.
58
- log_level: How much to log. Set to `logging.WARN` to get rid of the timestep info.
58
+ alleviate memory pressure per GPU, but the runtime should
59
+ be similar.
60
+ optimize_qubit_ordering: Optimize the register ordering. Improves
61
+ performance and accuracy, but disables certain features.
62
+ interaction_cutoff: Set interaction coefficients Uᵢⱼ below this value
63
+ to `0.0`. Potentially improves runtime and memory consumption.
64
+ log_level: How much to log. Set to `logging.WARN` to get rid of the
65
+ timestep info.
59
66
  log_file: If specified, log to this file rather than stout.
60
- autosave_prefix: filename prefix for autosaving simulation state to file
67
+ autosave_prefix: filename prefix for autosaving simulation state to
68
+ file
61
69
  autosave_dt: Minimum time interval in seconds between two autosaves.
62
70
  Saving the simulation state is only possible at specific times,
63
71
  therefore this interval is only a lower bound.
@@ -95,7 +103,7 @@ class MPSConfig(EmulationConfig):
95
103
  log_level: int = logging.INFO,
96
104
  log_file: pathlib.Path | None = None,
97
105
  autosave_prefix: str = "emu_mps_save_",
98
- autosave_dt: int = 600, # 10 minutes
106
+ autosave_dt: int | float = float("inf"), # disable autosave by default
99
107
  solver: Solver = Solver.TDVP,
100
108
  **kwargs: Any,
101
109
  ):
@@ -116,14 +124,30 @@ class MPSConfig(EmulationConfig):
116
124
  solver=solver,
117
125
  **kwargs,
118
126
  )
127
+ self.logger = init_logging(log_level, log_file)
119
128
 
120
129
  MIN_AUTOSAVE_DT = 10
121
130
  assert (
122
131
  self.autosave_dt > MIN_AUTOSAVE_DT
123
132
  ), f"autosave_dt must be larger than {MIN_AUTOSAVE_DT} seconds"
124
133
 
134
+ MIN_KRYLOV_TOL = 1.0e-12 # keep numerical stability
135
+ prod_tol = precision * extra_krylov_tolerance
136
+ if prod_tol < MIN_KRYLOV_TOL:
137
+ new_extra_krylov_tolerance = MIN_KRYLOV_TOL / precision
138
+ self.logger.warning(
139
+ f"Requested Lanczos convergence tolerance "
140
+ f"(precision * extra_krylov_tolerance = {prod_tol:.2e}) "
141
+ f"is below minimum threshold {MIN_KRYLOV_TOL:.2e}. "
142
+ f"Automatically adjusting extra_krylov_tolerance from "
143
+ f"{extra_krylov_tolerance:.2e} to {new_extra_krylov_tolerance:.2e} "
144
+ f"to maintain numerical stability."
145
+ )
146
+ self.extra_krylov_tolerance = new_extra_krylov_tolerance
147
+ else:
148
+ self.extra_krylov_tolerance = extra_krylov_tolerance
149
+
125
150
  self.monkeypatch_observables()
126
- self.logger = init_logging(log_level, log_file)
127
151
 
128
152
  if (self.noise_model.runs != 1 and self.noise_model.runs is not None) or (
129
153
  self.noise_model.samples_per_run != 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: emu-mps
3
- Version: 2.5.2
3
+ Version: 2.6.0
4
4
  Summary: Pasqal MPS 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.5.2
28
+ Requires-Dist: emu-base==2.6.0
29
29
  Description-Content-Type: text/markdown
30
30
 
31
31
  <div align="center">
@@ -1,4 +1,4 @@
1
- emu_mps/__init__.py,sha256=c-uUpZ6sKJuu0iXuCH5Rle7jHpyadqG_j9qgNH9t5bQ,708
1
+ emu_mps/__init__.py,sha256=yICuhGSXq-UppDZXY4h26sZuDtFNFBHn7y0gCsoAN9w,708
2
2
  emu_mps/algebra.py,sha256=VZ5uaX5PYWGqDCpRKKr819BLMMtT0pKDxc2HrlLCdgU,5423
3
3
  emu_mps/custom_callback_implementations.py,sha256=WeczmO6qkvBIipvXLqX45i3D7M4ovOrepusIGs6d2Ts,2420
4
4
  emu_mps/hamiltonian.py,sha256=OM0bPNZV7J5Egk6aTUwt4GaWqiUOP68ujZBTuqlBY1k,16289
@@ -6,7 +6,7 @@ emu_mps/mpo.py,sha256=WmGDGkCMhlODmydd0b09YcSRlsk6Bg5xYQ4rXSNJvnY,9703
6
6
  emu_mps/mps.py,sha256=aIWbd3s4c2lqhzR1IukxOAmRK7kfUFBPHkOOCS3dcPM,21747
7
7
  emu_mps/mps_backend.py,sha256=dXcW5Fa2AAL_WlHUgr30WS2l3qiDJgBVebiVpyYWpPM,2064
8
8
  emu_mps/mps_backend_impl.py,sha256=WyB1PpC61rzrnr_c3epVZOhDtXLOdhQLsMgUtZQWCYg,30851
9
- emu_mps/mps_config.py,sha256=btlygf6VDFna9TQus-zOmUqB6pfe_aoQmNoivfvxABk,8251
9
+ emu_mps/mps_config.py,sha256=7-Hsio2gt7twVmr_iHbRNV5wi7omqa9n6HuY0Roa0WU,9228
10
10
  emu_mps/observables.py,sha256=4C_ewkd3YkJP0xghTrGUTgXUGvJRCQcetb8cU0SjMl0,1900
11
11
  emu_mps/solver.py,sha256=M9xkHhlEouTBvoPw2UYVu6kij7CO4Z1FXw_SiGFtdgo,85
12
12
  emu_mps/solver_utils.py,sha256=Q1SY8E3Kipe_RfKE8lAMRfD4mSG2VkkkPmk-fU7eAgY,8852
@@ -14,6 +14,6 @@ emu_mps/utils.py,sha256=rL75H55hB5lDMjy8a_O2PpJq51iZKjSx91X4euxB3mY,7293
14
14
  emu_mps/optimatrix/__init__.py,sha256=fBXQ7-rgDro4hcaBijCGhx3J69W96qcw5_3mWc7tND4,364
15
15
  emu_mps/optimatrix/optimiser.py,sha256=k9suYmKLKlaZ7ozFuIqvXHyCBoCtGgkX1mpen9GOdOo,6977
16
16
  emu_mps/optimatrix/permutations.py,sha256=9DDMZtrGGZ01b9F3GkzHR3paX4qNtZiPoI7Z_Kia3Lc,3727
17
- emu_mps-2.5.2.dist-info/METADATA,sha256=7i0nH79Bhe-S22wxLyixahqIo94zoCFvQHFyJxKXMps,3587
18
- emu_mps-2.5.2.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
19
- emu_mps-2.5.2.dist-info/RECORD,,
17
+ emu_mps-2.6.0.dist-info/METADATA,sha256=lClIDf0_pzVhzAtoqzTGg3dcn_0qlF7vBN0bEukVXq0,3587
18
+ emu_mps-2.6.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
19
+ emu_mps-2.6.0.dist-info/RECORD,,