<div dir="ltr"><div><br><br>On Thu, Apr 27, 2017 at 1:31 PM, Markus Neteler <<a href="mailto:neteler@osgeo.org">neteler@osgeo.org</a>> wrote:<br>><br>> Hi,<br>><br>> I am trying to improve the color balance of a large Sentinel-2 scene.<br>> The job fail like this:<br>><br>> i.colors.enhance ....<br>> creating color enhanced composite B8A B11 B04....<br>> Processing...<br>> ERROR: G_calloc: unable to allocate 18446744071588213116 * 8 bytes of<br>> memory at raster/r.quantile/main.c:355<br><br></div>The number 18446744071588213116 is unrealistically large because it should not be larger than rows * cols<br><div><br>[...]<br>><br>> The Sentinel-2 scene is 169410 * 88264 rows/cols large which does not<br>> explain this problem.<br><br></div><div>I would rather expect a call to G_calloc requesting a maximum of 14952804240 * 8 bytes, most likely less.<br><br></div><div>The reason for the wrong number is integer overflow because num_values is of type int. Please try trunk r70982.<br><br></div><div>Markus M<br></div><div><br>><br>> I recall that i.colors.enhance uses the Python "multiprocessing" backend.<br>> Assuming 4 parallel threads (not sure how many the script will take?<br>> not documented... an nproc parameter would be better) I estimate this<br>> RAM usage:<br>><br>> > 169410*88264 *4<br>> [1] 478489735680 bytes<br>> > 169410*88264 *4 /1014/1014/1014<br>> [1] 57.36788 GB<br>><br>> which exceeds the existing 32GB RAM + 8 GB swap.<br>><br>> Questions:<br>><br>> a) is my assumption right? Still the 18446744071588213116 are weird.<br>> The scripts runs fine for 10th of other Sentinel-2 scenes.<br>><br>> b) how to control the number of parallel threads in i.colors.enhance<br>> expect for the very limiting -s flag?<br>><br>> thanks,<br>> Markus<br>> _______________________________________________<br>> grass-dev mailing list<br>> <a href="mailto:grass-dev@lists.osgeo.org">grass-dev@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-dev">https://lists.osgeo.org/mailman/listinfo/grass-dev</a><br><br></div></div>