Hi again, one more question about memory consumption: i'm trying to run the following test code on win7 x64 with 4GB ram and program crashes with out of memory error somewhere during the model construction:
Code:
alglib.rbfmodel model;
int N = 1000*400;
int expected_mem = 250 * N * (sizeof(double) + 2 * sizeof(int));
Console.WriteLine( "Expected memory consumption = {0:N}", expected_mem );
int nx = 3;
int ny = 1;
alglib.rbfcreate( nx, ny, out model );
var rnd = new Random();
var data = new double[N, nx + ny];
var pts = new double[N][];
var res = new double[N][];
for ( int i = 0; i < N; ++i ) {
data[i, 0] = -1 + rnd.NextDouble() * 2;
data[i, 1] = -1 + rnd.NextDouble() * 2;
data[i, 2] = -1 + rnd.NextDouble() * 2;
data[i, 3] = Math.Sin( data[i, 0] ) * Math.Cos( data[i, 1] ) * data[i, 2];
pts[i] = new double[nx];
pts[i][0] = -1 + rnd.NextDouble() * 2;
pts[i][1] = -1 + rnd.NextDouble() * 2;
pts[i][2] = -1 + rnd.NextDouble() * 2;
res[i] = new double[ny];
}
Console.WriteLine( "Data initialized, {0:N} points", N );
var mem_0 = GC.GetTotalMemory( true );
var s = Stopwatch.StartNew();
alglib.rbfreport rep;
alglib.rbfsetpoints( model, data );
alglib.rbfbuildmodel( model, out rep );
Console.WriteLine( "Model build, time = {0:N} ms", s.ElapsedMilliseconds );
GC.Collect();
var mem_1 = GC.GetTotalMemory( true );
Console.WriteLine( "Allocated {0:N} bytes", mem_1 - mem_0 );
s = Stopwatch.StartNew();
for ( int j = 0; j < N; ++j ) {
alglib.rbfcalc( model, pts[j], out res[j] );
}
Console.WriteLine( "Computation done! time = {0:N} ms", s.ElapsedMilliseconds );
Console.ReadLine();
As far as i undersand 4GB ram should be sufficient to create model from 400 000 points? Or not?