PyQrackIsing 1.14.0__tar.gz → 1.14.2__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.
Files changed (21) hide show
  1. {pyqrackising-1.14.0/PyQrackIsing.egg-info → pyqrackising-1.14.2}/PKG-INFO +1 -1
  2. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/maxcut_tfim.py +128 -5
  3. {pyqrackising-1.14.0 → pyqrackising-1.14.2/PyQrackIsing.egg-info}/PKG-INFO +1 -1
  4. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/pyproject.toml +1 -1
  5. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/setup.py +1 -1
  6. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/CMakeLists.txt +0 -0
  7. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/LICENSE.md +0 -0
  8. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/MANIFEST.in +0 -0
  9. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/__init__.py +0 -0
  10. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/_pyqrack_ising.cpp +0 -0
  11. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/generate_tfim_samples.py +0 -0
  12. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/spin_glass_solver.py +0 -0
  13. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/tfim_magnetization.py +0 -0
  14. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/tfim_square_magnetization.py +0 -0
  15. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing/tsp_symmetric.py +0 -0
  16. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing.egg-info/SOURCES.txt +0 -0
  17. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing.egg-info/dependency_links.txt +0 -0
  18. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing.egg-info/not-zip-safe +0 -0
  19. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/PyQrackIsing.egg-info/top_level.txt +0 -0
  20. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/README.md +0 -0
  21. {pyqrackising-1.14.0 → pyqrackising-1.14.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyQrackIsing
3
- Version: 1.14.0
3
+ Version: 1.14.2
4
4
  Summary: Near-ideal closed-form solutions for transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -49,8 +49,65 @@ try:
49
49
  bias[i] = bias[end - i]
50
50
  bias[end - i] = tmp
51
51
 
52
+
53
+ @cuda.jit
54
+ def cuda_maxcut_hamming_cdf_256(n_qubits, n_steps, delta_t, tot_t, h_mult, J_func, degrees, theta, hamming_prob):
55
+ qc = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
56
+ step = qc // n_qubits
57
+ q = qc % n_qubits
58
+
59
+ if step >= n_steps:
60
+ return
61
+
62
+ J_eff = J_func[q]
63
+ if abs(J_eff) <= (2 ** (-54)):
64
+ return
65
+
66
+ z = degrees[q]
67
+ theta_eff = theta[q]
68
+ t = step * delta_t
69
+ tm1 = (step - 1) * delta_t
70
+ h_t = h_mult * (tot_t - t)
71
+ n_bias = n_qubits - 1
72
+
73
+ bias = cuda.local.array(shape=(256,), dtype=types.float64)
74
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, t, n_qubits, bias)
75
+ last_bias = cuda.local.array(shape=(256,), dtype=types.float64)
76
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, tm1, n_qubits, last_bias)
77
+ for i in range(n_qubits - 1):
78
+ hamming_prob[i] += bias[i] - last_bias[i]
79
+
80
+
81
+ @cuda.jit
82
+ def cuda_maxcut_hamming_cdf_512(n_qubits, n_steps, delta_t, tot_t, h_mult, J_func, degrees, theta, hamming_prob):
83
+ qc = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
84
+ step = qc // n_qubits
85
+ q = qc % n_qubits
86
+
87
+ if step >= n_steps:
88
+ return
89
+
90
+ J_eff = J_func[q]
91
+ if abs(J_eff) <= (2 ** (-54)):
92
+ return
93
+
94
+ z = degrees[q]
95
+ theta_eff = theta[q]
96
+ t = step * delta_t
97
+ tm1 = (step - 1) * delta_t
98
+ h_t = h_mult * (tot_t - t)
99
+ n_bias = n_qubits - 1
100
+
101
+ bias = cuda.local.array(shape=(512,), dtype=types.float64)
102
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, t, n_qubits, bias)
103
+ last_bias = cuda.local.array(shape=(512,), dtype=types.float64)
104
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, tm1, n_qubits, last_bias)
105
+ for i in range(n_qubits - 1):
106
+ hamming_prob[i] += bias[i] - last_bias[i]
107
+
108
+
52
109
  @cuda.jit
53
- def cuda_maxcut_hamming_cdf(n_qubits, n_steps, delta_t, tot_t, h_mult, J_func, degrees, theta, hamming_prob):
110
+ def cuda_maxcut_hamming_cdf_1024(n_qubits, n_steps, delta_t, tot_t, h_mult, J_func, degrees, theta, hamming_prob):
54
111
  qc = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
55
112
  step = qc // n_qubits
56
113
  q = qc % n_qubits
@@ -69,13 +126,70 @@ try:
69
126
  h_t = h_mult * (tot_t - t)
70
127
  n_bias = n_qubits - 1
71
128
 
72
- bias = cuda.local.array(shape=(8192,), dtype=types.float64)
129
+ bias = cuda.local.array(shape=(1024,), dtype=types.float64)
73
130
  cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, t, n_qubits, bias)
74
- last_bias = cuda.local.array(shape=(8192,), dtype=types.float64)
131
+ last_bias = cuda.local.array(shape=(1024,), dtype=types.float64)
75
132
  cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, tm1, n_qubits, last_bias)
76
133
  for i in range(n_qubits - 1):
77
134
  hamming_prob[i] += bias[i] - last_bias[i]
78
135
 
136
+
137
+ @cuda.jit
138
+ def cuda_maxcut_hamming_cdf_2048(n_qubits, n_steps, delta_t, tot_t, h_mult, J_func, degrees, theta, hamming_prob):
139
+ qc = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
140
+ step = qc // n_qubits
141
+ q = qc % n_qubits
142
+
143
+ if step >= n_steps:
144
+ return
145
+
146
+ J_eff = J_func[q]
147
+ if abs(J_eff) <= (2 ** (-54)):
148
+ return
149
+
150
+ z = degrees[q]
151
+ theta_eff = theta[q]
152
+ t = step * delta_t
153
+ tm1 = (step - 1) * delta_t
154
+ h_t = h_mult * (tot_t - t)
155
+ n_bias = n_qubits - 1
156
+
157
+ bias = cuda.local.array(shape=(2048,), dtype=types.float64)
158
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, t, n_qubits, bias)
159
+ last_bias = cuda.local.array(shape=(2048,), dtype=types.float64)
160
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, tm1, n_qubits, last_bias)
161
+ for i in range(n_qubits - 1):
162
+ hamming_prob[i] += bias[i] - last_bias[i]
163
+
164
+
165
+ @cuda.jit
166
+ def cuda_maxcut_hamming_cdf_large(n_qubits, n_steps, delta_t, tot_t, h_mult, J_func, degrees, theta, hamming_prob):
167
+ qc = cuda.blockIdx.x * cuda.blockDim.x + cuda.threadIdx.x
168
+ step = qc // n_qubits
169
+ q = qc % n_qubits
170
+
171
+ if step >= n_steps:
172
+ return
173
+
174
+ J_eff = J_func[q]
175
+ if abs(J_eff) <= (2 ** (-54)):
176
+ return
177
+
178
+ z = degrees[q]
179
+ theta_eff = theta[q]
180
+ t = step * delta_t
181
+ tm1 = (step - 1) * delta_t
182
+ h_t = h_mult * (tot_t - t)
183
+ n_bias = n_qubits - 1
184
+
185
+ bias = cuda.local.array(shape=(4096,), dtype=types.float64)
186
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, t, n_qubits, bias)
187
+ for i in range(n_qubits - 1):
188
+ hamming_prob[i] += bias[i]
189
+ cuda_probability_by_hamming_weight(J_eff, h_t, z, theta_eff, tm1, n_qubits, bias)
190
+ for i in range(n_qubits - 1):
191
+ hamming_prob[i] -= bias[i]
192
+
79
193
  except:
80
194
  IS_CUDA_AVAILABLE = False
81
195
 
@@ -299,7 +413,7 @@ def maxcut_tfim(
299
413
  tot_prob += n
300
414
  thresholds /= tot_prob
301
415
 
302
- if IS_CUDA_AVAILABLE and cuda.is_available() and grid_size >= 128 and (n_qubits <= 8192):
416
+ if IS_CUDA_AVAILABLE and cuda.is_available() and grid_size >= 128 and (n_qubits <= 4096):
303
417
  delta_t = 1.0 / n_steps
304
418
  tot_t = n_steps * delta_t
305
419
  h_mult = 32.0 / tot_t
@@ -318,7 +432,16 @@ def maxcut_tfim(
318
432
  )
319
433
  )
320
434
 
321
- cuda_maxcut_hamming_cdf[grid_size, group_size](n_qubits, n_steps, delta_t, tot_t, h_mult, J_eff, degrees, theta, thresholds)
435
+ if n_qubits <= 256:
436
+ cuda_maxcut_hamming_cdf_256[grid_size, group_size](n_qubits, n_steps, delta_t, tot_t, h_mult, J_eff, degrees, theta, thresholds)
437
+ elif n_qubits <= 512:
438
+ cuda_maxcut_hamming_cdf_512[grid_size, group_size](n_qubits, n_steps, delta_t, tot_t, h_mult, J_eff, degrees, theta, thresholds)
439
+ elif n_qubits <= 1024:
440
+ cuda_maxcut_hamming_cdf_1024[grid_size, group_size](n_qubits, n_steps, delta_t, tot_t, h_mult, J_eff, degrees, theta, thresholds)
441
+ elif n_qubits <= 2048:
442
+ cuda_maxcut_hamming_cdf_2048[grid_size, group_size](n_qubits, n_steps, delta_t, tot_t, h_mult, J_eff, degrees, theta, thresholds)
443
+ else:
444
+ cuda_maxcut_hamming_cdf_large[grid_size, group_size](n_qubits, n_steps, delta_t, tot_t, h_mult, J_eff, degrees, theta, thresholds)
322
445
 
323
446
  tot_prob = sum(thresholds)
324
447
  thresholds /= tot_prob
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: PyQrackIsing
3
- Version: 1.14.0
3
+ Version: 1.14.2
4
4
  Summary: Near-ideal closed-form solutions for transverse field Ising model (TFIM)
5
5
  Home-page: https://github.com/vm6502q/PyQrackIsing
6
6
  Author: Dan Strano
@@ -12,7 +12,7 @@ build-backend = "setuptools.build_meta"
12
12
 
13
13
  [project]
14
14
  name = "PyQrackIsing"
15
- version = "1.14.0"
15
+ version = "1.14.2"
16
16
  requires-python = ">=3.8"
17
17
  description = "Near-ideal closed-form solutions for transverse field Ising model (TFIM)"
18
18
  readme = {file = "README.txt", content-type = "text/markdown"}
@@ -51,7 +51,7 @@ ext_modules = [CMakeExtension('tfim_sampler')]
51
51
 
52
52
  setup(
53
53
  name='PyQrackIsing',
54
- version='1.14.0',
54
+ version='1.14.2',
55
55
  author='Dan Strano',
56
56
  author_email='stranoj@gmail.com',
57
57
  description='Near-ideal closed-form solutions for transverse field Ising model (TFIM)',
File without changes
File without changes
File without changes
File without changes