Page 1 of 1

Cobaya bug in convergence check

Posted: September 13 2021
by João Rebouças
Hi! I'm using Cobaya to make cosmological MCMCs. I'm analyzing quintessence models with a modified version of CAMB. To do this, i'm configuring a hybrid OpenMP+MPI job script for GridUnesp, the cluster in my university. I used 4 MPI processes. When I run the chain, the following error appears when the first convergence check occurs:

Code: Select all

(...)
[3 : mcmc] Progress @ 2021-09-01 13:39:58 : 673 steps taken, and 257 accepted.
[1 : mcmc] Progress @ 2021-09-01 13:40:17 : 714 steps taken, and 239 accepted.
[2 : mcmc] Progress @ 2021-09-01 13:40:40 : 704 steps taken, and 246 accepted.
[0 : mcmc] Progress @ 2021-09-01 13:40:48 : 696 steps taken, and 269 accepted.
[1 : mcmc] Learn + convergence test @ 240 samples accepted.
[1 : mcmc] Ready to check convergence and learn a new proposal covmat (waiting for the rest...)
[3 : mcmc] Progress @ 2021-09-01 13:41:02 : 676 steps taken, and 258 accepted.
[1 : mcmc] --------------------

AttributeError: 'float' object has no attribute 'rint'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 57, in _wrapfunc
    return bound(*args, **kwds)
TypeError: loop of ufunc does not support argument 0 of type float which has no callable rint method

During handling of the above exception, another exception occurred:

AttributeError: 'float' object has no attribute 'rint'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/cobaya/samplers/mcmc/mcmc.py", line 374, in run
    self.check_convergence_and_learn_proposal()
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/contextlib.py", line 75, in inner
    return func(*args, **kwds)
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/cobaya/samplers/mcmc/mcmc.py", line 606, in check_convergence_and_learn_proposal
    cov = self.collection.cov(first=use_first)
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/cobaya/collection.py", line 428, in cov
    kwarg = "fweights" if np.allclose(np.round(weights), weights) else "aweights"
  File "<__array_function__ internals>", line 5, in round_
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3739, in round_
    return around(a, decimals=decimals, out=out)
  File "<__array_function__ internals>", line 5, in around
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 3314, in around
    return _wrapfunc(a, 'round', decimals=decimals, out=out)
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 66, in _wrapfunc
    return _wrapit(obj, method, *args, **kwds)
  File "/home/joaoreboucas/.conda/envs/cobaya-env/lib/python3.8/site-packages/numpy/core/fromnumeric.py", line 43, in _wrapit
    result = getattr(asarray(obj), method)(*args, **kwds)
TypeError: loop of ufunc does not support argument 0 of type float which has no callable rint method
This also happens with usual Lambda-CDM chains and I'm using the template .yaml file in the Cobaya documentation. Can anyone help me?

Re: Cobaya bug in convergence check

Posted: September 17 2021
by Antony Lewis
Cobaya 3.1.1?