Re: grdmath problems
Joachim Saul <[email protected]>
| Newsgroups | gmane.comp.gis.gmt.user |
|---|---|
| Message-ID | <[email protected]> |
Paul Wessel [25.01.2014 01:49]: > I've running the tests in ubuntu 13.04 and no problems. Given the various strange GMT errors we have seen over the last years, always involving ubuntu, especially their own package builds, makes me wonder if there is something very odd with that platform. Since I cannot even reproduce the problem on ubuntu (Not to mention other os) I am afraid the original poster will need to run debug on that command to see what is going on. For starters, could you add -V so you can see how far it gets (the order of the operators) before it dies. Perhaps that can give a clue. Otherwise build with debug flags and what line it dies in. Concerned by Paul's comments about the Ubuntu GMT packages, I ran a few tests in order to see if I could reproduce the error. I am using Ubuntu 13.10 32-bit and GMT 4.5.9 (which is the default in Ubuntu 13.10). No other GMT version is installed (i.e. no colliding libraries etc). If I try hard enough I can indeed reproduce the error. Out of the different invocations proposed in this thread, the error seems to occur only under the following condition: $ ln -s /usr/lib/gmt/bin $ bin/grdmath ... and even then *only* if the file names of the input grids are one character + ".grd". Naming the files "1.grd" etc. produces the error as well as naming them "x.grd" etc. The error does *not* occur if I call grdmath as $ grdmath ... or $ /usr/lib/gmt/bin/grdmath ... Also, if I rename the input grdfiles to say g1.grd etc (as suggested by Joaquim Luis), the error is *not* produced. Quite strangely, if I just add -V to a command line that does produce the error, it suddenly works! Even more strangely, running the same command line from within gdb also works (even though in principle gdb doesn't make much sense here as the Ubuntu GMT package was compiled without debugging symbols). At this point it was time to compile GMT 4.5.9 from source. Version 4.5.9 in order not to compare apples and oranges. In addition I made sure to end up with only one GMT installation by removing the Ubuntu package first. $ sudo apt-get remove libgmt4 gmt $ ./configure --prefix=$HOME/gmt --enable-debug --without-x and so on. This time all tests work - bingo! I was about to conclude that it must be a problem with the Ubuntu package... Just for completeness, however, I once again recompiled without "--enable-debug" - with a very surprising result: *** buffer overflow detected *** again! Aarrgghhhh!!!! In other words: the crash seems to occur only if no debugging is enabled, which is not only quite strange but obviously makes it very hard to find the error using gdb... a dilemma! Once again I ran the same tests on my office computer with Ubuntu 12.04.4 LTS 64-bit. No re-compilation, just using the Ubuntu GMT package (which is 4.5.6) to see what happens. And even though the office computer is rather different, the buffer overflow is again produced and under exactly the same conditions, with the same possible "workarounds" like ./1.grd, -V etc. The results so far are inconclusive. Up to now it isn't even possible to say whether the error is in the GMT code. What else to check? @Branden: As mentioned, option -V coincidentally prevents the crash here, for unknown reasons. Could you try to include -V in your shakemap script as a quick+dirty workaround and see if it helps for the time being? Regards Joachim To unsubscribe, send the message "signoff gmt-help" to [email protected]
strange-behavior.sh
(application/x-shellscript, 2.4 KB)
#!/bin/sh -x cat /etc/issue which grdmath locate grdmath | grep grdmath\$ cd mkdir -p strange_behavior cd strange_behavior grdmath -R0/10/0/10 -I1 X = 1.grd grdmath -R0/10/0/10 -I1 X = 2.grd grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd rm -f bin ln -s /usr/lib/gmt/bin /usr/lib/gmt/bin/grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd bin/grdmath 1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 2.grd DIV EXCH POW MUL = 3.grd bin/grdmath ./1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 ./2.grd DIV EXCH POW MUL = ./3.grd bin/grdmath g1.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 g2.grd DIV EXCH POW MUL = g3.grd grdmath -R0/10/0/10 -I1 X = x.grd grdmath -R0/10/0/10 -I1 X = y.grd bin/grdmath x.grd DUP DUP 10 LE 0.65 MUL EXCH DUP DUP DUP 10 GT EXCH 20 LE MUL EXCH 10 SUB 10 DIV -0.05 MUL 0.65 ADD MUL EXCH DUP DUP DUP 20 GT EXCH 30 LE MUL EXCH 20 SUB 10 DIV -0.07 MUL 0.60 ADD MUL EXCH DUP DUP DUP 30 GT EXCH 40 LE MUL EXCH 30 SUB 10 DIV -0.08 MUL 0.53 ADD MUL EXCH 40 GT 0.45 MUL ADD ADD ADD ADD 686 y.grd DIV EXCH POW MUL = z.grd