psoundararajan / rcaller

Automatically exported from code.google.com/p/rcaller
Other
0 stars 0 forks source link

RCaller bug: setRsciptExecutable; very high memory usage (900,000K, CPU: 92) #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

I am a Java Devloper, and have been using the RCaller API for the last few 
months for a personal project (trying to get Linear Mixed Models for numbers I 
randomly generate). I encountered a strange and serious issue yesterday. 

I had a dataset with around 320 numbers (randomly generated x, y-axis values 
for a series). I tried to run the Linear Mixed Model in R via RCaller but my 
Windows Task Manager showed the memory of my java app going over 900,000K (CPU: 
92 !). 

The app then showed an RCaller  error ("Unable to parse output file"; as the 
output file returned from R was empty). 

Looking into the problem, I found the error occurred at this line:

       rcaller.setRscriptExecutable(rScriptPath);

where:  rScriptPath is a String holding my RScript path: C:/Program Files 
(x86)/R/bin/x64/Rscript.exe

I believe this is a serious issue as for any dataset with over 300 values (in 
my app), RCaller starts consuming too much memory and the app crashes on the 
line I mentioned above (rcaller.setRscriptExecutable()). 

Kindly let me know if anyone has seen this before and how to rectify this 
issue. 

Thanks.

Original issue reported on code.google.com by ajrulez....@gmail.com on 13 Dec 2013 at 11:17

GoogleCodeExporter commented 9 years ago
in version 2.2.0 the test

double[][] data = new double[1000][10];
        for (int i=0;i<data.length;i++){
            for (int j=0;j<data[0].length;j++){
                data[i][j] = Math.random();
            }
        }
        RCaller caller = new RCaller();
        Globals.detect_current_rscript();
        caller.setRscriptExecutable(Globals.Rscript_current);

        RCode code = new RCode();
        code.addDoubleMatrix("x", data);
        code.addRCode("s <- dim(t(x) %*% x)");
        caller.setRCode(code);

        caller.runAndReturnResult("s");

        double[] result = caller.getParser().getAsDoubleArray("s");

        Assert.assertEquals(result[0], 10.0, delta);
        Assert.assertEquals(result[1], 10.0, delta);

passes. Please try out the new version and tell me if any differences

Original comment by mhsatman on 12 Apr 2014 at 9:17