rodluger / starry_process

interpretable gaussian processes for stellar light curves
MIT License
16 stars 5 forks source link

Following quickstart something goes wrong with Theano #28

Closed javiserna closed 1 year ago

javiserna commented 1 year ago

Hi, after I installed dependencies and tried to run the quickstart, appears this error.

In [2]: import numpy as np

In [3]: import matplotlib.pyplot as plt

In [4]: from tqdm.auto import tqdm

In [5]: sp = StarryProcess()

In [6]: sp.r
Out[6]: Elemwise{mul,no_inplace}.0

In [7]: sp.r.eval()
Out[7]: array(20.)

In [8]: y = sp.sample_ylm().eval()

You can find the C code in this temporary file: /tmp/theano_compilation_error_iie8tb6w ERROR (theano.graph.opt): Optimization failure due to: constant_folding ERROR (theano.graph.opt): node: LatitudeIntegralOp{ydeg=15, udeg=2, compile_args=()}(TensorConstant{54.598150033144236}, TensorConstant{8.971048493895104}) ERROR (theano.graph.opt): TRACEBACK: ERROR (theano.graph.opt): Traceback (most recent call last): File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/graph/opt.py", line 2017, in process_node replacements = lopt.transform(fgraph, node) File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/graph/opt.py", line 1209, in transform return self.fn(*args, *kwargs) File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/tensor/opt.py", line 7007, in constant_folding node, storage_map, compute_map, no_recycling=[], impl=impl File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/graph/op.py", line 634, in make_thunk return self.make_c_thunk(node, storage_map, compute_map, no_recycling) File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/graph/op.py", line 601, in make_c_thunk input_storage=node_input_storage, output_storage=node_output_storage File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/link/c/basic.py", line 1204, in make_thunk input_storage, output_storage, storage_map File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/link/c/basic.py", line 1142, in compile storage_map, File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/link/c/basic.py", line 1634, in cthunk_factory module = get_module_cache().module_from_key(key=key, lnk=self) File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/link/c/cmodule.py", line 1191, in module_from_key module = lnk.compile_cmodule(location) File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/link/c/basic.py", line 1550, in compile_cmodule preargs=preargs, File "/home/jserna/Astro/TOOLS/anaconda3/lib/python3.7/site-packages/theano/link/c/cmodule.py", line 2547, in compile_str f"Compilation failed (return status={status}): {compile_stderr}" Exception: ('Compilation failed (return status=1): g++: error: unrecognized command line option ‘-std=c++14’. ', 'FunctionGraph(1 -> LatitudeIntegralOp{ydeg=15, udeg=2, compile_args=()}(TensorConstant{54.598150033144236}, TensorConstant{8.971048493895104}), 1::1, 1::2, 1::3, 1::4, *1::5)')

Any idea of how to solve it? Appreciate if you find a solution.

dfm commented 1 year ago

It looks like your version of the GCC compilers are too old - support for C++14 is required. Perhaps try updating your compilers?

javiserna commented 1 year ago

Thanks for the advice, Dam. I have updated my compiler to C++14, as you suggested, and it continues not to work.

I have attached the code that I'm running and the list of errors. pleasehelpme.txt

dfm commented 1 year ago

That error looks to be the same as the one discussed over here: https://github.com/rodluger/starry/issues/302#issuecomment-1094136350 See if the suggested fix also does the trick for you!

javiserna commented 1 year ago

Finally, I got a solution.

I instantiated this code before importing the starry_process library, and the errors disappeared.

import theano theano.config.gcc__cxxflags += " -fexceptions" theano.config.on_opt_error = "raise" theano.tensor.opt.constant_folding theano.graph.opt.EquilibriumOptimizer

Appreciate the help