Forward func with dispatch="parallel" hangs forever with custom provenance
susuzheng opened this issue · comments
Example with provided custom provenance (diffaddmultprob2
):
import scallopy
import torch
from logic_classifier import DiffMlnProbSemiring
ctx = scallopy.ScallopContext(provenance="diffaddmultprob2")
ctx.add_relation("digit_1", int, list(range(10)))
ctx.add_relation("digit_2", int, list(range(10)))
ctx.add_rule("sum_2(a + b) = digit_1(a), digit_2(b)")
sum_2 = ctx.forward_function("sum_2", list(range(19)), dispatch="parallel")
digit_1 = torch.randn((16, 10))
digit_2 = torch.randn((16, 10))
result = sum_2(digit_1=digit_1, digit_2=digit_2)
print(result)
Running this script hangs forever... It's not a big deal, as dispatch="single" still works. I guess pyo3
may have some concurrency issue, though I did not verify anything.
Thanks for pointing out the issue. The fix to this will be pushed out a bit later.
I have added default dispatch fallback to be serial
(which should be technically faster than single
). I'm closing the issue due to the fix.