Commit b783aa1
committed
aperture: fixing bug with aperture on GPU...
... when running the slice monitor on the GPU, the aperture would
shorten the arrays (via beam.x = beam.x[:n_alive]) in case
of lost particles (n_alive > 0) in a way which is incompatible
with storing the slice statistics.
This only occurs on the GPU (where beam.x would be a GPUArray,
while n_alive has been transformed into a numpy.array because
pm.sum contains a .get() for summing on the GPU).
The fix is to make n_alive a simple integer instead of a
numpy.array...
The usual error message in python2 when only using pm.sum for n_alive:
TypeError: slice indices must be integers or None or have an __index__ method
(therefore wrapping it with a np.int32)
Thanks Eirini for spotting this.1 parent bfb793e commit b783aa1
1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
89 | 88 | | |
90 | 89 | | |
91 | 90 | | |
92 | | - | |
93 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
0 commit comments