|
From: | Mathieu Dubois |
Subject: | Re: Memory exhausted when using \ |
Date: | Sat, 21 Jul 2012 09:48:55 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
Le 21/07/2012 01:52, Martin Helm a écrit :
Am 21.07.2012 01:27, schrieb Martin Helm:The problem seems to be when the value of nz is zero in MSparse<T> B (nr, nc, (nz < maxnz ? nz : maxnz)); Then it crashes later.I replaced MSparse<T> B (nr, nc, (nz < maxnz ? nz : maxnz)); with MSparse<T> B (nr, nc, (nz < maxnz && nz > 0 ? nz : maxnz)); and now it works not only for the test case but also for the memory_exhausted file. (of course only in combination with Jordi's uint64 cast) The fancy output is a printf which I added to see what happens while the \ operator runs octave:4> load memory-exhausted octave:5> x = A\b; maxnz 562093 nr 243458, nc 46008, nz 562093, maxnz 562093 maxnz 11533 nr 243458, nc 1, nz 11533, maxnz 11533 maxnz 3252 nr 3252, nc 46008, nz 3252, maxnz 3252 maxnz 11533 nr 3252, nc 1, nz 0, maxnz 11533 maxnz 3252 nr 3252, nc 3252, nz 3252, maxnz 3252 maxnz 11533 nr 3252, nc 1, nz 0, maxnz 11533 octave:6>
I have applied your modification but when I compile, I have a warning:sparse-dmsolve.cc:52:5: warning: 'nz' may be used uninitialized in this function [-Wuninitialized]
The offending line is: nz = nr*nz; The code surrounding this is: octave_idx_type nz; // Cast to uint64 to handle overflow in this multiplication if (octave_uint64 (nr)*octave_uint64 (nc) < octave_uint64 (maxnz)) nz = nr*nz; else nz = maxnz;I'm not sure of the purpose of all this but I think the warning is important here. This may explain why nz is 0 sometime (given the way it is computed it should not happen, right?).
Maybe the meaning was nz = nr*nc? Mathieu
[Prev in Thread] | Current Thread | [Next in Thread] |