Author Topic: Something very strange  (Read 6206 times)

halleluja

  • Full Member
  • ***
  • Posts: 80
Something very strange
« on: October 13, 2020, 01:50:49 PM »
Hi everyone,

i have written a subroutine, but i found something very strange.
If i add this code
Code: [Select]
         print*,'foundus6',foundus6 
to my subroutine, it works fine.

If i didn't add this code , i got this
Code: [Select]
*ERROR* Residual norm is NaN or Inf
Note: The following floating-point exceptions are signalling: IEEE_INVALID_FLAG IEEE_DIVIDE_BY_ZERO IEEE_UNDERFLOW_FLAG IEEE_DENORMAL


It is strange that the print function has influence on the code if it works fine.

halleluja

  • Full Member
  • ***
  • Posts: 80
Re: Something very strange
« Reply #1 on: October 13, 2020, 01:53:17 PM »
Here foundus6 is a logical type data:
Code: [Select]
      logical foundus6

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: Something very strange
« Reply #2 on: October 13, 2020, 02:36:43 PM »
When you add a print statement you cause the compiler to change the way it produces the final executable.

You have a bug somewhere, a dimension error probably.  You can use the debugger to find where it is -- first carefully check your program.

You can also post your routine for users to check.

halleluja

  • Full Member
  • ***
  • Posts: 80
Re: Something very strange
« Reply #3 on: October 13, 2020, 02:55:15 PM »
Dear Prof. R.L. Taylor,

thanks a lot for your reply.

But if i change
Code: [Select]
        print*,'foundus6',foundus6 to
Code: [Select]
        print*,'foundus6', it still dosen't work, even though with a print statement here.

Prof. R.L. Taylor

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 2649
Re: Something very strange
« Reply #4 on: October 13, 2020, 02:59:23 PM »
This is typical.  You have a bug somewhere!

halleluja

  • Full Member
  • ***
  • Posts: 80
Re: Something very strange
« Reply #5 on: October 13, 2020, 03:03:17 PM »
Alright i will try to debug first. Thanks.:)

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Something very strange
« Reply #6 on: October 13, 2020, 03:34:46 PM »
Valgrind and GDB will be your friends here.

halleluja

  • Full Member
  • ***
  • Posts: 80
Re: Something very strange
« Reply #7 on: October 14, 2020, 05:30:00 AM »
Dear Prof. S. Govindjee,

is it possible that you make an example how gdb works on feap like your video how man install feap. I think this will help a lot feap users. :)


Best wishes

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Something very strange
« Reply #8 on: October 14, 2020, 08:18:32 PM »
A video on how to use GDB is perhaps a pretty big undertaking.  The best thing to do is to locate someone local that uses it to show you how it works on an elementary level, for example a computer science student.

For valgrind you can try running the following but beware that there will lots of output and you will have to wade through it carefully.
Code: [Select]
valgrind -v --leak-check=full --show-reachable=yes feap
« Last Edit: October 14, 2020, 10:08:15 PM by Prof. S. Govindjee »

JStorm

  • Sr. Member
  • ****
  • Posts: 250
Re: Something very strange
« Reply #9 on: October 14, 2020, 10:12:37 PM »
There are explainations available at www, also as video like https://www.youtube.com/watch?v=bWH-nL7v5F4.
FEAP is nothing special whyile using GDB. Make sure you compile with debugging flag "-g" and without optimization "-O0".

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1164
Re: Something very strange
« Reply #10 on: October 15, 2020, 02:07:34 AM »
The no-optimization recommendation is tricky.  Sometimes the problem with a program is the optimization assumptions of the compiler.  If this is the case, then you need to debug at the optimization level at which the error appears.  Of course if the error you wish to debug appear in -O0, then that will be the easier way to go.