montepython_public icon indicating copy to clipboard operation
montepython_public copied to clipboard

issue when running with -m Der

Open tsmith2 opened this issue 3 years ago • 2 comments

I am attempting to compute additional derived parameters and when I run with MP 3.5 and python 3.8.5 I get the following error:

File "montepython/MontePython.py", line 40, in <module> sys.exit(run()) File "/home/tsmith2/montepython_public_v3p5/montepython/run.py", line 45, in run sampler.run(cosmo, data, command_line) File "/home/tsmith2/montepython_public_v3p5/montepython/sampler.py", line 62, in run der.run(cosmo, data, command_line) File "/home/tsmith2/montepython_public_v3p5/montepython/add_derived.py", line 76, in run pool.map(extend_chain_star, args) File "/home/tsmith2/anaconda3/lib/python3.8/multiprocessing/pool.py", line 364, in map return self._map_async(func, iterable, mapstar, chunksize).get() File "/home/tsmith2/anaconda3/lib/python3.8/multiprocessing/pool.py", line 771, in get raise self._value File "/home/tsmith2/anaconda3/lib/python3.8/multiprocessing/pool.py", line 537, in _handle_tasks put(task) File "/home/tsmith2/anaconda3/lib/python3.8/multiprocessing/connection.py", line 206, in send self._send_bytes(_ForkingPickler.dumps(obj)) File "/home/tsmith2/anaconda3/lib/python3.8/multiprocessing/reduction.py", line 51, in dumps cls(buf, protocol).dump(obj) TypeError: cannot pickle '_io.TextIOWrapper' object

Any suggestions on how to fix this is appreciated!

tsmith2 avatar Jan 29 '22 01:01 tsmith2

Hi Tristan,

See issue #101 , I'm not sure, but it looks like it might be related? I see I pushed a fix with v3.3, but I think that was only point 2, while point 1 has to do with pickling errors when adding derived parameters. Apparently I need to work on my reading comprehension and fix all errors in a bug report.

Best, Thejs

brinckmann avatar Jan 29 '22 11:01 brinckmann

Hi Thejs,

The solution mentioned in point 1 worked for me— thanks! Now I am running into a second issue: I am computing the damping scale as the new derived parameter, so there is no need to compute perturbations… however, when I run the command I get the following CLASS error:

Error in Class: input_init(L:654) :error in input_get_guess(x_inout, dxdF, &fzw, errmsg); =>input_get_guess(L:5376) :error in input_read_parameters(&(pfzw->fc), &pr, &ba, &th, &pt, &tr, &pm, &sp, &nl, &le, &op, errmsg); =>input_read_parameters(L:3791) :condition (ppt->has_perturbations == _FALSE_) is true; You requested non linear computation but no linear computation. You must set output to tCl or similar.

I fixed that by modifying

for key in ['lensing', 'l_max_scalars','non linear']: if key in data.cosmo_arguments.keys(): data.cosmo_arguments.pop(key)

Then CLASS was seg faulting... I was able to get things to finally work by setting data.cosmo_arguments.update({'output':'mPk'}) since one of the derived parameters in the original chain is sigma8. However, since the values of sigma8 are already in the original chain, I am guessing there is a way to avoid re-computing it. Do you have any suggestions on how I can avoid recomputing sigma8?

I also have a question about how the chains are analyzed: I saw that -m Der does not support mpi, so does that mean that each chain is analyzed serially?

Thanks again for any insights!

Best, Tristan

tsmith2 avatar Jan 29 '22 14:01 tsmith2