tpilz / lumpR

Landscape Unit Mapping Program for R
GNU General Public License v3.0
11 stars 12 forks source link

RAM limitation observation with area2catena() and large study areas #28

Closed lbergi closed 7 years ago

lbergi commented 7 years ago

Dear Tobias and Till, We found out something about study area size and RAM limitation working with lumpR, that might be interesting for you: My study area is quite large: with 9090 m resolution it has 75545028 cells. (details further down). Area2catena works with 6 layers, that means that
Total Cells: 75545028
Layer (6)= 453 270 168 Cells are used, transfered and processed in the function. That process reaches the limits of my computer RAM (8 GB). Using the recommend parallelization (more cores) leads to some kind of an overflow of the RAM requirements. Observing a task manager you can see, that the CPU drops to 1-5% while RAM is full (95%). The function will never end (I interrupted it after 5 days of computing during the long easter weekend). You need to force break the whole machine. The solution that worked for us is to only use 1 core. With that, the function is successfully computed. But: the computation duration is about 12 h and the RAM is at limit (nothing works anymore, R session gives you the dubious "cannot allocate memory" message with any action you try and you need to restart the computer). A possible explanation is, that by needing more RAM than your computer offers, processes are transferred to swap (deferred for later). Transferring data to swap and back needs much time, what can be an explanation for long computing duration.

Summary: For study areas larger than ours you might use a server or a computer that has more RAM than 8 GB.

Details: Ehas= ca 28.000 (with the parameter settings quite all of them are included)

Region: projection: 1 (UTM) zone: -23 datum: wgs84 ellipsoid: wgs84 north: 8394608.94608946 south: 7573260.73260733 west: 150000 east: 895015.88956751 nsres: 90.00090001 ewres: 89.99950345 rows: 9126 cols: 8278 cells: 75545028

Mask: ----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 1
Data Type: CELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = 1 max = 1
Data Description:
generated by r.mapcalc
Comments:
if(isnull(elev_riv), null(), 1)

+----------------------------------------------------------------------------+

DATA:

Digital Elevation Model:

----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 255
Data Type: FCELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = 299 max = 2076
Data Description:
generated by r.mapcalc
Comments:
if(mask_with_dam == 100, dem_shrink + 100, dem_shrink)

+----------------------------------------------------------------------------+

Flow Accum

----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 255
Data Type: DCELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = 1 max = 7048270
Data Description:
generated by r.mapcalc
Comments:
abs(flow_accum_t)

+----------------------------------------------------------------------------+

Eha

----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 0
Data Type: CELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = 21189 max = 53450
Data Description:
generated by r.grow
Comments:
r.grow input="eha_t2" output="eha" radius=100 metric="euclidean"

+----------------------------------------------------------------------------+

_distriv

----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 255
Data Type: DCELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = 0 max = 197.989052746315
Data Description:
generated by r.mapcalc
Comments:
dist_riv_t / 90.000202

+----------------------------------------------------------------------------+

_elevriv

----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 255
Data Type: FCELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = -78 max = 669
Data Description:
generated by r.stream.distance

+----------------------------------------------------------------------------+

svc

----------------------------------------------------------------------------
Type of Map: raster Number of Categories: 960
Data Type: CELL
Rows: 9126
Columns: 8278
Total Cells: 75545028
Projection: UTM (zone -23)
N: 8394608.94608946 S: 7573260.73260733 Res: 90.00090001
E: 895015.88956751 W: 150000 Res: 89.99950345
Range of data: min = 0 max = 960
Data Description:
generated by r.cross

+----------------------------------------------------------------------------+

Kind regards, Lisa and Josee

TillF commented 7 years ago

relates to #16

lbergi commented 7 years ago

I fixed the region of the dataset and converted any DCELL and FCELL data types to CELL. area2catena() is now succesfull, but prof_class() results to an error, that might also be a sign for RAM limitation. This is the error message I got: grafik Till optimized the code, so that the file can be successfully loaded and processed. Still the data reaches a limit in R, the r session aborts without a message. I tried it with terminal only to gather some more information. This is the (shortened with [...] )output: [....]

[1] "...100%"
 ...loaded.
profile clustering [...]
three closest catenas to cntre of class  1 [...]
three closest catenas to cntre of class  2 [...]
three closest catenas to cntre of class  3  [...]
start decomposition of TCs
partitioning class 1 of 3
Killed.

Kind regards, Lisa