OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
853 stars 311 forks source link

[segmentation fault] r.sim.sediment with dynamic allocation of walkers #1091

Closed PiotrKopysc closed 4 years ago

PiotrKopysc commented 4 years ago

Describe the bug r.sim.sediment module does not produce intended output. Terminal prints "segmentation fault" message.

To Reproduce On North Carolina Data set 1) I have used elev_lid792_1m, dx, dy, depth (from r.sim.water), as an input data detachment and transport capacity with critical shear stress were filled with a map of the error derived from r.sim.water since I was missing this data for North Carolina. Other input data such as manning's n stayed as default. The number of walkers was set to 10000. 2) In GRASS UI it did not create all the output raster, and none were added to a layer manager. The simulation ended up very quickly (0 seconds). When I used the terminal and copy-paste the command for r.sim.sediment It printed the "segmentation fault" message. 3) First two maps that were created were Transport Capacity and Transport Limited Erosion to Deposition, The one that was missing are Sediment Concentration, Sediment Flux, Erosion to Deposition, and Vector file of the walkers.

Command: r.sim.sediment --overwrite elevation=elev_lid792_1m@PERMANENT water_depth=NC_Depth@PERMANENT dx=NC_Dx@PERMANENT dy=NC_Dy@PERMANENT detachment_coeff=NC_Error@PERMANENT transport_coeff=NC_Error@PERMANENT shear_stress=NC_Error@PERMANENT transport_capacity=NC_TransportCapacity tlimit_erosion_deposition=NC_TransportLimitedErotoDepo sediment_concentration=NC_SedimentConcentration sediment_flux=NC_SedimentFlux erosion_deposition=NC_ErosiontoDeposition logfile=NC_Sample walkers_output=NC_Walkers_Sediment nwalkers=10000 nproces=4

Expected behavior Creation of entire output including rasters of sediment concentration, sediment flux, erosion to deposition, and vector file of the walkers.

Screenshots NC_Dataset_Depth NC_Dataset_Sediment1 NC_Dataset_Sediment2 NC_Dataset_Sediment3 NC_Dataset_Sediment4

System description (please complete the following information):

Additional context Add any other context about the problem here.

neteler commented 4 years ago

Would you be willing to run the process in the debugger? That's not complicated [1], something like this (note the r to actually run it inside gdb which you may need to install first):

gdb r.sim.sediment
...
(gdb) r --overwrite elevation=elev_lid792_1m@PERMANENT water_depth=NC_Depth@PERMANENT dx=NC_Dx@PERMANENT dy=NC_Dy@PERMANENT detachment_coeff=NC_Error@PERMANENT transport_coeff=NC_Error@PERMANENT shear_stress=NC_Error@PERMANENT transport_capacity=NC_TransportCapacity tlimit_erosion_deposition=NC_TransportLimitedErotoDepo sediment_concentration=NC_SedimentConcentration sediment_flux=NC_SedimentFlux erosion_deposition=NC_ErosiontoDeposition logfile=NC_Sample walkers_output=NC_Walkers_Sediment nwalkers=10000 nproces=4

... crash ...
bt full

For better debugging, it is needed to compile GRASS GIS with CFLAG -g:

CFLAGS="-g" ./configure ...
make
...

but you could give it a try without first.

[1] https://grasswiki.osgeo.org/wiki/GRASS_Debugging#Using_GDB

PiotrKopysc commented 4 years ago

Dear Mr. Neteler,

Thank you for taking interest in this problem. Today I will try to run the process in the debugger. However, the results should be available tomorrow. It is much appreciated for giving me these instructions as well. With that, I should be able to do this much quicker. Thank you for your time and help.

Best Regards, Piotr Kopyść

wt., 17 lis 2020 o 23:25 Markus Neteler notifications@github.com napisał(a):

Would you be willing to run the process in the debugger? That's not complicated [1], something like this (note the r to actually run it inside gdb which you may need to install first):

gdb r.sim.sediment ... (gdb) r --overwrite elevation=elev_lid792_1m@PERMANENT water_depth=NC_Depth@PERMANENT dx=NC_Dx@PERMANENT dy=NC_Dy@PERMANENT detachment_coeff=NC_Error@PERMANENT transport_coeff=NC_Error@PERMANENT shear_stress=NC_Error@PERMANENT transport_capacity=NC_TransportCapacity tlimit_erosion_deposition=NC_TransportLimitedErotoDepo sediment_concentration=NC_SedimentConcentration sediment_flux=NC_SedimentFlux erosion_deposition=NC_ErosiontoDeposition logfile=NC_Sample walkers_output=NC_Walkers_Sediment nwalkers=10000 nproces=4

... crash ... bt full

For better debugging, it is needed to compile GRASS GIS with CFLAG -g:

CFLAGS="-g" ./configure ... make ...

but you could give it a try without first.

[1] https://grasswiki.osgeo.org/wiki/GRASS_Debugging#Using_GDB

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OSGeo/grass/issues/1091#issuecomment-729250837, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARNOWNPLZ5NO5JIVET66KDTSQLZ5HANCNFSM4TXWDNDQ .

petrasovaa commented 4 years ago

Dear Mr. Neteler, Thank you for taking interest in this problem. Today I will try to run the process in the debugger. However, the results should be available tomorrow. It is much appreciated for giving me these instructions as well. With that, I should be able to do this much quicker. Thank you for your time and help. Best Regards, Piotr Kopyść

No need to do that, I already fixed the problem, see the linked PR, I will merge it soon.

neteler commented 4 years ago

The fix has also been backported, to be published in the upcoming GRASS GIS 7.8.5.

PiotrKopysc commented 4 years ago

Dear All,

I have recompiled Grass GIS from the current master build and tested the behavior of the r.sim.sediment. Now it works flawlessly, no segmentation fault error has been spotted, and all of the output (raster maps) have been produced in the map set. Thank you for all the help and support.

Best regards, Piotr Kopyść

wenzeslaus commented 4 years ago
gdb r.sim.sediment
...
(gdb) r --overwrite elevation=elev_lid792_1m@PERMANENT ...

... crash ...
bt full

Not needed here anymore, but for the record, you can also use gdb -ex run --args ... (I added that to the the wiki):

gdb -ex run --args r.sim.sediment --overwrite elevation=elev_lid792_1m@PERMANENT ...