Re: [Rpy] segmentation fault after long batch of LM

2008-07-22 Thread Laurent Gautier
The change for rpy2 fixes for my very own mistake. What I had missing was obvious (well, once I found it... it kept me wondering a little while): a call to R_PreserveObject() to protect a newly created R "SEXP" (and this when RPy vectors are created out of python sequences). rpy2 and rpy differ a

Re: [Rpy] segmentation fault after long batch of LM

2008-07-21 Thread laurent oget
That is good to hear. If I have a look at the change you made on rpy2, do you think there is any hope i will be able to patch rpy1? I do not know much about rpy yet, but if you think that is do-able this would give me a good pretext to learn. Laurent 2008/7/21 Laurent Gautier <[EMAIL PROTECTED]>:

Re: [Rpy] segmentation fault after long batch of LM

2008-07-21 Thread Laurent Gautier
I fixed a problem with rpy2 (the fix is in SVN) It does seem to fit happily a lot of linear models without problems now. For the moment rpy-1.x, calling R's gc() is the only known workaround, I think. ##--- # # brutal and naive strategy for model selection: # fit all possible two-variable mo

Re: [Rpy] segmentation fault after long batch of LM

2008-07-18 Thread Laurent Gautier
2008/7/18 Laurent Gautier <[EMAIL PROTECTED]>: > 2008/7/17 laurent oget <[EMAIL PROTECTED]>: >> >> >> 2008/7/17 Laurent Gautier <[EMAIL PROTECTED]>: >>> > It might not really be a race condition, but more an overzealous > garbage collection. > R does not have reference counting, and objects withou

Re: [Rpy] segmentation fault after long batch of LM

2008-07-17 Thread Laurent Gautier
2008/7/17 laurent oget <[EMAIL PROTECTED]>: > > > 2008/7/17 Laurent Gautier <[EMAIL PROTECTED]>: >> >> I am a bit confused. >> >> Do you have data frames created and bound to the same Python variable >> names ? >> >> Or do you have a set of vectors, and subsets put together in different >> data fra

Re: [Rpy] segmentation fault after long batch of LM

2008-07-17 Thread laurent oget
2008/7/17 Laurent Gautier <[EMAIL PROTECTED]>: > I am a bit confused. > > Do you have data frames created and bound to the same Python variable names > ? > Or do you have a set of vectors, and subsets put together in different > data frame ? > (if you are iterating and building a lot of linear m

Re: [Rpy] segmentation fault after long batch of LM

2008-07-17 Thread Laurent Gautier
I am a bit confused. Do you have data frames created and bound to the same Python variable names ? Or do you have a set of vectors, and subsets put together in different data frame ? (if you are iterating and building a lot of linear model, you might be trying to do some sort of variable/model sel

Re: [Rpy] segmentation fault after long batch of LM

2008-07-16 Thread laurent oget
I was thinking of another workaround and would love your opinion on that. My intuition is that the problem occurs because I have variables who are in several dataframes with the same name. Do you think mangling the names of the variables before passing them to R might help? Would it be an interesti

Re: [Rpy] segmentation fault after long batch of LM

2008-07-16 Thread Laurent Gautier
I have trouble narrowing down where exactly the problem is occurring (it seems to keep moving each time I think that I am getting closer). In the short term, and for your needs, I guess that it is good if calls to gc prevents rpy from crashing. To save on runtime, you can try a gc pooling strategy

Re: [Rpy] segmentation fault after long batch of LM

2008-07-15 Thread laurent oget
Calling r.gc() before each creation seems to have solved the problem. We ran a whole lot of things over the night without any segmentation fault. This is however pretty expensive timewise. Laurent 2008/7/14 laurent oget <[EMAIL PROTECTED]>: > I am running things with a call to gc() before each r

Re: [Rpy] segmentation fault after long batch of LM

2008-07-14 Thread laurent oget
I am running things with a call to gc() before each regression, in case what happens is a race condition where the gc is called in the middle of the constrction of a new dataframe... Thanks for the prompt help! Laurent 2008/7/14 Laurent Gautier <[EMAIL PROTECTED]>: > 2008/7/15 laurent oget <[EM

Re: [Rpy] segmentation fault after long batch of LM

2008-07-14 Thread Laurent Gautier
2008/7/15 laurent oget <[EMAIL PROTECTED]>: > can i get a quick hint on how i would go about calling --verbose through RPY > ? I suspect that the only way is to hack line 93 of rpymodule.c char *defaultargv[] = {"rpy", "-q", "--vanilla"}; and recompile/install rpy. > I am pretty clueless about

Re: [Rpy] segmentation fault after long batch of LM

2008-07-14 Thread laurent oget
can i get a quick hint on how i would go about calling --verbose through RPY ? I am pretty clueless about the way R does the garbage collection. One thing I know is there are columns that are shared between different linear regressions, so it might be that the garbage collector cleans up a column

Re: [Rpy] segmentation fault after long batch of LM

2008-07-14 Thread Laurent Gautier
Someone else reported on this list a similar sounding problem not so long ago. The problem might be caused by manipulating a stale pointer to an R object (that is an object that was discarded during R's garbage collection), and troubleshooting this will likely mean running things through a C debu

[Rpy] segmentation fault after long batch of LM

2008-07-14 Thread laurent oget
I am using rpy/R to perform linear regressions on a large number of datasets, in one python run, and am encountering segmentation faults after a large number of iteration, while handling cases which, taken on their own run without a problem. My intuition is that the previous iterations somehow corr