Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve paralell processing #43

Open
matamadio opened this issue Sep 24, 2024 · 0 comments
Open

Improve paralell processing #43

matamadio opened this issue Sep 24, 2024 · 0 comments

Comments

@matamadio
Copy link
Collaborator

The multiprocessing native library is cool, but sometimes generates error, e.g. when selecting Nepal ADM lvl 1, for some reason we get:

ValueError: Object is not a recognized source of Features

This is solved in runAnalysis.py editing:

        # Parallel processing setup
        cores = min(len(valid_RPs), mp.cpu_count()) if n_cores is None else n_cores

disabling the multiprocessing:

        # Parallel processing setup
        cores = 1

This indicates that the problem was likely with how multiprocessing was handling the data in parallel, possibly due to issues with data splitting or passing across processes.
Why It Happened:

  1. GeoPandas and Multiprocessing: GeoPandas objects (GeoDataFrames) sometimes don't work smoothly with Python's multiprocessing, particularly when splitting or passing geometries between processes.
  2. Pickling Errors: When data is sent between processes, it needs to be "pickled" (serialized). Complex objects like geometries or dataframes can cause issues.
  3. Resource Conflicts: Some libraries (like rasterio or GeoPandas) have trouble when opened in parallel, especially if file handlers or system resources (e.g., raster files) are shared between processes.

If this persists, we should look on how fix the root of the issue, change how serialization works and possibly move to dask-geopandas or dask, which can sometimes handle large GeoPandas dataframes better in parallel than the native multiprocessing library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant