[ADMB Users] mcmc screen output

16 views
Skip to first unread message

Allan...@noaa.gov

unread,
Jun 28, 2010, 5:14:00 PM6/28/10
to us...@admb-project.org
Hi All,

Does anyone know how to change the frequency at which mcmc output is
displayed to the screen? For example, instead of the acceptance rate
reported every 200th mcmc draw, is it possible to have it report every
1000th? Screen output can be time consuming and I am trying to reduce
the time of my simulations.

The options -nox and -iprint seem to have an effect only during the
estimation portion and not during the mcmc.

Thanks,
Allan
_______________________________________________
Users mailing list
Us...@admb-project.org
http://lists.admb-project.org/mailman/listinfo/users

Steve Martell

unread,
Jun 28, 2010, 6:31:05 PM6/28/10
to Allan...@noaa.gov, us...@admb-project.org
Use >NUL this wil suspend all screen output

Steve Martell
Martel...@gmail.com
Sent from my iPhone

Jim Ianelli

unread,
Jun 28, 2010, 6:48:27 PM6/28/10
to us...@admb-project.org
and optionally, you could make use of cerr vs cout. I.e., make your own
counter and send it to cerr and execute as follows:

mymod >NUL

and the screen will display your cerr statements and dump everything else.


Jim Ianelli
NOT sent from my iphone...

Allan...@noaa.gov

unread,
Jun 28, 2010, 7:00:28 PM6/28/10
to us...@admb-project.org
Thanks Steve and Jim,

That is a great idea to pipe the output. I am actually using the system
command in R to run the simulations and set the option
"show.output.on.console=T" to send the ouptut back to an R object.

A quick comparison showed that this saves about 5% of running time,
which over 200 simulations will save me about an hour.

Thanks again,
Allan

Arni Magnusson

unread,
Jun 28, 2010, 8:22:47 PM6/28/10
to us...@admb-project.org
ADMB is hardwired to report every 200th MCMC cycle (lines 618-627 in
src/nh99/xxmcmc.cpp inside
http://admb-project.googlecode.com/files/admb-9.1-src.zip.

I just ran a simple benchmark, measuring how many seconds it took to run
'catage -mcmc 1e5 -mcsave 1e2':

19.5 in a maximized Dos shell
18.2 in my normal Dos shell (27 rows)
18.1 in a minimized Dos shell
17.5 piping to > mcmc_log.txt
17.4 piping to > NUL

It turns out that the R overhead is surprisingly small:

17.9 system("catage -mcmc 1e5 -mcsave 1e2")

When running multiple models, I have used R to write Dos/Bash shell
script(s) and then run the script(s) in a minimized shell, but altogether
the speed differences above are smaller than I expected.

At the risk of sounding like a scratched record, I will add that by far
the most significant speed improvement is running the same model in Linux:

10.7 in a maximized Bash shell
10.6 in my normal Bash shell
10.0 in a minimized Bash shell
9.8 piping to > mcmc_log.txt
9.8 piping to > /dev/null
9.8 in R

This would save many hours in Allan's case. These results agree with
previous ADMB benchmarks
(http://admb-project.org/community/benchmarks/compilers).

Arni

dave fournier

unread,
Jun 29, 2010, 1:49:38 AM6/29/10
to us...@admb-project.org

The biggest speedup is to make a constant version of the
stuff in userfunction and to use that for mcmc. This should
be done automatically but was never got to.

John Sibert

unread,
Jun 29, 2010, 8:22:50 PM6/29/10
to da...@otter-rsch.com, dave fournier, us...@admb-project.org
We discussed this in Noumea. I recall Dave mentioned that the types
could be changed by sed operating on some code, but I don't recall which
code. Any one interested in taking it on?

John

--
John Sibert
Emeritus Researcher, SOEST
University of Hawaii at Manoa

Visit the ADMB project http://admb-project.org/

dave fournier

unread,
Jun 30, 2010, 4:09:57 AM6/30/10
to us...@admb-project.org
Don't hold your breath John.

In the meantime it might be worhtwhile to point out that
this can be done by hand. You create a constant versio of your code
and put all in the PROCEDURE_SECTION as

if (mc_phase())
{
// constant version

}
else
{
// normal code
}

when I did this years ago it was about a 3x speedup.
Maybe not as much now if the ocmpilers are better.

Reply all
Reply to author
Forward
0 new messages