[R-SIG-Mac] Rstan compilation hangs misterisouly

Goncalo Ferraz g|@pp|e @end|ng |rom m@c@com
Mon Nov 9 21:03:53 CET 2020


Hi, This is helpful information. Thank you. Meanwhile, I tried reverting to version 2.19.3 of rstan and it does not hang on me. I couldn’t yet understand what is going on with the most recent version, but at least for now I can work.

Gonçalo

> On Nov 9, 2020, at 5:00 PM, Robert Goedman <goedman using icloud.com> wrote:
> 
> Hi,
> 
> Not sure if this helps and/or is even related but since about 2 months I have not been able to get rstan to work inside the R-GUI. Like you describe, it hangs and never returns. I don’t use rstan directly but use ulam() in the `rethinking` package to very occasionally check the Stan language program generated by ulam() after running it.
> 
> After struggling for a few weeks I decided to try it in vanilla R and found below test script no longer hangs.
> 
> Again, not sure this is of any help, but just wanted to chime in.
> 
> Rob J Goedman
> goedman using icloud.com <mailto:goedman using icloud.com>
> 
> ```
> library(rethinking)
> d <- sim_happiness( seed=1977 , N_years=1000 )
> precis(d)
> 
> ## R code 6.22
> d2 <- d[ d$age>17 , ] # only adults
> d2$A <- ( d2$age - 18 ) / ( 65 - 18 )
> 
> ## R code 6.23
> d2$mid <- d2$married + 1
> m6.9 <- quap(
>     alist(
>         happiness ~ dnorm( mu , sigma ),
>         mu <- a[mid] + bA*A,
>         a[mid] ~ dnorm( 0 , 1 ),
>         bA ~ dnorm( 0 , 2 ),
>         sigma ~ dexp(1)
>     ) , data=d2 )
> precis(m6.9,depth=2)
> 
> m6.9u <- ulam(
>     alist(
>         happiness ~ dnorm( mu , sigma ),
>         mu <- a[mid] + bA*A,
>         a[mid] ~ dnorm( 0 , 1 ),
>         bA ~ dnorm( 0 , 2 ),
>         sigma ~ dexp(1)
>     ) , data=d2 )
> precis(m6.9u,depth=2)
> ```
> 
>> On Nov 9, 2020, at 05:50, Goncalo Ferraz via R-SIG-Mac <r-sig-mac using r-project.org <mailto:r-sig-mac using r-project.org>> wrote:
>> 
>> deleting Makevars didn’t work. The command:
>> 
>> example(stan_model, package = “rstan”, run.dontrun = TRUE)
>> 
>> left me hanging with this output:
>> 
>> stn_md> stancode <- ‘data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}’
>> 
>> stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE)
>> 
>> TRANSLATING MODEL ‘16a540c6086086816528e4524def24d9’ FROM Stan CODE TO C++ CODE NOW.
>> successful in parsing the Stan model ‘16a540c6086086816528e4524def24d9’.
>> indent preformatted text by 4 spaces
>> 
>> That’s what’s been happening with any attempt to compile.
>> 
>> 
>> 
>>> On Nov 9, 2020, at 7:30 AM, Goncalo Ferraz <gfapple using mac.com <mailto:gfapple using mac.com>> wrote:
>>> 
>>> Interesting. Thanks! Is it best to delete the line and keep an empty file, or should I just get rid of the file altogether?
>>> 
>>> 
>>>> On Nov 9, 2020, at 6:01 AM, Kasper Daniel Hansen <kasperdanielhansen using gmail.com <mailto:kasperdanielhansen using gmail.com>> wrote:
>>>> 
>>>> This line will essentially overwrite what RStan does for compilation. So yes, this is potentially a bad thing.
>>>> 
>>>> On Mon, Nov 9, 2020 at 4:57 AM Goncalo Ferraz via R-SIG-Mac <r-sig-mac using r-project.org <mailto:r-sig-mac using r-project.org>> wrote:
>>>> ok, found it! Makevars is where you said it would be and it contains only this line:
>>>> 
>>>> CXX14FLAGS += -O3 -mtune=native -arch x86_64 -ftemplate-depth-256
>>>> 
>>>> Does it seem to mean anything relevant?
>>>> 
>>>>> On Nov 8, 2020, at 11:24 PM, Ken Beath <ken using kjbeath.com.au <mailto:ken using kjbeath.com.au>> wrote:
>>>>> 
>>>>> It is actually Makevars. If it is there it will be in the .R directory of your home folder.
>>>>> 
>>>>> Unless it has been set up for something else, like Rcpp, then it can probably be deleted. 
>>>>> 
>>>>> Ken
>>>>> 
>>>>>> On 9 Nov 2020, at 12:43 pm, Goncalo Ferraz <gfapple using mac.com <mailto:gfapple using mac.com>> wrote:
>>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> Yes, at some point there was a problem with schools.stan, it needed an extra (empty) line added to the end. But that didn’t solve the problem. I tried at least three different tests, with different models, and the same thing happens.
>>>>>> 
>>>>>> Tried to get rid of .MakeVars and as I remember it didn’t change anything. I wanted to try it again now, but I am not finding a .MakeVars file anywhere on my computer. Where should it be?
>>>>>> 
>>>>>> Thanks,
>>>>>> 
>>>>>> Gonçalo
>>>>>> 
>>>>>>> On Nov 8, 2020, at 8:04 PM, Ken Beath <ken using kjbeath.com.au <mailto:ken using kjbeath.com.au>> wrote:
>>>>>>> 
>>>>>>> Guessing here. Possibly schools.stan has a problem, that is what teh first error is suggesting. The remaining is a possible problem with .MakeVars which is no longer needed with R. I would also check that files aren’t being saved with a strange encoding.
>>>>>>> 
>>>>>>> Ken
>>>>>>> 
>>>>>>>> On 9 Nov 2020, at 7:25 am, Roy Mendelssohn - NOAA Federal via R-SIG-Mac <r-sig-mac using r-project.org <mailto:r-sig-mac using r-project.org>> wrote:
>>>>>>>> 
>>>>>>>> Hi:
>>>>>>>> 
>>>>>>>> While it is possible you will get the help you seek here,  I think you would likely to get more help,  and more knowledgeable help, on this more specialized issue,  at the Stan Forum.  https://discourse.mc-stan.org <https://discourse.mc-stan.org/>.  I remember seeing in the summaries I get some issues with different combinations of versions of R,  Stan and compilers.
>>>>>>>> 
>>>>>>>> HTH,
>>>>>>>> 
>>>>>>>> -Roy
>>>>>>>> 
>>>>>>>>> On Nov 8, 2020, at 12:16 PM, Goncalo Ferraz via R-SIG-Mac <r-sig-mac using r-project.org <mailto:r-sig-mac using r-project.org>> wrote:
>>>>>>>>> 
>>>>>>>>> Hi, 
>>>>>>>>> 
>>>>>>>>> I’ve been struggling with an rstan problem for weeks. I installed R stan following instructions in https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#how-to-use-rstan <https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#how-to-use-rstan> <https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#how-to-use-rstan <https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started#how-to-use-rstan>> to the letter, but when I try to compile any model R leaves me hanging indefinitely (I’ve waited up to 30 minutes with ridiculously short models). When I press esc R says:
>>>>>>>>> 
>>>>>>>>> Warning messages:
>>>>>>>>> 1: In readLines(file, warn = TRUE) :
>>>>>>>>> incomplete final line found on '/Users/gferraz/Documents/MAF/R/schools.stan'
>>>>>>>>> 2: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
>>>>>>>>> system call failed: Result too large
>>>>>>>>> 3: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
>>>>>>>>> error in running command
>>>>>>>>> 
>>>>>>>>> And then, R won’t quit. I can only close it by force quitting the software itself and some R process that is set in motion and appears in the Activity Monitor.
>>>>>>>>> 
>>>>>>>>> I have tried everything that was suggested in the stan forum, including deleting all the contents of /usr/local, removing xcode, R and re-installing everything again.
>>>>>>>>> 
>>>>>>>>> The only thing that I can think of now is to do a clean install of Mac OS on my machine and really start from scratch.
>>>>>>>>> 
>>>>>>>>> Anyone has a less radical recommendation?
>>>>>>>>> 
>>>>>>>>> Thank you,
>>>>>>>>> 
>>>>>>>>> Gonçalo
>>>>>>>>>  [[alternative HTML version deleted]]
>>>>>>>>> 
>>>>>>>>> _______________________________________________
>>>>>>>>> R-SIG-Mac mailing list
>>>>>>>>> R-SIG-Mac using r-project.org <mailto:R-SIG-Mac using r-project.org>
>>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>>>> 
>>>>>>>> **********************
>>>>>>>> "The contents of this message do not reflect any position of the U.S. Government or NOAA."
>>>>>>>> **********************
>>>>>>>> Roy Mendelssohn
>>>>>>>> Supervisory Operations Research Analyst
>>>>>>>> NOAA/NMFS
>>>>>>>> Environmental Research Division
>>>>>>>> Southwest Fisheries Science Center
>>>>>>>> ***Note new street address***
>>>>>>>> 110 McAllister Way
>>>>>>>> Santa Cruz, CA 95060
>>>>>>>> Phone: (831)-420-3666
>>>>>>>> Fax: (831) 420-3980
>>>>>>>> e-mail: Roy.Mendelssohn using noaa.gov <mailto:Roy.Mendelssohn using noaa.gov> www: https://www.pfeg.noaa.gov/ <https://www.pfeg.noaa.gov/>
>>>>>>>> 
>>>>>>>> "Old age and treachery will overcome youth and skill."
>>>>>>>> "From those who have been given much, much will be expected" 
>>>>>>>> "the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> R-SIG-Mac mailing list
>>>>>>>> R-SIG-Mac using r-project.org <mailto:R-SIG-Mac using r-project.org>
>>>>>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>>> _______________________________________________
>>>> R-SIG-Mac mailing list
>>>> R-SIG-Mac using r-project.org <mailto:R-SIG-Mac using r-project.org>
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>>>> 
>>>> 
>>>> -- 
>>>> Best,
>>>> Kasper
>>> 
>> 
>> _______________________________________________
>> R-SIG-Mac mailing list
>> R-SIG-Mac using r-project.org <mailto:R-SIG-Mac using r-project.org>
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> 


	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list