Skip to content

Commit

Permalink
Add test for pickle with dill
Browse files Browse the repository at this point in the history
  • Loading branch information
aseyboldt committed Jul 7, 2020
1 parent 9789ec6 commit 8b36471
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pymc3/tests/test_parallel_sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import multiprocessing
import os

import pytest
i/mport pytest
import pymc3.parallel_sampling as ps
import pymc3 as pm
import theano
Expand Down Expand Up @@ -51,13 +51,21 @@ def test_bad_unpickle():


tt_vector = tt.TensorType(theano.config.floatX, [False])


@theano.as_op([tt_vector, tt.iscalar], [tt_vector])
def _crash_remote_process(a, master_pid):
if os.getpid() != master_pid:
os.exit(0)
return 2 * np.array(a)


def test_dill():
with pm.Model():
pm.Normal('x')
pm.sample(tune=1, draws=1, chains=2, cores=2, pickle_backend="dill", mp_ctx="spawn")


def test_remote_pipe_closed():
master_pid = os.getpid()
with pm.Model():
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ seaborn>=0.8.1
sphinx-autobuild==0.7.1
sphinx>=1.5.5
watermark
dill

0 comments on commit 8b36471

Please sign in to comment.