Opened 10 years ago
Last modified 5 years ago
#2356 new defect
r.stream.basisns uses more memory than given in memory option
Reported by: | sbl | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.8.3 |
Component: | Addons | Version: | svn-trunk |
Keywords: | r.stream.basins, memory | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
I tried to run r.stream.basins on using large flow direction / stream maps generated with r.watershed.
With m-flag and memory option set to 35GB (~2/3 of the RAM of my system) the process got killed (by out-of-mmemory-killer) after input maps were read.
So, I re-ran the module with a smaller amount of memory allocated (20 and 10 GB) in the memory option and monitored memory usage (UNIX top command). There I found that r.stream.basisns used 2x the amount of RAM allowed, on each input map. In other words, with memory=10000, it used
20GB for reading flow direction map, plus
20GB for reading streams map (40GB in total).
Finally, the process gets killed when it starts finding nodes.
I am using Ubuntu 12.04 LTS 64bit and GRASS 7.0 (revision 58620).
Change History (18)
comment:1 by , 10 years ago
Component: | Raster → Addons |
---|---|
Keywords: | r.stream.basins added; r.stream.basisns removed |
comment:2 by , 10 years ago
I wrote:
if the stream_rast= option is used then two ram_create_map()s happen.
sorry, two seg_create_map() happen without stream_rast=, three if with it.
comment:3 by , 10 years ago
Both input maps (dirs and streams) were generated by r.watershed and are CELL.
r.stream.basins worked just fine when I set the memory option to ~1/7 of the available RAM.
comment:5 by , 10 years ago
Both input maps had: Rows: 180752 Columns: 141312 The region followed exactly those maps (it was not changed after maps were generated with r.watershed).
comment:6 by , 10 years ago
so for an unsegmented cell map, 180752 * 141312 * 4 bytes = ~97GB to hold one whole map in ram.
r.stream.basins/io.h defines segments as 256x256, so for memory=10000 (mb)
seg_create_map(&map_dirs, SROWS, SCOLS, number_of_segs, CELL_TYPE);
we get
bytes = ~20.8GB, and needs that for each of the two or three open maps.
can you try r61149?
Hamish
follow-up: 8 comment:7 by , 10 years ago
FYI, 20.8GB is exactly the amount of memory consumption for reading the input maps reported by the top command, when I ran r.stream.basins with memory=10000.
comment:8 by , 10 years ago
Replying to sbl:
FYI, 20.8GB is exactly the amount of memory consumption for reading the input maps reported by the top command, when I ran r.stream.basins with memory=10000.
ok, then the math works. :-)
can someone familiar with this module give a 3rd party confirmation that the memory= option is now properly respected?
thanks, Hamish
comment:9 by , 10 years ago
TODO for all r.stream.* modules (reported by mmetz in grass-dev):
Most importantly it is the NULL handling that needs to be fixed, and synced between the ram and disk modes. More generally, the ram and disk modes need to be synced and validated. For ease of maintenance, the ram mode could be removed.
comment:12 by , 8 years ago
Milestone: | 7.2.1 → 7.2.2 |
---|
comment:14 by , 7 years ago
Should we close this and maybe open a new ticket for "Syncing and validating ram and disk modes in r.stream.*" ?
comment:16 by , 7 years ago
Milestone: | → 7.2.4 |
---|
comment:18 by , 5 years ago
Milestone: | → 7.8.3 |
---|
were the input maps CELL, FCELL or DCELL?
fwiw here's the code,
if the stream_rast= option is used then two ram_create_map()s happen. Likely the above number_of_segs isn't taking that into account.
did it work ok when you halved the memory= option?
Hamish