Error: C stack usage is too close to the limit
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.1k
- Forks
- 266
- Avg merge
- 2h 56m
- Merged PRs (30d)
- 1
Description
Summary:
I am getting the error: "Error: C stack usage 201255608 is too close to the limit" when trying to run a model in rstan.
Description:
I am trying to set up a model involving gaussian process prediction, but am getting the error: "Error: C stack usage 201255608 is too close to the limit" after sampling completes. I have reduced the model to a very simple version with just data, transformed data, and variable definitions in generated quantities and running on a small amount of data, but the error persists.
Reproducible Steps:
The stan file and data are attached in a zip file; the problem occurs when running the model using the following line:
error.zip
model_out=stan(file='test_gp2.stan',data=data_toest,iter=1,chains=1,algorithm='Fixed_param')
Command to create the data_toest variable from the attached data:
data_toest=list(nS=nS,nB=nB,nT=nT,nL=nL,b_length=b_length,block_type=block_type,
all_x=all_x,all_y=all_y,points=points,selected_row=selected_row,
selected_row_dup=selected_row_dup,
unselected_row=unselected_row,selected_xy=selected_xy,
unique_chosen=unique_chosen,unique_unchosen=unique_unchosen,nC=nC,cov_in=cov_in)
The error persists after restarting my computer and on a separate machine with different OS, R, and Rstan versions.
There are four variable definitions in generated quantities, and commenting out some of those variable definitions gets rid of the error. The attached version has two of the four commented out, but still produces the error.
Current Output:
SAMPLING FOR MODEL 'anon_model' NOW (CHAIN 1).
Chain 1: Iteration: 1 / 1 [100%] (Sampling)
Chain 1:
Chain 1: Elapsed Time: 0 seconds (Warm-up)
Chain 1: 0.14 seconds (Sampling)
Chain 1: 0.14 seconds (Total)
Chain 1:
Error: C stack usage 201255608 is too close to the limit
Expected Output:
Sampling to conclude without errors.
RStan Version:
2.29 or 2.26
R Version:
4.1.1 or 4.0.4
Operating System:
Windows 10 or Mac OS Big Sur
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by extracting error.zip and reproducing the failure with the shown stan(file='test_gp2.stan', data=data_toest, iter=1, chains=1, algorithm='Fixed_param') call. Compare the four generated-quantities definitions, including the commented versions, to identify which expressions trigger the stack error. Done means the model completes sampling without the C stack usage error and the cause is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100