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)
225 stars 282 forks source link

segault with tensor perturbations in 3.2.0 #517

Open adematti opened 1 year ago

adematti commented 1 year ago

Hi,

I'm getting random segfault when computing perturbations with tensor modes. Here is a code snippet to reproduce the segfault (it may have to be run several times before a segfault occurs).

from classy import Class
from i in range(20):
    cosmo = Class()
    cosmo.set({'k_output_values': '0.01', 'output': 'dTk,vTk,tCl,pCl,mPk', 'modes': 's,t'})
    cosmo.compute(level=['perturb'])
    cosmo.struct_cleanup()
    cosmo.empty()

Sometimes I'm also getting this error message (I don't know if this is related to the same issue --- just posting in case that helps):

pyclass.binding.ClassBadValueError: transfer_init(L:219) :error in transfer_indices(ppr,ppt,ptr,q_period,pba->K,pba->sgnK);
=>transfer_indices(L:595) :error in transfer_get_k_list(ppt,ptr,K);
=>transfer_get_k_list(L:1302) :condition (ptr->k[index_md][ptr->q_size-1] > ppt->k[0][ppt->k_size_cl[0]-1]) is true; bug in k_list calculation: in perturbation module k_max=1.119916e-05, in transfer module k_max[mode=0]=9.989325e-03, interpolation impossible
Erreur de segmentation (core dumped)

No such issue occurs with versions 3.1.2 and 3.1.3, only with 3.2.0, and the problem only occurs when asking for perturbations (background and thermodynamics are running fine). I will try to investigate more if I find some time, but can't promise.