overflow allocating smatrix

Welcome to the forum for runmlwin users. Feel free to post your question about runmlwin here. The Centre for Multilevel Modelling take no responsibility for the accuracy of these posts, we are unable to monitor them closely. Do go ahead and post your question and thank you in advance if you find the time to post any answers!

Go to runmlwin: Running MLwiN from within Stata >> http://www.bristol.ac.uk/cmm/software/runmlwin/
GinaPotarca
Posts: 5
Joined: Mon Nov 26, 2012 12:31 pm

Re: overflow allocating smatrix

Post by GinaPotarca »

Hi Chris,
I'm using Mlwin 26 and an up to date runmlwin. And I get the same errors:

'cannot allocate smatrix(fs)'
'error while obeying batch file C:\Users\EWP-GMW\AppData\Local\Temp\ST_00000007.tmp at line number 145: STAR
cannot allocate smatrix(fs)'

The only difference is now I get number 145(: STAR) instead of 148.

Gina
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: overflow allocating smatrix

Post by ChrisCharlton »

When allocating memory for holding matrices used within the algorithm MLwiN can either allocate them to be large enough for the worst-case situation in the algorithm (The maximum number of lowest level units within units at the highest level), or it can assume that the situation where these are needed won't occur and allocate them to be much smaller. If it assumes the latter then it's possible that there won't be enough space during estimation, causing an estimation error. Which option MLwiN chooses to take is controlled by the OPTS command. In runmlwin we use OPTS 0 which causes it to allocate enough for the worst-case, however in this case there are too many level 1 units in one of the regions for this to work, and hence the allocation failure.

To work around the error you need to change the following line in runmlwin.ado from:

Code: Select all

file write `macro1' "OPTS 0" _n
to:

Code: Select all

file write `macro1' "OPTS 1" _n
We will consider adding a runmlwin option to control this in a future release.
GinaPotarca
Posts: 5
Joined: Mon Nov 26, 2012 12:31 pm

Re: overflow allocating smatrix

Post by GinaPotarca »

Many, many thanks, Chris!
It now works perfectly.
patriciotroncoso
Posts: 9
Joined: Wed Nov 21, 2012 12:24 pm

Re: overflow allocating smatrix

Post by patriciotroncoso »

I'm sorry for not replying before, I see that I'm not the only one with this problem.

I've tried this solution that Chris posted last and it seems to have solved the problem.

Thanks!
MAhmad12
Posts: 1
Joined: Wed Dec 12, 2012 1:17 pm

Re: overflow allocating smatrix

Post by MAhmad12 »

I am very appreciate your site,and your article is useful, thank for sharing us this information.-
rlocalio
Posts: 1
Joined: Sat Jan 12, 2013 4:09 pm

Re: overflow allocating smatrix

Post by rlocalio »

Encountering the "cannot allocate smatrix(fs)" error as others have seen, and with dataset
that runs in MLwiN but fails when using runmlwin. The fix of editing runmlwin.ado
also did not seem to work. The only solution was to reduce the sample size within each
cluster, but that is not a solution because cluster sizes are large. Problem arises across
hardware, even with a machine with 16G central memory. Without using runmlwin
the problem ran easily with a central memory of only 3G. 2 levels, 25 clusters, 350,000
subjects.
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: overflow allocating smatrix

Post by ChrisCharlton »

It may be that runmlwin is overestimating the amount of worksheet space required to hold the data. You could try overriding these settings to match what you use in the standalone context by using the worksheet() options in runmlwin. If you have a 64-bit machine you could also try setting your MLwiN_path global to mlnscript.exe in the x64 directory instead of mlwin.exe in the i386 directory as this will allow it to use all the memory in the machine. The downside to this would be that you would lose the equation and progress display.
rdmcdowell
Posts: 31
Joined: Mon Apr 02, 2012 3:26 pm

Re: overflow allocating smatrix

Post by rdmcdowell »

Hello list users

I am having the same difficulty when working with runmlwin. It's a simple 1-level logistic regression model, for starters, with 3 independent predictors. The dataset contains approx 170,000 entries.

When I fit the model directly in mlwin, the estimates are correct and the workbook settings are worksheet size (100000), level(5), columns(1500), variables(150), groups(20).

When I try to fit the model using runmlwin, I get the usual "overflow allocating smatrix" error. Examination of the settings as stored in the macro are worksheet size(34127) columns(1500) level(6) groups(30).

When I alter the runmlwin settings to mirror the default settings found in mlwin directly I still get the error message, even when adding the tempmat option.

Has anyone any tips they can share about work arounds? The output is much more userfriendly in runmlwin, which is why I'd like to persevere!

I'm using Mlwin 2.32, Stata 12 on a 4bit WIndows PC.

Many thanks

Ron
ChrisCharlton
Posts: 1351
Joined: Mon Oct 19, 2009 10:34 am

Re: overflow allocating smatrix

Post by ChrisCharlton »

Could you try using the optimat option instead of tempmat and seeing if that works?

I would also suggest trying with a newer MLwiN version (updates can be requested at: https://www.cmm.bris.ac.uk/clients/softwaredownload/), as there have been a number of fixes since 2.32 (see: http://www.bristol.ac.uk/cmm/software/m ... fixes.html).
rdmcdowell
Posts: 31
Joined: Mon Apr 02, 2012 3:26 pm

Re: overflow allocating smatrix

Post by rdmcdowell »

Thanks very much. That simple step resolved my issues. Thanks also for the timely reminder to update my software.
Post Reply