Aesara is not threadsafe
Please provide a minimal, self-contained, and reproducible example.
import threading
import aesara
import numpy as np
import aesara.tensor as at
import aesara.compile.compiledir
aesara.compile.compiledir.cleanup()
np.random.seed(32)
def run_aesara(i, out):
s = np.random.randint(10, 50)
a = at.random.normal(size=(s, s))
fn = aesara.function([],a)
for _ in range(10):
fn()
out[i] = True
T = 32
out = [None] * T
threads = [threading.Thread(target=run_aesara, args=(i, out)) for i in range(T)]
[t.start() for t in threads]
[t.join() for t in threads]
assert all(out)
Please provide the full traceback of any errors.
ERROR (aesara.graph.opt): Optimization failure due to: constant_folding
ERROR (aesara.graph.opt): node: Subtensor{int64}(TensorConstant{(2,) of 36}, ScalarConstant{1})
ERROR (aesara.graph.opt): TRACEBACK:
ERROR (aesara.graph.opt): Traceback (most recent call last):
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/graph/opt.py", line 1850, in process_node
replacements = lopt.transform(fgraph, node)
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/graph/opt.py", line 1055, in transform
return self.fn(fgraph, node)
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/tensor/basic_opt.py", line 2943, in constant_folding
thunk = node.op.make_thunk(node, storage_map, compute_map, no_recycling=[])
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/op.py", line 131, in make_thunk
return self.make_c_thunk(node, storage_map, compute_map, no_recycling)
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/op.py", line 96, in make_c_thunk
outputs = cl.make_thunk(
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1192, in make_thunk
cthunk, module, in_storage, out_storage, error_storage = self.__compile__(
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1127, in __compile__
thunk, module = self.cthunk_factory(
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/basic.py", line 1623, in cthunk_factory
module = get_module_cache().module_from_key(key=key, lnk=self)
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 1183, in module_from_key
module = self._get_from_hash(module_hash, key)
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 1086, in _get_from_hash
key_data.add_key(key, save_pkl=bool(key[0]))
File "/home/ferres/.miniconda3/envs/pymc/lib/python3.9/site-packages/aesara/link/c/cmodule.py", line 526, in add_key
assert key not in self.keys
AssertionError
Please provide any additional information below.
Versions and main components
Aesara is not threadsafe
Please provide a minimal, self-contained, and reproducible example.
Please provide the full traceback of any errors.
Please provide any additional information below.
Versions and main components