CmdStanPy - terminated by signal 11

When I integrate OpenCL with my Stan model, my code crashes as I get the following error. I found online that error code 11 is related to segfault but I’m not sure how to address it as when I compile my model without OpenCL, my code runs fine. I have also tested it in cmdstanr without OpenCL and the sampling process runs without issue. Here is the error output.

I have also attached my model below.
normal_exponential.stan (465 Bytes)

10:15:34 - cmdstanpy - ERROR - CmdStan error: terminated by signal 11 Unknown error -11

                                                                                                                                                                                                                                                                                                                                                                                                                

10:15:35 - cmdstanpy - INFO - CmdStan done processing.


---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/scratch/local/jobs/96247/ipykernel_3473650/1185432371.py in <module>
----> 1 fit = model.sample(data="data.json",
      2                    #inits=init,
      3                    chains = 5,
      4                    parallel_chains = 5,
      5                    threads_per_chain = 5,

~/.local/lib/python3.8/site-packages/cmdstanpy/model.py in sample(self, data, chains, parallel_chains, threads_per_chain, seed, chain_ids, inits, iter_warmup, iter_sampling, save_warmup, thin, max_treedepth, metric, step_size, adapt_engaged, adapt_delta, adapt_init_phase, adapt_metric_window, adapt_step_size, fixed_param, output_dir, sig_figs, save_latent_dynamics, save_profile, show_progress, show_console, refresh, time_fmt, timeout, force_one_process_per_chain)
   1186                     + ' output is unclear!'
   1187                 )
-> 1188                 raise RuntimeError(msg)
   1189             if errors:
   1190                 msg = (

RuntimeError: Error during sampling:
Exception: exponential_lpdf(OpenCL): Inverse scale parameter[3073, 0] = 0, but it must be positive finite! (in '/home/chrisliao/7mde_bayes/normal_exponential_3/normal_exponential.stan', line 22, column 2 to column 40)
	Exception: exponential_lpdf(OpenCL): Inverse scale parameter[3217, 0] = 0, but it must be positive finite! (in '/home/chrisliao/7mde_bayes/normal_exponential_3/normal_exponential.stan', line 22, column 2 to column 40)
	Exception: normal_lpdf(OpenCL): Random variable[-791172279, 2092170444] = 120.599, but it must be not NaN! (in '/home/chrisliao/7mde_bayes/normal_exponential_3/normal_exponential.stan', line 23, column 2 to column 50)
Command and output files:
RunSet: chains=5, chain_ids=[1, 2, 3, 4, 5], num_processes=1
 cmd (chain 1):
	['/home/chrisliao/7mde_bayes/normal_exponential_3/normal_exponential', 'id=1', 'random', 'seed=123', 'data', 'file=data.json', 'output', 'file=/scratch/local/jobs/96247/tmptf1n8__5/normal_exponentialtglxspbv/normal_exponential-20221114101534.csv', 'refresh=200', 'method=sample', 'algorithm=hmc', 'engine=nuts', 'max_depth=12', 'adapt', 'engaged=1', 'delta=0.9', 'num_chains=5']
 retcodes=[-11]
 per-chain output files (showing chain 1 only):
 csv_file:
	/scratch/local/jobs/96247/tmptf1n8__5/normal_exponentialtglxspbv/normal_exponential-20221114101534_1.csv
 console_msgs (if any):
	/scratch/local/jobs/96247/tmptf1n8__5/normal_exponentialtglxspbv/normal_exponential-20221114101534-stdout.txt
Consider re-running with show_console=True if the above output is unclear!
1 Like

@rok_cesnovar

1 Like