CosmoCoffee Forum Index CosmoCoffee

 
 FAQFAQ   SearchSearch  MemberlistSmartFeed   MemberlistMemberlist    RegisterRegister 
   ProfileProfile   Log inLog in 
Arxiv New Filter | Bookmarks & clubs | Arxiv ref/author:

debug errors (technique) in CAMB
 
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software
View previous topic :: View next topic  
Author Message
Ding-fang Zeng



Joined: 29 Dec 2016
Posts: 2
Affiliation: Beijing University of Technology

PostPosted: December 31 2016  Reply with quote

Dear All CAMBgurus,

I am a primary user of CAMB, I wish to follow the program's running line by line. My software environment is MacOSX10.10+gfortran5.2. I changed two lines of the Makefile as follows

DEBUGFLAGS = -O3 -fopenmp -ffast-math -fmax-errors=4
FFLAGS = -g -cpp -fbounds-check -fbacktrace -ffree-line-length-none -fmax-errors=4 -ffpe-trap=invalid,overflow,zero

so that I can use lldb of MacOSX-gfortran to debug the program. Now I encounter he problem of not being able to view the value of variables in the original program. An example of my debug outout is as follows

error: camb {0x00007b68}: unhandled type tag 0x0012
(DW_TAG_string_type), please file a bug and attach the file at the start of this
error message
Process 6753 stopped
* thread #1: tid = 0xe9ef, 0x000000010010aa4b camb`driver + 1724 at
inidriver.F90:107, queue = 'com.apple.main-thread', stop reason = step over
frame #0: 0x000000010010aa4b camb`driver + 1724 at inidriver.F90:107
104 call DarkEnergy_ReadParams(DefIni)
105
106 P%h0 = Ini_Read_Double('hubble')
-> 107 tempvar = P%h0
108
109 if (Ini_Read_Logical('use_physical',.false.)) then
110 P%omegab = Ini_Read_Double('ombh2')/(P%H0/100)**2
(lldb) print P%h0
error: warning: got name from symbols: P
error: use of undeclared identifier 'h0'
error: 1 errors parsing expression
(lldb) print tempvar
(double) $1 = 4.9865057503465331E-318
(lldb)

I want to view what's the value of P%h0, but I cannot do that directly. I have to declare local variable tempvar in advances. This is too too too troublesome for my further debugging of the system.

Can any CAMBguru gives me a hints to solve this question? Thank you very much!
Back to top
View user's profile  
Antony Lewis



Joined: 23 Sep 2004
Posts: 1293
Affiliation: University of Sussex

PostPosted: January 02 2017  Reply with quote

I would recommend the Intel Fortran compilers for debugging (I use Visual Fortran for Windows), the gfortran debugger's support for F90 and higher seems to be not very good. The CodeBlocks ide does have some integrated support (e.g. try CosmoBox), but still using gdb. The RedHat distribution may have integrated more of Intel's open-sources changes for F2003 compatibility, but I've not tried it.

Otherwise you can just put print statements in the compiled code (but that gets painful after a while..)
Back to top
View user's profile [ Hidden ] Visit poster's website
Ding-fang Zeng



Joined: 29 Dec 2016
Posts: 2
Affiliation: Beijing University of Technology

PostPosted: January 03 2017  Reply with quote

thank Antony very much!
Back to top
View user's profile  
Display posts from previous:   
Post new topic   Reply to topic    CosmoCoffee Forum Index -> Computers and software All times are GMT + 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group. Sponsored by WordWeb online dictionary and dictionary software.