[ADMB Users] Output files end up in different directories under MinGW and under Borland or VC++

William Stockhausen William.Stockhausen at noaa.gov
Tue Jul 12 15:47:42 PDT 2011

Greetings all,

I'm trying to run the same model (on different Windows computers) using 
the Borland, VC++, and MinGW versions of ADMB and have noticed a 
difference in where output files end up during/after a model run if the 
model is not located in the "current" (as far as DOS is concerned) 

Under Borland and VC++, all files are written to the DOS "current" 
directory while under MinGW some files (admodel.cov, admodel.hes, etc) 
are written to the DOS "current" directory while others (.par, .rep, 
etc) files are written to the directory where the model executable 
resides.  I've traced this into the ADMB source code (for version 10.1) 
to a difference in how the model program file name is handled in 
ad_comm::allocate() (in the file src\nh99\model7.cpp) under the 
different compilers.  When running Borland and VC++, any path associated 
with the program name written to the DOS command processor (e.g., at a 
DOS command prompt like >c:\Model\code\mymodel.exe) is stripped before 
creating the final program name (e.g.,ad_comm::program_name= "mymodel" 
in my example) that ADMB uses for output files like the par file and the 
rep file.  Hence these files end up in the "current" DOS directory (the 
one the DOS command processor was run from), along with the .cov, .hes 
and other files that don't incorporate the program name.

MinGW, on the other hand, does not strip off the path before creating 
the final program name (so you end up with 
ad_comm::program_name="c:\Model\code\mymodel") and all the files that 
are associated with the program_name (.par, .rep, etc.) end up in the 
directory with the model executable.

I respectfully suggest it would be convenient if the MinGW version of 
ADMB handled the program_name the same way that Borland and VC++ do.  Of 
course, there may be very good reasons (consistency with the linux side 
for MinGW?) why consistency among the Windows compilers might not be 
desired.  In any case, it's something to be aware of if you're rotating 
among compilers on Windows.



* Dr. William T. Stockhausen                      *
* Resource Ecology and Fisheries Management       *
* Alaska Fisheries Science Center                 *
* National Marine Fisheries Service               *
* National Oceanic and Atmospheric Administration *
* 7600 Sand Point Way N.E.                        *
* Seattle, Washington 98115-6349                  *
* email: William.Stockhausen at noaa.gov             *
* voice: 206-526-4241 fax: 206-526-6723           *
* web  : http://www.afsc.noaa.gov                 *
All models are wrong, some are useful.--G.E.P. Box
Beware of geeks bearing equations.    --W. Buffett
Disclaimer: The opinions expressed above are personal
and do not necessarily reflect official NOAA policy.

More information about the Users mailing list