Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison between int and None fails under python3 when resuming MCMC #12

Closed
joezuntz opened this issue Dec 6, 2018 · 2 comments
Closed

Comments

@joezuntz
Copy link

joezuntz commented Dec 6, 2018

When setting resume=True and calling via the API there is a crash, which I think comes from a change between python 2 and python 3. In py2 you can do, e.g. 1>None and it will just return False, but in py3 it raises an error. I think that's what's happening in the traceback below.

[SNIP some external bits]
    self.cobaya_run(info)
  File "/usr/local/lib/python3.6/dist-packages/cobaya/run.py", line 64, in run
    modules=info.get(_path_install)) as sampler:
  File "/usr/local/lib/python3.6/dist-packages/cobaya/sampler.py", line 188, in get_sampler
    info_sampler[name], posterior, output_file, resume=resume, modules=modules)
  File "/usr/local/lib/python3.6/dist-packages/cobaya/sampler.py", line 150, in __init__
    self.initialize()
  File "/usr/local/lib/python3.6/dist-packages/cobaya/samplers/mcmc/mcmc.py", line 59, in initialize
    if self.resuming and (max(self.mpi_size, 1) != max(get_mpi_size(), 1)):
TypeError: '>' not supported between instances of 'int' and 'NoneType'
JesusTorrado added a commit that referenced this issue Dec 6, 2018
@JesusTorrado
Copy link
Contributor

Hi Joe,

Thanks for the issue! Would you mind checking if the last commit fixes it?

Cheers
Jesús

@joezuntz
Copy link
Author

joezuntz commented Dec 7, 2018

Hi Jesus,

That does seem to fix it - thanks! I've hit another issue which I'll open separately.

Cheers,
Joe

@joezuntz joezuntz closed this as completed Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants