[GRASS-dev] testing results of r.watershed2 against old r.watershed

Markus Metz markus_metz at gmx.de
Mon Dec 1 10:38:49 EST 2008



Hamish wrote:
> Markus Metz wrote:
>   
>> Actually I wanted to apply the changes of the r.watershed version in
>> grass-7 to r.watershed2, especially naming of options without points
>> and uppercase, but didn't get yet to it.
>>     
>
> done.  ('svn merge' did 99% of the work after devbr6 was solved)
>   
Change option names also for r.watershed.ram and r.watershed.seg? There 
are some options in uppercase.
> see the man page for an example of making a nicely colored accum map
> based on standard deviations.
>
> if visual= is to be removed, that should only happen in grass 7.
>   
Why not setting colors for accum in the module?
> in my tests r.watershed(2) is >80 times faster than r.watershed(1). nice!
> (35min -> 25sec for RAM mode to complete; new SEG mode took 4.5min)
> all maps appear the same as old r.watershed.
>   
The speed increase is not static, the new version will be faster the 
larger the region (more cells). For somewhat larger regions, the new 
module is >1000 times faster.
> #spearfish
> g.region rast=elevation.10m
>
> time r.watershed -m mem=800 elev=elevation.10m threshold=3000 \
>   accum=rw2_elev10m.acc \
>   drain=rw2_elev10m.drain \
>   basin=rw2_elev10m.basin \
>   str=rw2_elev10m.stream \
>   half.b=rw2_elev10m.halfb \
>   vis=rw2_elev10m.viz \
>   length.sl=rw2_elev10m.ls \
>   slope.st=rw2_elev10m.sls
>
>
>
> One thing with -m (seg mode).. without -m (ram mode) it takes 166mb RAM.
> With -m it took just under what I set memory= to. If I set mem=950 it
> used 911mb RAM. Does it not know it only needs ~166mb instead of full
> alloc?
>   
It should, but I made a mistake in adjusting the number of open 
segments. Please apply the diff attached.
> Also, if I set -m memory=1200 the r.watershed.seg exits with an error (11):
> [same elevation.10m which takes 166mb in RAM mode]
> ====
> SECTION 1 beginning: Initiating Variables. 6 sections total.
> D1/1: segs MB: 1200
> D1/1: seg cols: 200
> D1/1: seg rows: 200
> D1/1:    row segments:  7
> D1/1: column segments:  10
> D1/1:  total segments:  70
> D1/1:   open segments:  419
> D1/1:   open segments after adjusting:  419
>   
open segments after adjusting should be 70, fixed with diff.

> SECTION 1b (of 6): Determining Offmap Flow.
>  100%
>  100%
> WARNING: category information for [...] missing
> [...]
> ====
> G63> echo $?
> 11
>
> top reported 1150mb allocated, and I have 2gb so plenty still to spare
> and not Linux tearing down a runaway proc AFAICT..
> so why the early exit?
>   
That may be related to the number of open segments exceeding the number 
of existing segments. After the changes as in the diff I could not 
reproduce that error. Top now reports about 110 MB allocated for 
segmented mode, no matter what I specified with memory.

There was also another error in init_vars.c, no memory allocated to char 
*mb_opt which could cause a segfault, fixed with diff.

I wonder how many more bugs will surface after more testing...

Markus Metz

-------------- next part --------------
A non-text attachment was scrubbed...
Name: r.watershed2.diff
Type: text/x-patch
Size: 1785 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/grass-dev/attachments/20081201/3af5cd2e/r.watershed2.bin


More information about the grass-dev mailing list