[ADMB Users] questions about memory use in admb

Ian Taylor Ian.Taylor at noaa.gov
Fri Sep 4 16:24:56 PDT 2009

I'm trying to understand memory use by ADMB. I'm pleased to see this 
email list providing valuable information so I thought I'd put this one 
out there too.

I'm no C++ programmer, but it seems from the source code here:
that the memory-related inputs are unsigned long integers which 
apparently are limited below 2^32. In practice, however, increasing the 
inputs to -gbs or -cbs above 2^31 seems to result in a smaller memory 
allocation than a value just under that limit.

At first, I thought this meant that it wasn't possible to take advantage 
of 64 bit memory architecture. However, warnings I get from the 
gs_set.cpp file referenced above (which appear to out of date, referring 
to a 64K limit) tell me that gs_size = 48 and suggest that memory limits 
are related to gs_size times the input value. If my calculations are 
correct, 48*2^31 bytes = 96GB, which seems like plenty. Indeed, this is 
more of a theoretical problem as I don't have calculations that require 
huge amounts of memory. I had to create a model with 5000 parameters to 
use more than 4GB just to confirm that it could be done with 64 bit ADMB.

Nevertheless, it would be good to understand how these things work. Is 
2^31 indeed the upper limit on GRADSTACK_BUFFER_SIZE and 
CMPDIF_BUFFER_SIZE. Also, what is gs_size and is it always 48, or just 
for the example I'm using?


More information about the Users mailing list