We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c712909 commit adcc5f3Copy full SHA for adcc5f3
backtesting/backtesting.py
@@ -1508,12 +1508,15 @@ def _batch(seq):
1508
with mp.Pool() as pool, \
1509
SharedMemoryManager() as smm:
1510
1511
+ shm_refs = [] # https://stackoverflow.com/questions/74193377/filenotfounderror-when-passing-a-shared-memory-to-a-new-process#comment130999060_74194875 # noqa: E501
1512
+
1513
def arr2shm(vals):
1514
nonlocal smm
1515
shm = smm.SharedMemory(size=vals.nbytes)
1516
buf = np.ndarray(vals.shape, dtype=vals.dtype, buffer=shm.buf)
1517
buf[:] = vals[:] # Copy into shared memory
1518
assert vals.ndim == 1, (vals.ndim, vals.shape, vals)
1519
+ shm_refs.append(shm)
1520
return shm.name, vals.shape, vals.dtype
1521
1522
data_shm = tuple((
0 commit comments