[GRASS-user] r.cost: exact meaning of percent_memory ?

I am trying to understand the 'percent_memory' option in r.cost. In the man page it says: "The amount of map to hold in memory at one time can be controlled with the percent_memory option. For large maps this value will have to be set to a lower value.".

IIUC, this would mean that if I have a region of X DCELL cells, I would need: X*8 bytes of memory, or ?

So if memory available is > X*8 I should be able to use percent_memory=100 (or at least 75). Is that correct ?

Is there a special reason why r.cost doesn't use a "memory" parameter instead of percent_memory ? IMHO, the former is a bit easier to handle for the average user.

Moritz

On Thu, Jan 22, 2015 at 2:30 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

I am trying to understand the 'percent_memory' option in r.cost. In the man
page it says: "The amount of map to hold in memory at one time can be
controlled with the percent_memory option. For large maps this value will
have to be set to a lower value.".

The man page is wrong, it is not the amount of the map, but the amount
of the current region.

IIUC, this would mean that if I have a region of X DCELL cells, I would
need: X*8 bytes of memory, or ?

No, it would need X * 3 * 8 bytes (if direction output is requested,
another X * 4 bytes). Considering that you are a power user and
developer, and that you do not understand the 'percent_memory' option,
it is high time to change that option to the standard memory option
where the user specifies the amount of memory in MB that should be
used.

So if memory available is > X*8 I should be able to use percent_memory=100
(or at least 75). Is that correct ?

No, see also above, the input cost surface, the output accumulated
cost surface, and the cell value of the nearest starting point are
held in memory. If a direction output map is requested, this one is
also held in memory.

Is there a special reason why r.cost doesn't use a "memory" parameter
instead of percent_memory ? IMHO, the former is a bit easier to handle for
the average user.

Historical reasons. I wanted to change the 'percent_memory' option to
a 'memory' option, but did not find the time yet. Same for r.walk.

Markus M

Moritz
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

On 22/01/15 21:12, Markus Metz wrote:

On Thu, Jan 22, 2015 at 2:30 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

I am trying to understand the 'percent_memory' option in r.cost. In the man
page it says: "The amount of map to hold in memory at one time can be
controlled with the percent_memory option. For large maps this value will
have to be set to a lower value.".

The man page is wrong, it is not the amount of the map, but the amount
of the current region.

Ok.

IIUC, this would mean that if I have a region of X DCELL cells, I would
need: X*8 bytes of memory, or ?

No, it would need X * 3 * 8 bytes (if direction output is requested,
another X * 4 bytes). Considering that you are a power user and
developer, and that you do not understand the 'percent_memory' option,
it is high time to change that option to the standard memory option
where the user specifies the amount of memory in MB that should be
used.

Yes. I do plead guilty for not haven taken the time to look at the code in detail to understand, but the man page definitely does not help. If this can be changed into the standard memory option, this would be great. If this cannot be done soon, then a change to the man page would already be a plus, maybe indicating the calculations.

So if memory available is > X*8 I should be able to use percent_memory=100
(or at least 75). Is that correct ?

No, see also above, the input cost surface, the output accumulated
cost surface, and the cell value of the nearest starting point are
held in memory. If a direction output map is requested, this one is
also held in memory.

This info should go into the man page.

Moritz

On Fri, Jan 23, 2015 at 6:16 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 22/01/15 21:12, Markus Metz wrote:

On Thu, Jan 22, 2015 at 2:30 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

IIUC, this would mean that if I have a region of X DCELL cells, I would
need: X*8 bytes of memory, or ?

No, it would need X * 3 * 8 bytes (if direction output is requested,
another X * 4 bytes). Considering that you are a power user and
developer, and that you do not understand the 'percent_memory' option,
it is high time to change that option to the standard memory option
where the user specifies the amount of memory in MB that should be
used.

Yes. I do plead guilty for not haven taken the time to look at the code in
detail to understand, but the man page definitely does not help. If this can
be changed into the standard memory option, this would be great.

Done in trunk r64287 and relbr70 r64288.

The percent_memory option has been changed to memory (in MB) for both
r.cost and r.walk, these modules are siblings.

Markus M

If this
cannot be done soon, then a change to the man page would already be a plus,
maybe indicating the calculations.

So if memory available is > X*8 I should be able to use
percent_memory=100
(or at least 75). Is that correct ?

No, see also above, the input cost surface, the output accumulated
cost surface, and the cell value of the nearest starting point are
held in memory. If a direction output map is requested, this one is
also held in memory.

This info should go into the man page.

Moritz

On 23/01/15 20:49, Markus Metz wrote:

On Fri, Jan 23, 2015 at 6:16 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

On 22/01/15 21:12, Markus Metz wrote:

On Thu, Jan 22, 2015 at 2:30 PM, Moritz Lennert
<mlennert@club.worldonline.be> wrote:

IIUC, this would mean that if I have a region of X DCELL cells, I would
need: X*8 bytes of memory, or ?

No, it would need X * 3 * 8 bytes (if direction output is requested,
another X * 4 bytes). Considering that you are a power user and
developer, and that you do not understand the 'percent_memory' option,
it is high time to change that option to the standard memory option
where the user specifies the amount of memory in MB that should be
used.

Yes. I do plead guilty for not haven taken the time to look at the code in
detail to understand, but the man page definitely does not help. If this can
be changed into the standard memory option, this would be great.

Done in trunk r64287 and relbr70 r64288.

The percent_memory option has been changed to memory (in MB) for both
r.cost and r.walk, these modules are siblings.

Thanks Markus, efficient as always !

Moritz