[ADMB Users] lgam in 10.0

24 views
Skip to first unread message

Mollie Brooks

unread,
May 14, 2011, 3:12:44 PM5/14/11
to us...@admb-project.org
Hi ADMBers,
I'm running 10.0 on a mac and this old problem seems to have reoccurred

The message I get is:
*** Linking: adlink firdbhfec
g++  -O3 -L/usr/local/admb/lib firdbhfec.o -ldf1b2o -ladmod -ladt -lado -ldf1b2o -ladmod -ladt -lado -o firdbhfec
ld: duplicate symbol lgam(double)in /usr/local/admb/lib/libado.a(cgamdev.obj) and /usr/local/admb/lib/libdf1b2o.a(df13tester.obj)
collect2: ld returned 1 exit status

Is this fixed in version 10.1? I saw in the readme.txt file that there was a fix to gammln functions.
thanks,
Mollie



Mollie Brooks

unread,
May 14, 2011, 5:11:18 PM5/14/11
to us...@admb-project.org
Hi, 
Just an update... To try to answer my own question, I downloaded the source for 10.1 and followed the instructions in README.txt for Unix and GNU g++ since there weren't instructions for Macs. The install seems to have worked, but I noticed that it didn't replace the version in /usr/local/
So I edited the file ./.bashrc to now have the lines

export ADMB_HOME=/Users/molliebrooks/Desktop/admb-10.1//build
export PATH=$ADMB_HOME/bin:$PATH

because I think that's the location of the necessary files. Then I reran the model and still got the error for lgam

*** Linking: adlink firdbhfec
g++  -O3 -L/usr/local/admb/lib firdbhfec.o -ldf1b2o -ladmod -ladt -lado -ldf1b2o -ladmod -ladt -lado -o firdbhfec
ld: duplicate symbol lgam(double)in /usr/local/admb/lib/libado.a(cgamdev.obj) and /usr/local/admb/lib/libdf1b2o.a(df13tester.obj)
collect2: ld returned 1 exit status

So I found all the instances of "lgam" in df13tester.cpp
How much of this should I comment out? Is it just the definition of lgam(double) lines 943 to 1050? What about lines 309 and 314?

double lgam ( double );
double lgam();

thanks,
Mollie

Mollie Brooks
Ph.D. Candidate
NSF IGERT Fellow
Biology Department
University of Florida



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

Ian Taylor

unread,
May 14, 2011, 5:55:12 PM5/14/11
to Mollie Brooks, us...@admb-project.org

Hi Mollie,

Thanks to your modifying the path, your computer now has two places where it can search for ADMB binaries:

/usr/local/, and the folder on your desktop. Unfortunately, when you call admb, it appears to go to /usr/local/ first and never sees the new version. You can tell this because the command

                g++  -O3 -L/usr/local/ admb/lib

includes the location /usr/local/ and does not include your new location.

 

What I would do is delete the entire /usr/local/admb/ directory, in which case you won’t have this problem.

An alternative is to go to /Users/molliebrooks/Desktop/admb-10.1//build/bin/ and rename 3 files

            admb to admbNew

&nbs ;       adcomp to adcompNew

            adlink to adlinkNew

(or whatever naming scheme you prefer). Then edit the file admbNew and look for every instance of “adcomp” or “adlink” and change them to “adcompNew” and “adlinkNew”. Now you should have two independent methods of compiling ADMB by calling either admb or admbNew.

 

-Ian

 

 

From: users-...@admb-project.org [mailto:users-...@admb-project.org] On Behalf Of Mollie Brooks
Sent: Saturday, May 14, 2011 2:11 PM
To: us...@admb-project.org
Subject: Re: [ADMB Users] lgam in 10.0

 

Hi, 

Just an update... To try to answer my own question, I downloaded the source for 10.1 and followed the instructions in README.txt for Unix and GNU g++ since there weren't instructions for Macs. The install seems to have worked, but I no ace the version in /usr/local/

So I edited the file ./.bashrc to now have the lines

 

export ADMB_HOME=/Users/molliebrooks/Desktop/admb-10.1//build

export PATH=$ADMB_HOME/bin:$PATH

 

because I think that's the location of the necessary files. Then I reran the model and still got the error for lgam

 

*** Linking: adlink firdbhfec

g++  -O3 -L/usr/local/admb/lib firdbhfec.o -ldf1b2o -ladmod -ladt -lado -ldf1b2o -ladmod -ladt -lado -o firdbhfec

ld: duplicate symbol lgam(double)in /usr/local/admb/lib/libado.a(cgam dev.obj) libdf1b2o.a(df13tester.obj)

collect2: ld returned 1 exit status

 

So I found all the instances of "lgam" in df13tester.cpp

How much of this should I comment out? Is it just the definition of lgam(double) lines 943 to 1050? What about lines 309 and 314?

 

double lgam ( double );

double lgam();

 

thanks,

Mollie

 

Mollie Brooks

Ph.D. Candidate

NSF IGERT Fellow

Biology Department

University of Florida

 

 

 

On 14 May 2011, at 3:12 PM, Mollie Brooks wrote:



Hi ADMBers,

I'm running 10.0 on a mac and this old problem seems to have reoccurred

 

Th e messag >

*** Linking: adlink firdbhfec

g++  -O3 -L/usr/local/admb/lib firdbhfec.o -ldf1b2o -ladmod -ladt -lado -ldf1b2o -ladmod -ladt -lado -o firdbhfec

ld: duplicate symbol lgam(double)in /usr/local/admb/lib/libado.a(cgamdev.obj) and /usr/local/admb/lib/libdf1b2o.a(df13tester.obj)

collect2: ld returned 1 exit status

 

Is this fixed in version 10.1? I saw in the readme.txt file that there was a fix to gammln functions.

thanks,

<span style='font-f amily:"C ></span><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><div><p class=MsoNormal><o:p> </o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div><p class=MsoNormal>_______________________________________________<br>Users mailing list<br><a href="mailto:Us...@admb-project.org">Us...@admb-project.org</a><br><a href="http://lists.admb-project.org/mailman/listinfo/users">http://lists.admb-project.org/mailman/listinfo/users</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></div></body></html>

dave fournier

unread,
May 14, 2011, 7:35:39 PM5/14/11
to us...@admb-project.org
My guess would be that df13tester can be deleted. You can't break
anything by getting rid
of stuff in the library. Worst case it that you get an unsatisfied
reference and then you can
just add that part back.

Mollie Brooks

unread,
May 15, 2011, 2:09:30 PM5/15/11
to Ian Taylor, us...@admb-project.org, Ben Bolker
Hi Ian,
Talking to a friend last night, I learned that I had to use sudo to delete /usr/local/admb (I'm really new to this type of programming.) So I did that this morning and changed ./.bashrc to have 
export ADMB_HOME= /Users/molliebrooks/Desktop/admb-10.1/build/admb-10.1-macos10.6.7-xcode3.2.5-64bit/

How do  I "rerun .bashrc"?
After making these changes, I tried to run my program again (even thought I haven't debugged lgam yet) and I got this error:

mollie-brookss-macbook-4:~ molliebrooks$ cd /Users/molliebrooks/Desktop/UF\ ADMB\ May\ Workshop/examples/FirFecundity/
mollie-brookss-macbook-4:FirFecundity molliebrooks$ admb firdbhfec
/usr/local/bin/admb: fork: Resource temporarily unavailable

So I guess that means that specifying ADMB HOME does nothing? 
Should I move some admb files to /usr/local/bin?
thanks,
Mollie

On 14 May 2011, at 8:06 PM, Ian Taylor wrote:

Dave’s suggestion will hopefully fix everything.
But if you say that things are imbedded deeper, that could also be the reason it didn’t find the new version.
change ADMB_HOME to /Users/molliebrooks/Desktop/admb-10.1/build/admb-10.1-macos10.6.7-xcode3.2.5-64bit/
then rerun .bashrc
and then try again. ADMB_HOME/bin has to contain the admb, adcomp, and adlink.< mal>-Ian
 
From: Mollie Brooks [mailto:mbr...@ufl.edu] 
Sent: Saturday, May 14, 2011 4:11 PM
To: Ian Taylor
Subject: Re: [ADMB Users] lgam in 10.0
 
Thanks Ian for trying to help. I can't get either of those solutions to work. 
I can't delete /usr/local/admb because I don't have permission and I can't mod
 
I tried to rename the files you suggested. They are imbedded deeper than I expected
/Users/molliebrooks/Desktop/admb-10.1/build/admb-10.1-macos10.6.7-xcode3.2.5-64bit/bin
When I tried to look for every instance of “adcomp” or “adlink” and change them to “adcompNew” and “adlinkNew” there was only one instance of "adlink" and none of "adcomp" in admbNEW.
 
I think I should just give up on this. I was hoping to show some students an example and exercise using log_negbinomial_densit this hard to get it working, then I can't expect them to get it and should put my efforts into other examples and exercises. I'll just avoid negative binomial data for a while.
-Mollie
 
 
On 14 May 2011, at 5:55 PM, Ian Taylor wrote:


Hi Mollie,
Thanks to your modifying the path, your computer now has two places where it can search for ADMB binaries:
/usr/local/, and the folder on your desktop. Unfortunately, when you call admb, it appears to go to /usr/local/ first and never sees the new version. You can tell this because the command
                g++  -O3 -L/usr/local/admb/lib
includes the location /usr/local/ and does not include your new location.
 
What I would do is delete the entire /usr/local/admb/ you won’t have this problem.
An alternative is to go to /Users/molliebrooks/Desktop/admb-10.1//build/bin/ and rename 3 files
            admb to admbNew
&nbs ;       adcomp to adcompNew
            adlink to adlinkNew
(or whateve r). Then edit the file admbNew and look for every instance of “adcomp” or “adlink” and change them to “adcompNew” and “adlinkNew”. Now you should have two independent methods of compiling ADMB by calling either admb or admbNew.
 
-Ian
 
 
From: users-...@admb-project.org [mailto:users-...@admb-project.org] On Behalf Of Mollie Brooks
Sent: Saturday, May 14, 2011 2:11 PM
To: us...@admb-project.org
Subject: Re: [ADMB Users] lgam in 10.0
 
Hi, 
Just swer my own question, I downloaded the source for 10.1 and followed the instructions in README.txt for Unix and GNU g++ since there weren't instructions for Macs. The install seems to have worked, but I no ace the version in /usr/local/
So I edited the file ./.bashrc to now have the lines
 
export ADMB_HOME=/Users/molliebrooks/Desktop/admb-10.1//build
export PATH=$ADMB_HOME/bin:$PATH
 
because I think that's the location of the necessary files. Then I reran the model and still got the error for lgam
 
*** Linking: adlink /div>
g++  -O3 -L/usr/local/admb/lib firdbhfec.o -ldf1b2o -ladmod -ladt -lado -ldf1b2o -ladmod -ladt -lado -o firdbhfec
ld: duplicate symbol lgam(double)in /usr/local/admb/lib/libado.a(cgamdev.obj) libdf1b2o.a(df13tester.obj)
collect2: ld returned 1 exit status
 
So I found all the instances of "lgam" in df13tester.cpp
How much of this should I comment out? Is it just the definition of lgam(double) lines 943 to 1050? What about lines 309 and 314?
 
double lgam ( double );
double lgam();
 
 
thanks,
Mollie
 
Mollie Brooks
Ph.D. Candidate
NSF IGERT Fellow
Biology Department
University of Florida
 
On 14 May 2011, at 3:12 PM, Mollie Brooks wrote:



Hi ADMBers,
I'm running 10.0 on a mac and this old problem seems to have reoccurred
 

The messag >

Mollie Brooks

unread,
May 15, 2011, 2:12:27 PM5/15/11
to us...@admb-project.org
Is this only a problem on Macs? I'd be surprised if others aren't trying to use log_negbinomial_density
thanks,
Mollie

dave fournier

unread,
May 15, 2011, 2:42:40 PM5/15/11
to us...@admb-project.org

It raining again (still).
Thought I would look at this.
Below is the whole TPL file as I have modified it to get it to run.

first problme is that posfun must have a non negative second argument.
This is where the "positiveness" kicks in. If you make it 0.0 the
curvature is infinite. Best is to tune it as the model gets fitted.
Call it eps2 and begin with a bigger number in the first phase.
This is a typical technique to make the objective function well
behaved until you get near the solution.

x1=posfun(prevhr-starthr,eps2,fpen);
x2=posfun(hr-starthr,eps2,fpen);

Then

f=sum(elem_prod(eclosed,log(eps1+p))+elem_prod((avail-eclosed),
log(eps1+(1-p))));

will cause you trouble if p is too close to 0 or 1. so add a tiny number
and tune it as well.
Note the order of addition (eps1+(1-p)) ans figure out why (eps1+1-p)
may not work.

Then add a kludge variable with the number of phases that you want. I
always name if
kkludge so that I l know what its purpose is.

> f+=square(kkludge);

Now run the model and tune the values of eps1 eps2 to be small but the
model still converges.
I got into this and ended up with 5 phases. the value of eps1 has a
large effect.
I ran with the CLO of -crit 1.e-8.

DATA_SECTION
init_int nobs
init_int nttt
init_vector eclosed(1,nobs)
init_vector avail(1,nobs)
init_vector hr(1,nobs)
init_vector prevhr(1,nobs)
init_matrix ttt(1,nobs,1,nttt)
PARAMETER_SECTION
init_vector tttcoefs(1,nttt)
init_number k
init_number starthr
init_number kkludge(5);
vector loglam(1,nobs)
vector p(1,nobs)
vector lambda(1,nobs)
vector x1(1,nobs)
vector x2(1,nobs)

objective_function_value f

PROCEDURE_SECTION
double eps1=1.e-13;
double eps2=0.001;
if (current_phase()<2)
{
eps1=1.e-2;
eps2=.02;;
}
else if (current_phase()<3)
{
eps1=1.e-8;
}
else if (current_phase()<4)
{
eps1=1.e-10;
}
else if (current_phase()<5)
{
eps1=1.e-12;
}

loglam=ttt*tttcoefs;
lambda=exp(loglam);
dvariable fpen=0.0;
x1=posfun(prevhr-starthr,eps2,fpen);
x2=posfun(hr-starthr,eps2,fpen);

p=exp(-pow(elem_div(x1,lambda),k))-exp(-pow(elem_div(x2,lambda),k));
f=sum(elem_prod(eclosed,log(eps1+p))+elem_prod((avail-eclosed),
log(eps1+(1-p))));
f+=square(kkludge);
TOP_OF_MAIN_SECTION
arrmblsize = 2147483647;

dave fournier

unread,
May 15, 2011, 3:00:50 PM5/15/11
to us...@admb-project.org
Still raining.

After you change the .bashrc (or whatever it is named) you need to close
the terminal
and reopen it. (that works on Linux maybe with Macs you need to log out,
can't recall.
Then it should work. On Linux the system keeps track of where the
executable programs are
so if you remove one and don't refresh it somehow such as by logging in
or in Linux
typing the command

hash

It may act confused as to where admb is.

In the good old days when this was closed source as God intended I
would have rebuilt the sources
and pointed the users at them and the lgam problem would have been fixed
overnight ...
Now we need a committee.

Reply all
Reply to author
Forward
0 new messages