lesgourg / class_public

Public repository of the Cosmic Linear Anisotropy Solving System (master for the most recent version of the standard code; GW_CLASS to include Cosmic Gravitational Wave Background anisotropies; classnet branch for acceleration with neutral networks; ExoCLASS branch for exotic energy injection; class_matter branch for FFTlog)
223 stars 292 forks source link

Exoclass segmentation fault #479

Open dipan0811 opened 2 years ago

dipan0811 commented 2 years ago

Hi,

I am trying to run exoclass with the default example_energy_injection.ini file just to check if it's working after compilation. I get a set fault on a Mac machine with M1 64 bit

./class example_energy_injection.ini Reading input parameters -> matched budget equations by adjusting Omega_Lambda = 6.872750e-01 -> matched budget equations by adjusting Omega_Lambda = 7.128334e-01 -> matched budget equations by adjusting Omega_Lambda = 6.880522e-01 -> matched budget equations by adjusting Omega_Lambda = 6.599191e-01 -> matched budget equations by adjusting Omega_Lambda = 6.744410e-01 -> matched budget equations by adjusting Omega_Lambda = 6.834012e-01 -> matched budget equations by adjusting Omega_Lambda = 6.857396e-01 Computing unknown input parameters -> found h = 6.714143e-01 -> matched budget equations by adjusting Omega_Lambda = 6.834012e-01 Running ExoCLASS version v2.7.2 Computing background -> age = 13.825182 Gyr -> conformal age = 14171.057088 Mpc -> radiation/matter equality at z = 3409.370722 corresponding to conformal time = 112.588146 Mpc Computing thermodynamics with Y_He=0.2466 -> running: python /Users/dipan/class_public-ExoCLASS/DarkAgesModule/bin/DarkAges --hist=decay --spectrum dirac_photon dirac_electron --mass=5 --branching 0.5 0.5 --tdec=3.09176e+24 zsh: segmentation fault ./class example_energy_injection.ini

Please check.

Best, Dipan.

pstoecker commented 2 years ago

Hey Dipan,

there could be some problem either with the python code, run at this point or when class gets the results from the code.

Could you just try to put this command into your terminal python /Users/dipan/class_public-ExoCLASS/DarkAgesModule/bin/DarkAges --hist=decay --spectrum dirac_photon dirac_electron --mass=5 --branching 0.5 0.5 --tdec=3.09176e+24 and tell me what the result is that is shown on screen?

Best, Patrick

dipan0811 commented 2 years ago

Hey Patrick,

Thanks for your quick reply. Here's what I get,

##################################################

This is the standardized output to be read by CLASS.

For the correct usage ensure that all other

"print(...)"-commands in your script are silenced.

##################################################

z_dep f_heat f_lya f_ionH f_ionHe f_lowE

64

0.00e+00 6.7175e-03 1.1194e-02 1.5272e-02 5.4500e-04 7.1291e-03 1.20e+01 6.7175e-03 1.1194e-02 1.5272e-02 5.4500e-04 7.1291e-03 1.32e+01 6.5883e-03 1.1052e-02 1.5034e-02 5.3537e-04 7.1860e-03 1.45e+01 6.4737e-03 1.0928e-02 1.4828e-02 5.2846e-04 7.2931e-03 1.59e+01 6.3730e-03 1.0825e-02 1.4636e-02 5.2433e-04 7.4548e-03 1.75e+01 6.2771e-03 1.0775e-02 1.4449e-02 5.1510e-04 7.6806e-03 1.92e+01 6.1877e-03 1.0731e-02 1.4291e-02 5.0784e-04 7.9846e-03 2.10e+01 6.1133e-03 1.0697e-02 1.4155e-02 5.0536e-04 8.3889e-03 2.30e+01 6.0365e-03 1.0707e-02 1.4010e-02 5.0064e-04 8.8979e-03 2.53e+01 5.9757e-03 1.0695e-02 1.3913e-02 4.9904e-04 9.5252e-03 2.77e+01 5.9175e-03 1.0704e-02 1.3848e-02 4.9648e-04 1.0279e-02 3.03e+01 5.8837e-03 1.0742e-02 1.3787e-02 4.9824e-04 1.1179e-02 3.32e+01 5.8544e-03 1.0783e-02 1.3791e-02 4.9927e-04 1.2246e-02 3.63e+01 5.8475e-03 1.0848e-02 1.3803e-02 5.0526e-04 1.3490e-02 3.97e+01 5.8487e-03 1.0962e-02 1.3821e-02 5.0600e-04 1.4953e-02 4.34e+01 5.8697e-03 1.1083e-02 1.3877e-02 5.1189e-04 1.6643e-02 4.75e+01 5.9113e-03 1.1222e-02 1.3959e-02 5.1391e-04 1.8593e-02 5.20e+01 5.9647e-03 1.1381e-02 1.4092e-02 5.1738e-04 2.0815e-02 5.68e+01 6.0315e-03 1.1566e-02 1.4248e-02 5.2114e-04 2.3333e-02 6.21e+01 6.1060e-03 1.1784e-02 1.4454e-02 5.2953e-04 2.6183e-02 6.79e+01 6.2024e-03 1.2033e-02 1.4689e-02 5.3317e-04 2.9390e-02 7.43e+01 6.3139e-03 1.2323e-02 1.4990e-02 5.4025e-04 3.2969e-02 8.12e+01 6.4457e-03 1.2656e-02 1.5338e-02 5.4340e-04 3.6934e-02 8.87e+01 6.6061e-03 1.3037e-02 1.5753e-02 5.5031e-04 4.1307e-02 9.69e+01 6.8010e-03 1.3470e-02 1.6258e-02 5.6195e-04 4.6086e-02 1.06e+02 7.0219e-03 1.3972e-02 1.6847e-02 5.7887e-04 5.1285e-02 1.16e+02 7.2896e-03 1.4551e-02 1.7551e-02 5.8507e-04 5.6905e-02 1.26e+02 7.6174e-03 1.5216e-02 1.8388e-02 6.0437e-04 6.2946e-02 1.38e+02 7.9968e-03 1.5988e-02 1.9375e-02 6.2072e-04 6.9386e-02 1.51e+02 8.4517e-03 1.6869e-02 2.0534e-02 6.3966e-04 7.6221e-02 1.65e+02 9.0056e-03 1.7873e-02 2.1875e-02 6.6993e-04 8.3412e-02 1.80e+02 9.6441e-03 1.9023e-02 2.3455e-02 6.9493e-04 9.0937e-02 1.97e+02 1.0408e-02 2.0317e-02 2.5293e-02 7.1861e-04 9.8758e-02 2.15e+02 1.1303e-02 2.1777e-02 2.7403e-02 7.5714e-04 1.0684e-01 2.34e+02 1.2353e-02 2.3429e-02 2.9814e-02 7.9431e-04 1.1513e-01 2.56e+02 1.3582e-02 2.5276e-02 3.2562e-02 8.4182e-04 1.2359e-01 2.80e+02 1.5006e-02 2.7326e-02 3.5661e-02 8.9666e-04 1.3216e-01 3.05e+02 1.6655e-02 2.9602e-02 3.9126e-02 9.5500e-04 1.4078e-01 3.33e+02 1.8563e-02 3.2094e-02 4.2993e-02 1.0337e-03 1.4940e-01 3.64e+02 2.0758e-02 3.4817e-02 4.7254e-02 1.1157e-03 1.5794e-01 3.98e+02 2.3283e-02 3.7767e-02 5.1939e-02 1.2041e-03 1.6635e-01 4.34e+02 2.6204e-02 4.0876e-02 5.6953e-02 1.3144e-03 1.7453e-01 4.74e+02 2.9596e-02 4.4143e-02 6.2327e-02 1.4268e-03 1.8242e-01 5.18e+02 3.3541e-02 4.7566e-02 6.8046e-02 1.5537e-03 1.8993e-01 5.65e+02 3.8222e-02 5.1082e-02 7.4089e-02 1.6849e-03 1.9700e-01 6.17e+02 4.3908e-02 5.4613e-02 8.0368e-02 1.8398e-03 2.0349e-01 6.74e+02 5.0692e-02 5.7815e-02 8.6794e-02 2.0494e-03 2.0919e-01 7.36e+02 6.0204e-02 6.0346e-02 9.2433e-02 2.3908e-03 2.1401e-01 8.03e+02 7.5105e-02 6.0477e-02 9.7755e-02 2.3675e-03 2.1660e-01 8.77e+02 1.0069e-01 5.7764e-02 9.7250e-02 2.5804e-03 2.1732e-01 9.58e+02 1.4079e-01 5.0550e-02 9.1575e-02 2.3913e-03 2.1437e-01 1.05e+03 1.9141e-01 4.0309e-02 8.1450e-02 1.6778e-03 2.0833e-01 1.14e+03 2.4335e-01 3.2045e-02 7.2754e-02 1.0888e-03 2.0015e-01 1.25e+03 2.8862e-01 2.6128e-02 6.6136e-02 7.9753e-04 1.9095e-01 1.36e+03 3.2459e-01 2.3177e-02 6.3713e-02 5.1330e-04 1.8250e-01 1.49e+03 3.5086e-01 2.2066e-02 6.3432e-02 3.3786e-04 1.7603e-01 1.62e+03 3.7154e-01 2.2632e-02 6.5113e-02 4.7041e-04 1.7248e-01 1.77e+03 3.8743e-01 2.3634e-02 6.7378e-02 5.2525e-04 1.6888e-01 1.93e+03 4.0586e-01 2.4573e-02 6.8974e-02 5.6088e-04 1.6529e-01 2.11e+03 4.2102e-01 2.5504e-02 7.0147e-02 5.9078e-04 1.6052e-01 2.30e+03 4.2103e-01 2.6119e-02 6.9942e-02 5.9586e-04 1.5150e-01 2.52e+03 3.7751e-01 2.5113e-02 6.4684e-02 5.3817e-04 1.2991e-01 2.75e+03 1.9917e-01 1.6438e-02 3.9644e-02 2.7482e-04 6.6567e-02 1.00e+04 1.9917e-01 1.6438e-02 3.9644e-02 2.7482e-04 6.6567e-02

All of this kind of makes sense. Not sure then why set fault happens

pstoecker commented 2 years ago

Ok thanks.

This is the format of this output is exactly what class expects, so the issue might have to do with how class reads these values and assigns them to the respective arrays. Can you make sure whether the function thermodynamics_annihilation_coefficients_init is completed? The easiest way is to add something like printf("THIS IS A FLAG\n"); right before the end of the function (line 1461 in source/thermodynamics.c) and to recompile the code. When you cannot read this message on screen and the segfault occurs before, we narrowed down the issue to the function.

If you can read it, this means that the table is read successfully. This means that the issue is even further down the line and is just covered by the fact that thermodynamics_verbose is one. Please try to increase it. Maybe it will hint at the exact place in the code where things can go wrong.

dipan0811 commented 2 years ago

Hi ,

Thanks again for your quick response.

dipan@Dipans-MacBook-Pro class_public-ExoCLASS % ./class example_energy_injection.ini Reading input parameters -> matched budget equations by adjusting Omega_Lambda = 6.872750e-01 -> matched budget equations by adjusting Omega_Lambda = 7.128334e-01 THIS IS A FLAG -> matched budget equations by adjusting Omega_Lambda = 6.880522e-01 THIS IS A FLAG -> matched budget equations by adjusting Omega_Lambda = 6.599191e-01 THIS IS A FLAG -> matched budget equations by adjusting Omega_Lambda = 6.744410e-01 THIS IS A FLAG -> matched budget equations by adjusting Omega_Lambda = 6.834012e-01 THIS IS A FLAG -> matched budget equations by adjusting Omega_Lambda = 6.857396e-01 THIS IS A FLAG Computing unknown input parameters -> found h = 6.714143e-01 -> matched budget equations by adjusting Omega_Lambda = 6.834012e-01 Running ExoCLASS version v2.7.2 Computing background -> age = 13.825182 Gyr -> conformal age = 14171.057088 Mpc -> radiation/matter equality at z = 3409.370722 corresponding to conformal time = 112.588146 Mpc Computing thermodynamics with Y_He=0.2466 -> running: python /Users/dipan/class_public-ExoCLASS/DarkAgesModule/bin/DarkAges --hist=decay --spectrum dirac_photon dirac_electron --mass=5 --branching 0.5 0.5 --tdec=3.09176e+24 THIS IS A FLAG zsh: segmentation fault ./class example_energy_injection.ini

Seems like it doesn't like this block beyond a point. I increased thermodynamics_verbose to 100.

However if I take the default class ini file, and put in the parameters in that file , it seems to work. Am doing further checks .