Cannot use more than one core with pymc3

Every time I use more than one core on my pymc3, I get the following error -

RuntimeError: Chain 0 failed.

Here’s my code -

import pymc3 as pm
import numpy as np
import matplotlib.pyplot as plt
obs_y = np.random.normal(0.5, 0.35, 2000)
with pm.Model() as exercise1:
    
    mu = pm.Normal('mu', mu = 0.0, sd = .05)
    stdev = pm.HalfNormal('stdev', sd=.05)
    
    y = pm.Normal('y', mu = mu, sd = stdev, observed = obs_y)
    
    trace = pm.sample(1000, cores=2)
    pm.traceplot(trace)
    plt.show()

This problem doesn’t occur when I use the following code -

trace = pm.sample(1000, cores=1)

Here are my library versions. My objective was to run my sampling using GPU, therefore I installed pygpu, which might have caused the issue.

Theano-PyMC          1.1.2
pygpu                0.7.6                                                                                              
pymc3                3.11.5
1 Like

What platform are you on? Windows by any chance? Have you tried the v4 beta yet?

1 Like

Thank you for your reply. I am using Windows. I decided against v4 since the version is being discontinued.

v4 is not being discontinued (the long, somewhat confusing story is here). It is in beta right now and due for release “imminently”. The installation instructions (version for windows is here) have now been changed to suggest v4 (beta). I would probably try that before trying to get a version working in v3.

1 Like

Thank you very much for the information.

1 Like