[Developers] ADMB in a Linux machine

Arni Magnusson arnima at hafro.is
Thu May 20 13:13:21 PDT 2010


It turns out that ADMB in Linux compiles and runs many models (including 
simple.tpl) regardless of line endings:

$ unix2dos simple.tpl
$ admb simple
$ simple

GCC, R, and most tools I work with can handle both line endings just fine, 
so I think it would be worthwhile to make ADMB robust to line endings.

In Saang-Yoon's example (attached), it's enough to comment out the runtime 
section,

// RUNTIME_SECTION
//   maximum_function_evaluations 10000

and then the model compiles and runs. Otherwise, tpl2cpp mangles this 
specific line so mark_recap13.cpp becomes:

   void model_parameters::set_runtime(void)
   {
     dvector temp1("{10000^M}");
     ...

Note the ^M inside the string. Do you think this is an isolated bug in 
tpl2cpp that we can fix, to make ADMB as robust to line endings as GCC and 
related tools?

Arni



---------- Forwarded message ----------
Date: Thu, 20 May 2010 19:57:34 +0000 (UTC)
From: Arni Magnusson <arnima at hafro.is>
To: Saang-Yoon Hyun <shyunuw at gmail.com>, forh at critfc.org
Cc: users at admb-project.org
Subject: Re: [ADMB Users] ADMB in a Linux machine

Hi Saang-Yoon,

The problem you're running into is that ADMB in Linux doesn't like Windows 
line endings (see http://en.wikipedia.org/wiki/Newline#Common_problems).

You can convert between Linux and Windows line endings using a text 
editor, or command line tools like 'dos2unix' and 'unix2dos':

$ dos2unix mark_recap13.tpl
$ admb mark_recap13.tpl
$ mark_recap13 -ind mr_v13.dat

Arni



On Thu, 13 May 2010, Saang-Yoon Hyun wrote:

> A programmer at my agency and I run into a few errors in compling a TPL 
> file in a Linux machine.  We believe this problem is about a mis-match 
> between a complier and the TPL codes, because the TPL file was perfectly 
> run in a MS Window machine.  I wonder about whether you had some 
> experience in compling and linking a TPL file in a Linux machine.  If 
> not, would you introduce someone else we can inquire? For information, I 
> attach TPL and DAT files to this email.
> 
> Thank you very much,
> 
> Saang-Yoon
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mark_recap13.tpl
Type: application/vnd.groove-tool-template
Size: 3778 bytes
Desc: 
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20100520/c9de93cd/attachment.bin>
-------------- next part --------------
#Two parts of data

#

#=========== Does your double-tagging study use identical tags?

#=========== If yes, write 1.  Otherwise, write 0.  (Y or N)

1

#

#================1: Double tagging for estimating tag loss rate 

#Out of the number of fish recaptured (= D1 + D2)

#D.R1: number of fish retaining one tag (or only permanent mark)

21

#

#D.R2: number of fish retaining both tags (or tag and permanent marks)

30

#

#================2: For estimating abundance 

#Number of fish initially marked and released, which is composed of 

#single-tagged and double-tagged fish

#M.S: number of fish initially single-tagged and released

2807

#M.D: number of fish initially double-tagged and released

491

#

#C: number of fish sampled later (they include marked and unmarked fish)

11444

#

#R: number of marked fish recaptured/resighted.

#Recaptured/Resighted fish are from either single-tagged fish or 

#double-tagged fish (i.e., R=R.S+R.D).

420



More information about the Developers mailing list