Opened 15 years ago
Closed 14 years ago
#617 closed defect (fixed)
r.sim.water crashes on WinGrass
Reported by: | hamish | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 6.4.0 |
Component: | Raster | Version: | 6.4.0 RCs |
Keywords: | wingrass, r.sim.water | Cc: | |
CPU: | x86-32 | Platform: | MSWindows XP |
Description
As reported on grass-user by Bernd Tyrna: (I can reproduce it on wingrass using the spearfish.sh test script in the source dir; on linux it is fine)
Hello! Has anyone experience with using r.sim.water under Windows? I'm planning to use it for the simulation of flash flood events. I tried it with a DEM (1m resolution) with the following region setting: g.region -p rojection: 99 (Transverse Mercator) zone: 0 datum: potsdam ellipsoid: bessel north: 5377000.5 south: 5375999.5 west: 3502999.5 east: 3504000.5 nsres: 1 ewres: 1 rows: 1001 cols: 1001 cells: 1002001 I calculated the first order partial derivative dx and dy with r.slope.aspect (Do I have to use degrees in the settings?) Leaving everything else unchanged for a testrun, I get the following message and r.sim.water crashes: "r.sim.water.exe hat ein Problem festgestellt und muss beendet werden." ("r.sim.water.exe has detected a problem and has to be closed") Can anyone tell me what's going wrong? Would it be better to use GRASS under Linux for this purpose? Thanks for your help, Bernd
with "g.gisenv set="DEBUG=3" set I can see that it happens after "Running MAY 10 version," text. Next step in the program after that is to allocate memory...... so I'm guessing it's a malloc problem that is only triggered on windows, much like we saw in r.los in bug #111 (and I expect we'll see a lot more of these).
valgrind running now (slow),
Hamish
Change History (14)
comment:1 by , 15 years ago
comment:2 by , 15 years ago
I can only confirm that it crashes on both Windows and Mac but not on linux. It indeed looks like malloc problem - it crashes in input.c after running G_malloc for all rasters it uses. I looked at r.los bug discussion https://trac.osgeo.org/grass/ticket/111, but I could not figure out from it what the fix is. If there is an example in other modules on how this should be handled so that it can run on windows that would help.
143 for (l = 0; l < my; l++) { 144 /*for each my, allocate a second dimension in array 145 * for each input with length of matrix X*/ 146 zz[l] = (float *)G_malloc(sizeof(float) * (mx)); 147 v1[l] = (double *)G_malloc(sizeof(double) * (mx)); 148 v2[l] = (double *)G_malloc(sizeof(double) * (mx)); 149 150 if (rain != NULL || rain_val >= 0.0) 151 si[l] = (double *)G_malloc(sizeof(double) * (mx)); 152 ...... 168 169 if (wdepth != NULL) 170 gama[l] = (double *)G_malloc(sizeof(double) * (mx)); 171 } 172 173 G_debug(3, "Running MAY 10 version, started modifications on 20080211"); 174 175 /* Check if data available in mapsets 176 * if found, then open the files */ 177 if ((mapset = G_find_cell(elevin, "")) == NULL) 178 G_fatal_error(_("Raster map <%s> not found"), elevin);
comment:3 by , 15 years ago
Helena: please create a debug backtrace on Mac (or ideally on Windows). I guess that a wrong allocation or free function is used which causes problems on Windows.
Markus
comment:4 by , 15 years ago
I looked at this again and on Mac it crashes with segmentation fault after all allocations are done
when it tries to find the cell file. This is in 6.4. It runs on linux, no problems.
I am wondering whether the port to grass7 (thanks Soeren, it is greatly appreciated)
could have fixed it for Mac and windows.
Below is more info,
Helena
GRASS 6.4.0RC5 (nc_spm_08):~ > r.sim.water -t elevin=elev_lid792_2m dxin=dx_2m dyin=dy_2m \ rain=rain50mmhr infil=infil0 manin=man05 depth=wdp_2m disch=disch_2m nwalk=400000 \ niter=500 outit=20 hmax=0.2 halpha=8.0 hbeta=1.0 D2/3: G__read_Cell_head D2/3: G__read_Cell_head_array D3/3: region item: proj: 99 D3/3: region item: zone: 0 D3/3: region item: north: 220750 D3/3: region item: south: 220000 D3/3: region item: east: 639000 D3/3: region item: west: 638300 D3/3: region item: cols: 350 D3/3: region item: rows: 375 D3/3: region item: e-w resol: 2 D3/3: region item: n-s resol: 2 D3/3: region item: top: 1 D3/3: region item: bottom: 0 D3/3: region item: cols3: 700 D3/3: region item: rows3: 750 D3/3: region item: depths: 1 D3/3: region item: e-w resol3: 1 D3/3: region item: n-s resol3: 1 D3/3: region item: t-b resol: 1 D3/3: rain_val is set to: -999.990000 D3/3: manin_val is set to: -999.990000 D3/3: infil_val is set to: -999.990000 D3/3: Running MAY 10 version, started modifications on 20080211 Segmentation fault 2ss: r.sim.water [2918] Path: /Applications/GRASS-6.4.app/Contents/MacOS/bin/r.sim.water Identifier: r.sim.water Version: ??? (???) Code Type: X86-64 (Native) Parent Process: bash [2854] Interval Since Last Report: 988538 sec Crashes Since Last Report: 13 Per-App Interval Since Last Report: 0 sec Per-App Crashes Since Last Report: 1 Date/Time: 2010-01-26 22:49:18.534 -0500 OS Version: Mac OS X 10.5.7 (9J61) Report Version: 6 Anonymous UUID: B013BEBF-D492-49C8-8BC0-DE006ADDF1AF Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000 Crashed Thread: 0 Thread 0 Crashed: 0 libgrass_gis.dylib 0x0000000124b9f70e G__name_is_fully_qualified + 22 1 libgrass_gis.dylib 0x0000000124b960f3 find_file1 + 88 2 libgrass_sim.dylib 0x00000001125c5a6b input_data + 1422 3 r.sim.water 0x000000010000253f main + 3153 4 r.sim.water 0x00000001000018cc start + 52 Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000001 rbx: 0x00007fff5fbfe7a0 rcx: 0x0000000000000000 rdx: 0x00007fff5fbfe6a0 rdi: 0x0000000000000000 rsi: 0x00007fff5fbfe7a0 rbp: 0x00007fff5fbfe670 rsp: 0x00007fff5fbfe670 r8: 0x00000001125c9a64 r9: 0x0000000000000001 r10: 0x0000000124b87f30 r11: 0x0000000124b95d51 r12: 0x00007fff5fbfe6a0 r13: 0x0000000000000000 r14: 0x00007fff5fbfe7a0 r15: 0x00000001125c9a64 rip: 0x0000000124b9f70e rfl: 0x0000000000010202 cr2: 0x0000000000000000
follow-ups: 6 8 comment:5 by , 15 years ago
I have hardly tried to find the error using valgrind, but was unsuccessful. Neither the grass6.4 version nor the grass7 version showing any suspicious behavior on 32bit Linux. So i don't know if my changes may have solved the problem, but it would be great, if anybody may compile the latest grass7 version on MacOS or Windows for testing, running the speafish60 example.
Helena can you please provide a simple spearfish example for r.sim.sediment, so i can test my changes with this module?
BTW: Is it possible to add the water depth in every step to the elevation map and additionally computing the direction derivatives dx and dy to avoid infinite water accumulation in sinks and pits? I suggest this will make the solution of the partial differential equation non linear, but maybe the time steps are already small enough to implement this as an explicit step?
Soeren
comment:6 by , 15 years ago
Replying to huhabla:
Helena can you please provide a simple spearfish example for r.sim.sediment, so i can test my changes with this module?
Examples are here:
http://courses.ncsu.edu/mea582/lec/001/GIS_anal_grass/GIS_Anal_grsimwe.html
Markus
follow-up: 10 comment:7 by , 15 years ago
Here a test for the NC dataset (from the ML):
g.region rural_1m res=2 -p r.mapcalc "man05 = 0.05" r.mapcalc "infil0 = 0.0" r.mapcalc "rain50mmhr = 50" v.surf.rst -d input=elev_lid792_bepts layer=0 elev=elev_lid792_2m slope=dx_2m \ aspect=dy_2m ten=15 smooth=1.5 segmax=25 npmin=100 r.sim.water -t elevin=elev_lid792_2m dxin=dx_2m dyin=dy_2m rain=rain50mmhr \ infil=infil0 manin=man05 depth=wdp_2m disch=disch_2m nwalk=400000 \ niter=500 outit=20 hmax=0.2 halpha=8.0 hbeta=1.0
follow-up: 9 comment:8 by , 15 years ago
Replying to huhabla: [...]
So i don't know if my changes may have solved the problem, but it would be great, if anybody may compile the latest grass7 version on MacOS or Windows for testing, running the speafish60 example.
tested with the latest WinGrass7-nightly-build:
C:\Program Files\GRASS-70-SVN>r.sim.water elevin=elevation.10m dx_input=elev_dx dy_input=elev_dy rain_input=rain man_input=manning infil_input=infilt nwalk=500 0000 depth=depth D2/3: G__read_Cell_head D2/3: G__read_Cell_head_array D3/3: region item: proj: 1 D3/3: region item: zone: 13 D3/3: region item: north: 4928000 D3/3: region item: south: 4914020 D3/3: region item: east: 609000 D3/3: region item: west: 590010 D3/3: region item: cols: 1899 D3/3: region item: rows: 1398 D3/3: region item: e-w resol: 10 D3/3: region item: n-s resol: 10 D3/3: region item: top: 1 D3/3: region item: bottom: 0 D3/3: region item: cols3: 1899 D3/3: region item: rows3: 1398 D3/3: region item: depths: 1 D3/3: region item: e-w resol3: 10 D3/3: region item: n-s resol3: 10 D3/3: region item: t-b resol: 1 D3/3: rain_val is set to: -999.990000 D3/3: manin_val is set to: -999.990000 D3/3: infil_val is set to: -999.990000 D3/3: Running JAN 2010 version, started modifications on 20080211
Helmut
comment:9 by , 15 years ago
Replying to hellik:
tested with the latest WinGrass7-nightly-build:
sorry forgotten to note, also a crash in WinGrass7 with r.sim.water
Helmut
comment:10 by , 14 years ago
Replying to neteler:
Here a test for the NC dataset (from the ML):
g.region rural_1m res=2 -p r.mapcalc "man05 = 0.05" r.mapcalc "infil0 = 0.0" r.mapcalc "rain50mmhr = 50" v.surf.rst -d input=elev_lid792_bepts layer=0 elev=elev_lid792_2m slope=dx_2m \ aspect=dy_2m ten=15 smooth=1.5 segmax=25 npmin=100 r.sim.water -t elevin=elev_lid792_2m dxin=dx_2m dyin=dy_2m rain=rain50mmhr \ infil=infil0 manin=man05 depth=wdp_2m disch=disch_2m nwalk=400000 \ niter=500 outit=20 hmax=0.2 halpha=8.0 hbeta=1.0
tested with WinGRASS-6.4.SVN-r42833-1-Setup.exe on a WinVista32, r.sim.water still fails.
r.sim.water -t elevin=elev_lid792_2m dxin=dx_2m dyin=dy_2m rain=rain50mmhr infil=infil0 manin=man05 depth=wdp_2m disch=disch_2m nwalk=400000 niter=500 outit=20 hmax=0.2 halpha=8.0 hbeta=1.0 D2/3: G__read_Cell_head D2/3: G__read_Cell_head_array D3/3: region item: proj: 99 D3/3: region item: zone: 0 D3/3: region item: north: 220750 D3/3: region item: south: 220000 D3/3: region item: east: 639000 D3/3: region item: west: 638300 D3/3: region item: cols: 350 D3/3: region item: rows: 375 D3/3: region item: e-w resol: 2 D3/3: region item: n-s resol: 2 D3/3: region item: top: 1 D3/3: region item: bottom: 0 D3/3: region item: cols3: 700 D3/3: region item: rows3: 750 D3/3: region item: depths: 1 D3/3: region item: e-w resol3: 1 D3/3: region item: n-s resol3: 1 D3/3: region item: t-b resol: 1 D3/3: rain_val is set to: -999.990000 D3/3: manin_val is set to: -999.990000 D3/3: infil_val is set to: -999.990000 D3/3: Running MAY 10 version, started modifications on 20080211
follow-up: 12 comment:11 by , 14 years ago
this has been fixed in grass7 and perhaps in grass65 too (I will need to check at home on the Mac). I think the fix should work for windows - it works for me on mac - I think Glynn submitted it.I am not sure it could be ported to 64 - perhaps Glynn has a suggestion? (sorry for the vague response I am away and just guessing)
Helena
follow-up: 13 comment:12 by , 14 years ago
Replying to helena:
this has been fixed in grass7 and perhaps in grass65 too (I will need to check at home on the Mac). I think the fix should work for windows - it works for me on mac - I think Glynn submitted it.I am not sure it could be ported to 64 - perhaps Glynn has a suggestion? (sorry for the vague response I am away and just guessing)
I think that you're referring to r42402. That hasn't been back-ported to either 6.x branch, although it shouldn't be hard to do so.
comment:13 by , 14 years ago
Replying to glynn:
Replying to helena:
this has been fixed in grass7 and perhaps in grass65 too (I will need to check at home on the Mac). I think the fix should work for windows - it works for me on mac - I think Glynn submitted it.I am not sure it could be ported to 64 - perhaps Glynn has a suggestion? (sorry for the vague response I am away and just guessing)
I think that you're referring to r42402. That hasn't been back-ported to either 6.x branch, although it shouldn't be hard to do so.
I've tried with a self compiled WinGrass7 (r42884) and the example from the man-page with the spearfish-dataset:
r.sim.water finishes:
r.sim.water --verbose elevation=elevation.10m@PERMANENT dx=elev_dx@g7 dy=elev_dy@g7 rain=rain@g7 infil=infilt@g7 man=manning@g7 depth=depthrm disch=disrm err=simrm nwalk=5000000 niter=10 Min elevation = 1061.09 m Max elevation = 1846.74 m Mean Source Rate (rainf. excess or sediment) = 0.000001 m/s or kg/m2s Mean flow velocity = 8.722405 m/s Mean Mannings = 0.050124 Number of iterations = 523 cells Time step = 0.29 s (Fri Jul 23 23:22:12 2010) Command finished (4062 sec)
so backporting to the grass6-branches?
best regards Helmut
comment:14 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed in r44518. Helena reported that the modules work now on winGRASS. Closing.
...