Hi list,
Based on a discussion in the list archive, I copied and edited a script that parallelizes the r.horizon module across multiple cores (link). I have updated this script to work with the current module parameter naming schemes where required. Additionally I added a for loop to the main() function, as I want it to do the r.horizon module for several areas sequentially (setting g.region, etc…).
I have several issues:
- Each time it creates the workers for the last r.horizon angles for a list item, it also creates the workers for the first angles of the next item in the list. But it should finish the first workers, copy the raster from the temporary mapsets to the current mapset and delete the temporary mapsets before creating new workers and starting the process again.
- It doesn’t calculate the last angles of the last area part of the list that it loops over. Though I think this is because of the first issue which is that the order of execution is off.
Why doesn’t it follow the correct order as per the script but move on to the next step before finishing the last? I run the script from the simple python editor in Grass 7.2.0.
(attachments)
horizonmp.py (7.4 KB)
On Tue, May 2, 2017 at 10:09 AM, Tinsley Wolfs <twolfs15@student.aau.dk> wrote:
Hi list,
Based on a discussion in the list archive, I copied and edited a script that
parallelizes the r.horizon module across multiple cores (link). I have
updated this script to work with the current module parameter naming schemes
where required. Additionally I added a for loop to the main() function, as I
want it to do the r.horizon module for several areas sequentially (setting
g.region, etc...).
I have several issues:
1. Each time it creates the workers for the last r.horizon angles for a list
item, it also creates the workers for the first angles of the next item in
the list. But it should finish the first workers, copy the raster from the
temporary mapsets to the current mapset and delete the temporary mapsets
before creating new workers and starting the process again.
2. It doesn't calculate the last angles of the last area part of the list
that it loops over. Though I think this is because of the first issue which
is that the order of execution is off.
Why doesn't it follow the correct order as per the script but move on to the
next step before finishing the last? I run the script from the simple python
editor in Grass 7.2.0.
Not sure if that's the problem but it seems this condition on line 232
(unless it messed up the line numbers):
if(c < cores):
won't ensure all processes will be joined, for example with 4 cores
and 22 processes, you will process and join 5 chunks of 4 processes
and the 2 last ones won't be joined. That's at least what I guessed
from your code, might be something different too.
Anna
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user