Skip to content

Problem sampling with cores >1 #4167

Closed
Closed
@fccoelho

Description

@fccoelho

Description of your problem

I am getting this exception whenever I try to sample with more than one core.

Please provide a minimal, self-contained, and reproducible example.
I am trying to run the code from this example.

Please provide the full traceback.

ConnectionResetError                      Traceback (most recent call last)
<ipython-input-4-b9d2bf1ba15b> in <module>()
     11     Y = pm.Lognormal('Y', mu=pm.math.log(sir_curves), sigma=sigma, observed=yobs)
     12 
---> 13     trace = pm.sample(2000, tune=1000, target_accept=0.9, cores=8)
     14     data = az.from_pymc3(trace=trace)

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/site-packages/pymc3/sampling.py in sample(draws, step, init, n_init, start, trace, chain_idx, chains, cores, tune, progressbar, model, random_seed, discard_tuned_samples, compute_convergence_checks, callback, return_inferencedata, idata_kwargs, mp_ctx, pickle_backend, **kwargs)
    543         _print_step_hierarchy(step)
    544         try:
--> 545             trace = _mp_sample(**sample_args, **parallel_args)
    546         except pickle.PickleError:
    547             _log.warning("Could not pickle model, sampling singlethreaded.")

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/site-packages/pymc3/sampling.py in _mp_sample(draws, tune, step, chains, cores, chain, random_seed, start, progressbar, trace, model, callback, discard_tuned_samples, mp_ctx, pickle_backend, **kwargs)
   1484         try:
   1485             with sampler:
-> 1486                 for draw in sampler:
   1487                     trace = traces[draw.chain - chain]
   1488                     if trace.supports_sampler_stats and draw.stats is not None:

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/site-packages/pymc3/parallel_sampling.py in __iter__(self)
    490 
    491         while self._active:
--> 492             draw = ProcessAdapter.recv_draw(self._active)
    493             proc, is_last, draw, tuning, stats, warns = draw
    494             self._total_draws += 1

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/site-packages/pymc3/parallel_sampling.py in recv_draw(processes, timeout)
    355         idxs = {id(proc._msg_pipe): proc for proc in processes}
    356         proc = idxs[id(ready[0])]
--> 357         msg = ready[0].recv()
    358 
    359         if msg[0] == "error":

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/multiprocessing/connection.py in recv(self)
    248         self._check_closed()
    249         self._check_readable()
--> 250         buf = self._recv_bytes()
    251         return _ForkingPickler.loads(buf.getbuffer())
    252 

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/multiprocessing/connection.py in _recv_bytes(self, maxsize)
    405 
    406     def _recv_bytes(self, maxsize=None):
--> 407         buf = self._recv(4)
    408         size, = struct.unpack("!i", buf.getvalue())
    409         if maxsize is not None and size > maxsize:

/home/fccoelho/Downloads/SageMath/local/lib/python3.7/multiprocessing/connection.py in _recv(self, size, read)
    377         remaining = size
    378         while remaining > 0:
--> 379             chunk = read(handle, remaining)
    380             n = len(chunk)
    381             if n == 0:

ConnectionResetError: [Errno 104] Connection reset by peer

Please provide any additional information below.

Versions and main components

  • PyMC3 Version: 3.9.3
  • Theano Version: 1.0.5
  • Python Version: 3.7
  • Operating system: Ubuntu
  • How did you install PyMC3: pip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions