Good evening to all
If I want to debug mySolver.F90, do I have to replace
elmerf90 mySolver.f90 -o mySolver
by something like for example
elmerf90 mySolver.f90 -o -g -O0 mySolver
hoping that these extra switches will override those of elmerf90.bat
or do I have to edit elmerf90.bat itself and replace
-g -DNDEBUG by something like for example -g -O0 -DFULLDEBUG
Best regards,
Marc
How to debug my solver
-
- Site Admin
- Posts: 4843
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: How to debug my solver
Hi Marc,
I think that if you have conflicting flags then the latter one usually prevails (in gnu compiler stack). So your first assumption should be ok.
I found a discussion on the topic that may be relevant:
https://stackoverflow.com/questions/405 ... tches-to-g
-Peter
I think that if you have conflicting flags then the latter one usually prevails (in gnu compiler stack). So your first assumption should be ok.
I found a discussion on the topic that may be relevant:
https://stackoverflow.com/questions/405 ... tches-to-g
-Peter
Re: How to debug my solver
Yes, thanks, these overridden compilation switches most probably work but I came about something more serious:
gdb ElmerSolver case.sif
only knows about the symbols from the Elmer source files. But of course, I want to debug my solvers whose names are contained in case.sif
(and this will be an issue for any debugger).
And another unrelated question:
What is the meaning of the -J switch with elmerf90 and thus f95? I could not find any information on it by either Googling it or typing info, man or help f95 under Linux.
I saw somebody use it as
elmerf90 -o flnm.so -J$ANYPATH flnm.F90
($ANYPATH is a folder path - I tried the current folder i.e. I typed -J.
and there was no complaint)
Yours truly
Marc
gdb ElmerSolver case.sif
only knows about the symbols from the Elmer source files. But of course, I want to debug my solvers whose names are contained in case.sif
(and this will be an issue for any debugger).
And another unrelated question:
What is the meaning of the -J switch with elmerf90 and thus f95? I could not find any information on it by either Googling it or typing info, man or help f95 under Linux.
I saw somebody use it as
elmerf90 -o flnm.so -J$ANYPATH flnm.F90
($ANYPATH is a folder path - I tried the current folder i.e. I typed -J.
and there was no complaint)
Yours truly
Marc
-
- Site Admin
- Posts: 4843
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: How to debug my solver
Hi
If you have arguments use:
You can also use "ELMERSOLVER_STARTINFO" to define the sif file. This was needed in the earlier days when command-line arguments where not always working. I think they were standardized in Fortran2008 and gradually got implemented.
-Peter
If you have arguments use:
Code: Select all
gdb --args ElmerSolver case.sif
-Peter
Re: How to debug my solver
Yes, works great ! Thank you Peter.
How about something harder now: How would I debug a parallel version of the above:
mpirun -n 2 ElmerSolver_mpi case.sif
?
Have a nice week-end
Marc
How about something harder now: How would I debug a parallel version of the above:
mpirun -n 2 ElmerSolver_mpi case.sif
?
Have a nice week-end
Marc
Re: How to debug my solver
Well, I guess it cannot be done, which is really too bad as I was really interested in coupling elmer to openfoam through
mpirun -n 2 myFoamsolver -parallel : -n 2 ElmerSolver_mpi case.sif
but unfortunately this quickly results in corrupted memory or aborted processes. I am not interested in openfoam's or elmer's internal mpi processes but only in the mpi coupling between the two.
Maybe the only to debug it is to insert a huge amount of print statements in all solvers whose names can be found in case.sif.
mpirun -n 2 myFoamsolver -parallel : -n 2 ElmerSolver_mpi case.sif
but unfortunately this quickly results in corrupted memory or aborted processes. I am not interested in openfoam's or elmer's internal mpi processes but only in the mpi coupling between the two.
Maybe the only to debug it is to insert a huge amount of print statements in all solvers whose names can be found in case.sif.
-
- Site Admin
- Posts: 4843
- Joined: 22 Aug 2009, 11:57
- Antispam: Yes
- Location: Espoo, Finland
- Contact:
Re: How to debug my solver
Hi
Note that you get more output when you set "Max Output Level" to a high value. Usually it is ~5 for production runs, I set it to ~10 for more verbose output, and 32 is the maximum output for desperate people.
This output is printed by process "0" in parallel simulation. To get output from all processes you can toggle with "Max Output Partition".
Finally, there is the (rather fresh) possibility to direct output to file. For serial you could redirect easily always but for parallel runs it makes life easier as every process writes to its own file. From the output it is possible to determine at least the interval where things fell apart.
-Peter
Note that you get more output when you set "Max Output Level" to a high value. Usually it is ~5 for production runs, I set it to ~10 for more verbose output, and 32 is the maximum output for desperate people.
This output is printed by process "0" in parallel simulation. To get output from all processes you can toggle with "Max Output Partition".
Finally, there is the (rather fresh) possibility to direct output to file. For serial you could redirect easily always but for parallel runs it makes life easier as every process writes to its own file. From the output it is possible to determine at least the interval where things fell apart.
Code: Select all
Simulation
...
Max Output Level = 20 ! 1-32
Max Output Partition = 100
Output To File = Logical True
Re: How to debug my solver
Hi Peter,raback wrote: ↑15 Sep 2021, 10:57 Hi Marc,
I think that if you have conflicting flags then the latter one usually prevails (in gnu compiler stack). So your first assumption should be ok.
I found a discussion on the topic that may be relevant:
https://stackoverflow.com/questions/405 ... tches-to-g
-Peter
I am compiling with the switch "-O0" as follows:
Code: Select all
elmerf90 PoissonTest.f90 -o -g -O0 PoissonTest
Code: Select all
with elmerice /usr/bin/f95 PoissonTest.f90 -o -g -O0 PoissonTest -DHAVE_PARMETIS
-DCONTIG= -DHAVE_EXECUTECOMMANDLINE -DUSE_ISO_C_BINDINGS -DUSE_ARPACK -O2 -g -DNDEBUG
-fPIC -shared -I/usr/share/elmersolver/include -L/usr/share/elmersolver/../../lib/elmersolver -Xlinker
-rpath=/usr/share/elmersolver/../../lib/elmersolver/../../share/elmersolver/lib
/usr/share/elmersolver/../../lib/elmersolver/../../share/elmersolver/lib/ElmerIceSolvers.so
/usr/share/elmersolver/../../lib/elmersolver/../../share/elmersolver/lib/ElmerIceUSF.so -shared -lelmersolver